-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat]: DataTableTimeSheet and SelectFilter components for improved a…
…nd status management (#3223) * feat: Refactor DataTableTimeSheet and SelectFilter components for improved readability and status management * fix: resolve * fix: resolve * feat: enhance timesheet component
- Loading branch information
1 parent
df0452e
commit 4f30b12
Showing
21 changed files
with
658 additions
and
357 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
apps/web/app/[locale]/timesheet/[memberId]/components/TimesheetAction.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { clsxm } from "@/app/utils"; | ||
import { ReactNode } from "react"; | ||
import { FaClipboardCheck } from "react-icons/fa6"; | ||
import { IoClose } from "react-icons/io5"; | ||
import { RiDeleteBin6Fill } from "react-icons/ri"; | ||
type ITimesheetButton = { | ||
title?: string, | ||
onClick?: () => void, | ||
className?: string, | ||
icon?: ReactNode | ||
|
||
} | ||
export const TimesheetButton = ({ className, icon, onClick, title }: ITimesheetButton) => { | ||
return ( | ||
<button onClick={onClick} className={clsxm("flex items-center gap-1 text-gray-400 font-normal leading-3", className)}> | ||
<div className="w-[16px] h-[16px] text-[#293241]"> | ||
{icon} | ||
</div> | ||
<span>{title}</span> | ||
</button> | ||
) | ||
} | ||
|
||
|
||
export type StatusType = "Pending" | "Approved" | "Rejected"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
export const getTimesheetButtons = (status: StatusType) => { | ||
const buttonsConfig: Record<StatusType, { icon: JSX.Element; title: string }[]> = { | ||
Pending: [ | ||
{ icon: <FaClipboardCheck className="!text-[#2932417c] rounded" />, title: "Approve Selected" }, | ||
{ icon: <IoClose className="!bg-[#2932417c] rounded" />, title: "Reject Selected" }, | ||
{ icon: <RiDeleteBin6Fill className="!text-[#2932417c] rounded" />, title: "Delete Selected" } | ||
], | ||
Approved: [ | ||
{ icon: <IoClose className="!bg-[#2932417c] rounded" />, title: "Reject Selected" }, | ||
{ icon: <RiDeleteBin6Fill className="!text-[#2932417c] rounded" />, title: "Delete Selected" } | ||
], | ||
Rejected: [ | ||
{ icon: <FaClipboardCheck className="!text-[#2932417c] rounded" />, title: "Approve Selected" }, | ||
{ icon: <RiDeleteBin6Fill className="!text-[#2932417c] rounded" />, title: "Delete Selected" } | ||
] | ||
}; | ||
|
||
return (buttonsConfig[status] || buttonsConfig.Rejected).map((button, index) => ( | ||
<TimesheetButton | ||
key={index} | ||
icon={button.icon} | ||
onClick={() => { | ||
// TODO: Implement the onClick functionality | ||
}} | ||
title={button.title} | ||
/> | ||
)); | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...e]/timesheet/components/TimesheetView.tsx → ...t/[memberId]/components/TimesheetView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { IDailyPlan } from '@/app/interfaces' | ||
import { DataTableTimeSheet } from 'lib/features/integrations/calendar' | ||
|
||
export function TimesheetView() { | ||
export function TimesheetView({ data }: { data?: IDailyPlan[] }) { | ||
return ( | ||
<div className='grow h-full w-full bg-[#FFFFFF]'> | ||
<DataTableTimeSheet /> | ||
<DataTableTimeSheet data={data} /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.