From 5ca33a19eee18eff97d04d4978f75232780594a1 Mon Sep 17 00:00:00 2001 From: Innocent-akim Date: Wed, 30 Oct 2024 14:48:10 +0200 Subject: [PATCH 1/4] feat: implement timesheet filter component with status, date filters ... --- apps/web/app/[locale]/calendar/component.tsx | 2 +- .../timesheet/components/FilterWithStatus.tsx | 4 +- .../timesheet/components/FrequencySelect.tsx | 122 ++++++++++++++---- .../timesheet/components/TimesheetCard.tsx | 10 +- .../timesheet/components/TimesheetFilter.tsx | 66 +++++----- .../timesheet/components/TimesheetView.tsx | 1 - .../components/time-sheet-filter-popover.tsx | 103 +++++++++++++++ apps/web/app/[locale]/timesheet/page.tsx | 20 ++- .../calendar/setup-full-calendar.tsx | 2 +- .../calendar/table-time-sheet.tsx | 8 +- 10 files changed, 264 insertions(+), 74 deletions(-) create mode 100644 apps/web/app/[locale]/timesheet/components/time-sheet-filter-popover.tsx diff --git a/apps/web/app/[locale]/calendar/component.tsx b/apps/web/app/[locale]/calendar/component.tsx index f000fa1d8..f85f5fef1 100644 --- a/apps/web/app/[locale]/calendar/component.tsx +++ b/apps/web/app/[locale]/calendar/component.tsx @@ -11,7 +11,7 @@ import { SelectItem, SelectTrigger, SelectValue, -} from "@components/ui/select" +} from "@components/ui/select"; import { cn } from "lib/utils"; import { CalendarDays } from "lucide-react"; import React from "react"; diff --git a/apps/web/app/[locale]/timesheet/components/FilterWithStatus.tsx b/apps/web/app/[locale]/timesheet/components/FilterWithStatus.tsx index ed38c2d23..cafb4a84a 100644 --- a/apps/web/app/[locale]/timesheet/components/FilterWithStatus.tsx +++ b/apps/web/app/[locale]/timesheet/components/FilterWithStatus.tsx @@ -20,11 +20,11 @@ export function FilterWithStatus({ ]; return ( -
+
{buttonData.map(({ label, count, icon }, index) => (
{/* */}
- +
{timesheetNavigator === 'ListView' ? diff --git a/apps/web/lib/features/integrations/calendar/setup-full-calendar.tsx b/apps/web/lib/features/integrations/calendar/setup-full-calendar.tsx index e6c9789a3..9169b391f 100644 --- a/apps/web/lib/features/integrations/calendar/setup-full-calendar.tsx +++ b/apps/web/lib/features/integrations/calendar/setup-full-calendar.tsx @@ -1,5 +1,5 @@ "use client" -import React, { useState, useRef } from 'react'; +import { useState, useRef } from 'react'; import { LuCalendarPlus } from "react-icons/lu"; import { IoIosArrowDown, IoIosArrowForward } from "react-icons/io"; import { IoTimeSharp } from "react-icons/io5"; diff --git a/apps/web/lib/features/integrations/calendar/table-time-sheet.tsx b/apps/web/lib/features/integrations/calendar/table-time-sheet.tsx index 7f479781d..15b17e743 100644 --- a/apps/web/lib/features/integrations/calendar/table-time-sheet.tsx +++ b/apps/web/lib/features/integrations/calendar/table-time-sheet.tsx @@ -48,10 +48,10 @@ import { MdKeyboardDoubleArrowRight, MdKeyboardArrowLeft, MdKeyboardArrowRight -} from "react-icons/md"; +} from "react-icons/md" import { ConfirmStatusChange, StatusBadge, TimeSheet, dataSourceTimeSheet, statusOptions } from "." import { useModal } from "@app/hooks" -import { Checkbox } from "@components/ui/checkbox"; +import { Checkbox } from "@components/ui/checkbox" @@ -214,8 +214,8 @@ export function DataTableTimeSheet() {
- - +
+ {table.getHeaderGroups().map((headerGroup) => ( {headerGroup.headers.map((header) => { From ab254cc077d4b6151e7007011a415052903a1ff8 Mon Sep 17 00:00:00 2001 From: Innocent-akim Date: Wed, 30 Oct 2024 15:07:46 +0200 Subject: [PATCH 2/4] fix: error --- .../timesheet/components/TimesheetFilter.tsx | 2 +- apps/web/app/[locale]/timesheet/page.tsx | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx b/apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx index 3bfabb281..7e41777e1 100644 --- a/apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx +++ b/apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx @@ -4,7 +4,7 @@ import { Button } from 'lib/components'; import { TimeSheetFilterPopover } from './time-sheet-filter-popover'; import { Cross2Icon } from '@radix-ui/react-icons'; -export function TimesheetFilter({ isOpen, openModal, closeModal }: { isOpen?: boolean, openModal?: () => void, closeModal?: () => void }) { +export function TimesheetFilter() { return ( <> diff --git a/apps/web/app/[locale]/timesheet/page.tsx b/apps/web/app/[locale]/timesheet/page.tsx index f44f2b66b..70ac4267f 100644 --- a/apps/web/app/[locale]/timesheet/page.tsx +++ b/apps/web/app/[locale]/timesheet/page.tsx @@ -7,7 +7,7 @@ import { withAuthentication } from 'lib/app/authenticator'; import { Breadcrumb, Container, Divider } from 'lib/components'; import { Footer, MainLayout } from 'lib/layout'; -import { useLocalStorageState, useModal, useOrganizationTeams } from '@app/hooks'; +import { useLocalStorageState, useOrganizationTeams } from '@app/hooks'; import { clsxm } from '@app/utils'; import { fullWidthState } from '@app/stores/fullWidth'; import { useAtomValue } from 'jotai'; @@ -27,11 +27,7 @@ type ViewToggleButtonProps = { function TimeSheetPage() { const t = useTranslations(); - const { - isOpen: isManualTimeModalOpen, - openModal: openManualTimeModal, - closeModal: closeManualTimeModal - } = useModal() + const [timesheetNavigator, setTimesheetNavigator] = useLocalStorageState('timesheet-viewMode', 'ListView'); const fullWidth = useAtomValue(fullWidthState); @@ -118,10 +114,7 @@ function TimeSheetPage() { {/* */}
- +
{timesheetNavigator === 'ListView' ? From 78560c389291c7cd4af2c6a39d5448cc2ef85054 Mon Sep 17 00:00:00 2001 From: Innocent-akim Date: Wed, 30 Oct 2024 16:29:41 +0200 Subject: [PATCH 3/4] fix: resolve --- .../[locale]/timesheet/components/FilterWithStatus.tsx | 8 ++++++-- .../[locale]/timesheet/components/FrequencySelect.tsx | 8 +++++--- .../app/[locale]/timesheet/components/TimesheetCard.tsx | 3 +-- .../[locale]/timesheet/components/TimesheetFilter.tsx | 9 ++++----- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/apps/web/app/[locale]/timesheet/components/FilterWithStatus.tsx b/apps/web/app/[locale]/timesheet/components/FilterWithStatus.tsx index cafb4a84a..f03c3f2e4 100644 --- a/apps/web/app/[locale]/timesheet/components/FilterWithStatus.tsx +++ b/apps/web/app/[locale]/timesheet/components/FilterWithStatus.tsx @@ -20,11 +20,15 @@ export function FilterWithStatus({ ]; return ( -
+
{buttonData.map(({ label, count, icon }, index) => ( +
@@ -145,8 +148,7 @@ export function DynamicDatePicker({ + + +); export function DynamicDatePicker({ label, @@ -148,28 +169,13 @@ export function DynamicDatePicker({ - - - - } + buttonClassName={'decoration-transparent flex items-center w-full bg-white dark:bg-dark--theme-light border-gray-300 justify-start text-left font-normal text-black h-10 border dark:border-slate-600 rounded-md'} + customInput={} mode="single" numberOfMonths={1} initialFocus - defaultMonth={date || new Date()} - selected={date!} + defaultMonth={date ?? new Date()} + selected={date ?? new Date()} onSelect={(selectedDate) => selectedDate && setDate(selectedDate)} />
diff --git a/apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx b/apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx index 21edc8dc8..9249a9036 100644 --- a/apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx +++ b/apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx @@ -22,7 +22,12 @@ export function TimesheetFilter() {
-