Linking backend data to frontend

This commit is contained in:
iv_vuytsik
2025-10-15 19:49:19 +03:00
parent ea1f50c1b8
commit 2b19ed246b
28 changed files with 959 additions and 385 deletions

View File

@@ -3,14 +3,15 @@
import React, { useState } from 'react'
interface ExportMenuProps {
onExport: (format: 'csv' | 'pdf') => void
onExport: (format: 'csv' | 'pdf', hours: number) => void
}
const ExportMenu: React.FC<ExportMenuProps> = ({ onExport }) => {
const [selectedFormat, setSelectedFormat] = useState<'csv' | 'pdf'>('csv')
const [selectedHours, setSelectedHours] = useState<number>(168) // default: week
const handleExport = () => {
onExport(selectedFormat)
onExport(selectedFormat, selectedHours)
}
return (
@@ -40,6 +41,20 @@ const ExportMenu: React.FC<ExportMenuProps> = ({ onExport }) => {
<span className="text-gray-300 text-sm">PDF</span>
</label>
</div>
<div className="flex items-center gap-2 ml-4">
<span className="text-gray-300 text-sm">Период:</span>
<select
className="bg-[#0e111a] text-gray-200 border border-gray-700 rounded px-2 py-1 text-sm"
value={selectedHours}
onChange={(e) => setSelectedHours(Number(e.target.value))}
>
<option value={24}>1 день</option>
<option value={72}>3 дня</option>
<option value={168}>Неделя</option>
<option value={720}>Месяц</option>
</select>
</div>
<button
onClick={handleExport}