From 3740f5247fb1e391d43ca8b834fd1f388ccc0a88 Mon Sep 17 00:00:00 2001 From: AKILIMAILI CIZUNGU Innocent <51681130+Innocent-Akim@users.noreply.github.com> Date: Thu, 7 Nov 2024 09:06:11 +0200 Subject: [PATCH 1/6] [Feat]:Implement EditTaskModal component with enhanced task editing UI (#3238) * feat:Implement EditTaskModal component with enhanced task editing UI and state management * refact: coderabbitai[bot] * refact: coderabbitai[bot] --- .../[memberId]/components/EditTaskModal.tsx | 231 ++++++++++++++++++ .../[memberId]/components/TimesheetAction.tsx | 6 + .../components/TimesheetFilterDate.tsx | 2 +- .../timesheet/[memberId]/components/index.tsx | 3 +- .../calendar/table-time-sheet.tsx | 60 +++-- .../lib/features/multiple-select/index.tsx | 73 ++++++ 6 files changed, 350 insertions(+), 25 deletions(-) create mode 100644 apps/web/app/[locale]/timesheet/[memberId]/components/EditTaskModal.tsx diff --git a/apps/web/app/[locale]/timesheet/[memberId]/components/EditTaskModal.tsx b/apps/web/app/[locale]/timesheet/[memberId]/components/EditTaskModal.tsx new file mode 100644 index 000000000..5f90f720b --- /dev/null +++ b/apps/web/app/[locale]/timesheet/[memberId]/components/EditTaskModal.tsx @@ -0,0 +1,231 @@ +import { Button, Modal, statusColor } from "@/lib/components"; +import { IoMdArrowDropdown } from "react-icons/io"; +import { FaRegClock } from "react-icons/fa"; +import { DatePickerFilter } from "./TimesheetFilterDate"; +import { useState } from "react"; +import { useTranslations } from "next-intl"; +import { clsxm } from "@/app/utils"; +import { Item, ManageOrMemberComponent, getNestedValue } from "@/lib/features/manual-time/manage-member-component"; +import { useTeamTasks } from "@/app/hooks"; +import { CustomSelect } from "@/lib/features"; +import { statusTable } from "./TimesheetAction"; + +export interface IEditTaskModalProps { + isOpen: boolean; + closeModal: () => void; + +} +export function EditTaskModal({ isOpen, closeModal }: IEditTaskModalProps) { + const { activeTeam } = useTeamTasks(); + const t = useTranslations(); + const [dateRange, setDateRange] = useState<{ from: Date | null }>({ + from: new Date(), + }); + const [endTime, setEndTime] = useState(''); + const [startTime, setStartTime] = useState(''); + const [isBillable, setIsBillable] = useState(false); + const [notes, setNotes] = useState(''); + const memberItemsLists = { + Project: activeTeam?.projects as [], + }; + const handleSelectedValuesChange = (values: { [key: string]: Item | null }) => { + // Handle value changes + }; + const selectedValues = { + Teams: null, + }; + + const handleChange = (field: string, selectedItem: Item | null) => { + // Handle field changes + }; + + const fields = [ + { + label: 'Project', + placeholder: 'Select a project', + isRequired: true, + valueKey: 'id', + displayKey: 'name', + element: 'Project' + }, + ]; + + const handleFromChange = (fromDate: Date | null) => { + setDateRange((prev) => ({ ...prev, from: fromDate })); + }; + return ( + +
+
+ #321 Spike for creating calendar views on mobile +
+ for + Savannah Nguyen + +
+
+
+
+ Task Time +
+ + 08:10h +
+
+
+
+ + setStartTime(e.target.value)} + className="w-full p-1 border font-normal border-slate-300 dark:border-slate-600 dark:bg-dark--theme-light rounded-md" + required + /> +
+ +
+ + + setEndTime(e.target.value)} + className="w-full p-1 border font-normal border-slate-300 dark:border-slate-600 dark:bg-dark--theme-light rounded-md" + required + /> +
+ +
+
+ Date + +
+
+ getNestedValue(item, displayKey) || ''} + itemToValue={(item, valueKey) => getNestedValue(item, valueKey) || ''} + /> +
+
+ +
+ setIsBillable(!isBillable)} + label={t('pages.timesheet.BILLABLE.YES')} + /> + setIsBillable(!isBillable)} + label={t('pages.timesheet.BILLABLE.NO')} + /> +
+
+
+ Notes +