From b3c01385861b59773692c4d581a8b0e132489152 Mon Sep 17 00:00:00 2001
From: AKILIMAILI CIZUNGU Innocent
<51681130+Innocent-Akim@users.noreply.github.com>
Date: Thu, 22 Aug 2024 07:52:01 +0200
Subject: [PATCH] Feat: refact timesheet (#2940)
* feat: refact timesheet
* fix: cspell
* fix: setCalendarTimeSheet is defined but never used.
* improv: timesheet
---
.cspell.json | 1 +
apps/web/app/[locale]/calendar/component.tsx | 103 +++++----
apps/web/app/[locale]/calendar/page.tsx | 17 +-
apps/web/components/ui/badge.tsx | 36 +++
.../calendar/calendar-component.tsx | 17 +-
.../integrations/calendar/helper-calendar.ts | 91 ++++++++
.../calendar/setup-full-calendar.tsx | 21 +-
.../calendar/setup-time-sheet.tsx | 13 +-
.../calendar/table-time-sheet.tsx | 214 +++++++++---------
.../calendar/time-sheet-filter-popover.tsx | 13 +-
apps/web/lib/features/task/task-filters.tsx | 26 ++-
11 files changed, 365 insertions(+), 187 deletions(-)
create mode 100644 apps/web/components/ui/badge.tsx
diff --git a/.cspell.json b/.cspell.json
index 0da70ed82..7d564cd35 100644
--- a/.cspell.json
+++ b/.cspell.json
@@ -33,6 +33,7 @@
"Bowser",
"Btns",
"Konviser",
+ "Ruslan",
"Bugsnag",
"buildjet",
"cacheable",
diff --git a/apps/web/app/[locale]/calendar/component.tsx b/apps/web/app/[locale]/calendar/component.tsx
index 3a44ef27e..4be0c2305 100644
--- a/apps/web/app/[locale]/calendar/component.tsx
+++ b/apps/web/app/[locale]/calendar/component.tsx
@@ -17,6 +17,7 @@ import { CalendarDays } from "lucide-react";
import React from "react";
import { DateRange } from "react-day-picker";
import { LuCalendarDays } from "react-icons/lu";
+import { Input } from "@components/ui/input";
export function HeadCalendar({
openModal,
@@ -65,54 +66,65 @@ export function HeadTimeSheet({ timesheet }: { timesheet?: timesheetCalendar })
from: new Date(2022, 0, 20),
to: addDays(new Date(2022, 0, 20), 20)
});
- console.log(timesheet);
return (
{timesheet === 'TimeSheet' && (
-
-
-
-
-
-
-
- >
- }
- mode={'range'}
- numberOfMonths={2}
- initialFocus
- defaultMonth={date?.from}
- selected={date}
- onSelect={(value) => {
- value && setDate(value);
- }}
+
+
-
-
+
+
+
+
+
+
+
+
+
+ >
+ }
+ mode={'range'}
+ numberOfMonths={2}
+ initialFocus
+ defaultMonth={date?.from}
+ selected={date}
+ onSelect={(value) => {
+ value && setDate(value);
+ }}
+ />
+
+
+
+
)}
@@ -133,9 +145,8 @@ export function CustomSelect() {
return (
-
-
+
{renderComponent()}
diff --git a/apps/web/components/ui/badge.tsx b/apps/web/components/ui/badge.tsx
new file mode 100644
index 000000000..304da38fa
--- /dev/null
+++ b/apps/web/components/ui/badge.tsx
@@ -0,0 +1,36 @@
+import * as React from "react"
+import { cva, type VariantProps } from "class-variance-authority"
+
+import { cn } from "lib/utils"
+
+const badgeVariants = cva(
+ "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
+ {
+ variants: {
+ variant: {
+ default:
+ "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
+ secondary:
+ "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
+ destructive:
+ "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
+ outline: "text-foreground",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ },
+ }
+)
+
+export interface BadgeProps
+ extends React.HTMLAttributes
,
+ VariantProps {}
+
+function Badge({ className, variant, ...props }: BadgeProps) {
+ return (
+
+ )
+}
+
+export { Badge, badgeVariants }
diff --git a/apps/web/lib/features/integrations/calendar/calendar-component.tsx b/apps/web/lib/features/integrations/calendar/calendar-component.tsx
index 09ae54355..9adbf35d6 100644
--- a/apps/web/lib/features/integrations/calendar/calendar-component.tsx
+++ b/apps/web/lib/features/integrations/calendar/calendar-component.tsx
@@ -62,7 +62,22 @@ const CalendarComponent: React.FC = ({
dateClick={handleDateClick}
eventDrop={handleEventDrop}
eventContent={renderEventContent}
- editable
+ editable={true}
+ dragScroll={true}
+ locale={"pt-br"}
+ timeZone={"UTF"}
+ allDaySlot={false}
+ nowIndicator={true}
+ themeSystem='bootstrap'
+ contentHeight='auto'
+ select={(selected) => {
+ console.log(selected.start)
+ }}
+ eventResize={(resize) => {
+ console.log(resize.el.COMMENT_NODE)
+ }}
+
+ // dayPopoverFormat={}
/>