diff --git a/apps/web/app/[locale]/timesheet/[memberId]/components/TimeSheetFilterPopover.tsx b/apps/web/app/[locale]/timesheet/[memberId]/components/TimeSheetFilterPopover.tsx index 364542878..743a0e4ab 100644 --- a/apps/web/app/[locale]/timesheet/[memberId]/components/TimeSheetFilterPopover.tsx +++ b/apps/web/app/[locale]/timesheet/[memberId]/components/TimeSheetFilterPopover.tsx @@ -1,7 +1,8 @@ import { useOrganizationTeams, useTeamTasks } from "@app/hooks"; import { Button } from "@components/ui/button"; import { statusOptions } from "@app/constants"; -import { MultiSelect } from "lib/components/custom-select/multi-select"; +import { MultiSelect } from "lib/components/custom-select"; +import React, { useEffect } from "react"; import { Popover, PopoverContent, @@ -9,13 +10,22 @@ import { } from "@components/ui/popover"; import { SettingFilterIcon } from "@/assets/svg"; import { useTranslations } from "next-intl"; +import { clsxm } from "@/app/utils"; export function TimeSheetFilterPopover() { + const [shouldRemoveItems, setShouldRemoveItems] = React.useState(false); const { activeTeam } = useOrganizationTeams(); const { tasks } = useTeamTasks(); const t = useTranslations(); + + useEffect(() => { + if (shouldRemoveItems) { + setShouldRemoveItems(false); + } + }, [shouldRemoveItems]); + return ( <> @@ -36,9 +46,10 @@ export function TimeSheetFilterPopover() {
(members ? members.employee.fullName : '')} itemId={(item) => item.id} @@ -50,11 +61,12 @@ export function TimeSheetFilterPopover() {
(members ? members.employee.fullName : '')} + removeItems={shouldRemoveItems} + items={activeTeam?.projects ?? []} + itemToString={(project) => (activeTeam?.projects ? project.name! : '')} itemId={(item) => item.id} onValueChange={(selectedItems) => console.log(selectedItems)} multiSelect={true} @@ -64,9 +76,10 @@ export function TimeSheetFilterPopover() {
task} itemId={(task) => (task ? task.id : '')} @@ -78,9 +91,10 @@ export function TimeSheetFilterPopover() {
(status ? status.value : '')} itemId={(item) => item.value} @@ -91,6 +105,7 @@ export function TimeSheetFilterPopover() {