Linking backend data to frontend
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { ButtonProps } from '@/app/types'
|
||||
import { ButtonProps } from '@/types'
|
||||
|
||||
const Button = ({
|
||||
onClick,
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import toast from 'react-hot-toast'
|
||||
import { ToastProps } from '@/app/types'
|
||||
import { ToastProps } from '@/types'
|
||||
|
||||
const toastStyles = {
|
||||
success: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { TextInputProps } from '@/app/types'
|
||||
import { TextInputProps } from '@/types'
|
||||
import { HiOutlineEye, HiOutlineEyeOff } from 'react-icons/hi'
|
||||
|
||||
const TextInput = ({
|
||||
|
||||
Reference in New Issue
Block a user