From df5f60e54027ab54a9bfbb3c81682233ce479716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Thu, 7 May 2026 15:18:32 -0300 Subject: [PATCH] style: unify filter UI, add custom to-from date picker, and ensure all buttons use pointer cursors --- src/components/DateRangePicker.tsx | 60 ++++++++++++++++++++++++++++-- src/components/Layout.tsx | 2 +- src/pages/Clients.tsx | 12 +++--- src/pages/Products.tsx | 10 ++--- 4 files changed, 68 insertions(+), 16 deletions(-) diff --git a/src/components/DateRangePicker.tsx b/src/components/DateRangePicker.tsx index 49b62bd..c0b94da 100644 --- a/src/components/DateRangePicker.tsx +++ b/src/components/DateRangePicker.tsx @@ -38,13 +38,41 @@ const DateRangePicker: React.FC = ({ dateRange, onChange, return date.toLocaleDateString('pt-BR', { day: '2-digit', month: '2-digit', year: '2-digit' }); }; + const formatDateForInput = (date: Date) => { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; + }; + + const parseLocalDate = (value: string) => { + if (!value) return null; + const [year, month, day] = value.split('-'); + return new Date(parseInt(year), parseInt(month) - 1, parseInt(day)); + }; + + const handleStartChange = (e: React.ChangeEvent) => { + const newStart = parseLocalDate(e.target.value); + if (newStart && !isNaN(newStart.getTime())) { + onChange({ ...dateRange, start: newStart }); + } + }; + + const handleEndChange = (e: React.ChangeEvent) => { + const newEnd = parseLocalDate(e.target.value); + if (newEnd && !isNaN(newEnd.getTime())) { + newEnd.setHours(23, 59, 59, 999); + onChange({ ...dateRange, end: newEnd }); + } + }; + return (
{/* Date Presets Dropdown */}
@@ -77,7 +129,7 @@ const DateRangePicker: React.FC = ({ dateRange, onChange,