Skip to content

Commit

Permalink
[Feat]: Add Badget Status, Select Filter status, Button delete (#2954)
Browse files Browse the repository at this point in the history
* feat: add badget status, select filter, button delete

* fix: cspell
  • Loading branch information
Innocent-Akim authored Aug 27, 2024
1 parent a131416 commit dd32864
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 38 deletions.
4 changes: 2 additions & 2 deletions apps/web/app/[locale]/calendar/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const CalendarPage = () => {
params='AddManuelTime'
/>
<div
className='fixed top-20 flex flex-col border-b-[1px] dark:border-[#26272C] z-10 mx-0 w-full bg-white dark:bg-dark-high shadow-lg shadow-gray-100 dark:shadow-gray-700 '
className='fixed top-20 flex flex-col border-b-[1px] dark:border-gray-800 z-10 mx-0 w-full bg-white dark:bg-dark-high shadow-lg shadow-gray-100 dark:shadow-gray-700 '
>
<Container fullWidth={fullWidth}>
<div className="flex bg-white dark:bg-dark-high flex-row items-start justify-between mt-12">
Expand All @@ -82,7 +82,7 @@ const CalendarPage = () => {
setCalendarTimeSheet={setCalendarTimeSheet}

/>
<div className='border border-gray-100 dark:border-gray-700 w-full'></div>
<div className='border border-gray-100 dark:border-gray-800 w-full'></div>
</div>
</Container>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { clsxm } from '@app/utils';
import { Badge } from '@components/ui/badge';
import { Button } from '@components/ui/button';
import { Modal } from 'lib/components'
import React from 'react'
Expand Down Expand Up @@ -49,7 +50,7 @@ export function ConfirmStatusChange({ closeModal, isOpen, newStatus, oldStatus }

const StatusTransition = ({ previousStatus, currentStatus, currentStatusClass, previousStatusClass }: { previousStatus: string; currentStatus: string; currentStatusClass: string; previousStatusClass: string }) => (
<div className="flex items-center gap-x-2 font-medium">
<span className={clsxm(previousStatusClass)}>{previousStatus}</span>
<span className={clsxm(previousStatusClass, 'line-through font-normal')}>{previousStatus}</span>
<span>to</span>
<span className={clsxm(currentStatusClass)}>{currentStatus}</span>
</div>
Expand Down Expand Up @@ -78,3 +79,25 @@ const CommentInputArea = () => (
</div>
</>
);


export function StatusBadge({ selectedStatus, filterNumber }: { selectedStatus?: string, filterNumber?: string }) {
const [selected] = React.useState(selectedStatus);
const getColorClass = () => {
switch (selected) {
case "Rejected":
return `text-red-500 ${filterNumber ? "border-gray-200 dark:border-gray-700" : " border-red-500"} `;
case "Approved":
return `text-green-500 ${filterNumber ? "border-gray-200 dark:border-gray-700" : "border-green-500"}`;
case "Pending":
return `text-orange-500 ${filterNumber ? "border-gray-200 dark:border-gray-700" : "border-orange-500"} `;
default:
return `text-gray-500 dark:text-gray-200 border-gray-200 dark:border-gray-700 !py-0 font-normal`;
}
};

return (
<Badge className={`${getColorClass()} bg-transparent rounded-md ${filterNumber ? "font-normal" : 'py-1'} px-2 text-center hover:bg-transparent`}
>{filterNumber}{" "}{selected}</Badge>
);
}
26 changes: 23 additions & 3 deletions apps/web/lib/features/integrations/calendar/setup-time-sheet.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
"use client"

import React from 'react'
import { DataTableTimeSheet } from './table-time-sheet'
import { DataTableTimeSheet, SelectFilter } from './table-time-sheet'
import { HeadTimeSheet } from '@app/[locale]/calendar/component'
import { timesheetCalendar } from './helper-calendar'
import { statusOptions, timesheetCalendar } from './helper-calendar'
import { StatusBadge } from './confirm-change-status'
import { RiDeleteBinLine } from "react-icons/ri";


interface ISetupTimeSheetProps {
timesheet?: timesheetCalendar
Expand All @@ -17,7 +20,24 @@ export function SetupTimeSheet({ timesheet }: ISetupTimeSheetProps) {
<div className='border border-gray-100 dark:border-gray-700 w-full'></div>
<HeadTimeSheet timesheet={timesheet} />
</div>
<div className='flex h-[780px] border border-gray-200 dark:border-gray-700 rounded-lg bg-white dark:bg-dark--theme-light p-4 shadow-lg shadow-gray-100 dark:shadow-gray-700'>
<div className='flex flex-col h-[780px] border border-gray-200 dark:border-gray-700 rounded-lg bg-white dark:bg-dark--theme-light p-4 shadow-lg shadow-gray-100 dark:shadow-gray-700'>
<div className='w-full pb-3 flex items-center gap-x-4 justify-between'>
<div className='flex gap-x-4'>
<span className='font-medium'>123 Logs Selected</span>
<SelectFilter selectedStatus='Rejected' />
<button className='border flex items-center gap-2 border-gray-200 dark:border-gray-700 text-red-500 h-8 px-2 rounded-md' >
<RiDeleteBinLine />
<span className='!font-normal text-sm'>Delete</span>
</button>
</div>
<div className='flex gap-x-2 h-6'>
<StatusBadge selectedStatus='77:00h' />
{statusOptions.map((items, index) => (
<StatusBadge key={index} selectedStatus={items.value} filterNumber={`${index + 2}`} />

))}
</div>
</div>
<DataTableTimeSheet />
</div>
</div>
Expand Down
37 changes: 5 additions & 32 deletions apps/web/lib/features/integrations/calendar/table-time-sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ import {
MdKeyboardArrowLeft,
MdKeyboardArrowRight
} from "react-icons/md";
import { ConfirmStatusChange, TimeSheet, dataSourceTimeSheet, statusOptions } from "."
import { ConfirmStatusChange, StatusBadge, TimeSheet, dataSourceTimeSheet, statusOptions } from "."
import { useModal } from "@app/hooks"
import { Checkbox } from "@components/ui/checkbox";
import { Badge } from "@components/ui/badge"



Expand Down Expand Up @@ -318,32 +317,6 @@ export function DataTableTimeSheet() {



function StatusBadge({ selectedStatus }: { selectedStatus?: string }) {

const [selected] = React.useState(selectedStatus);

const getColorClass = () => {
switch (selected) {
case "Rejected":
return "text-red-500 border-red-500 ";
case "Approved":
return "text-green-500 border-green-500";
case "Pending":
return "text-orange-500 border-orange-500";
default:
return "text-gray-500 border-gray-200";
}


};


return (
<Badge className={`${getColorClass()} bg-transparent rounded-md py-1 px-2 text-center hover:bg-transparent`}
>{selected}</Badge>
);
}


export function SelectFilter({ selectedStatus }: { selectedStatus?: string }) {

Expand All @@ -354,11 +327,11 @@ export function SelectFilter({ selectedStatus }: { selectedStatus?: string }) {
const getColorClass = () => {
switch (selected) {
case "Rejected":
return "text-red-500 border-red-500 rou";
return "text-red-500 border-gray-200";
case "Approved":
return "text-green-500 border-green-500";
return "text-green-500 border-gray-200";
case "Pending":
return "text-orange-500 border-orange-500";
return "text-orange-500 border-gray-200";
default:
return "text-gray-500 border-gray-200";
}
Expand Down Expand Up @@ -387,7 +360,7 @@ export function SelectFilter({ selectedStatus }: { selectedStatus?: string }) {
onValueChange={(value) => onValueChanges(value)}
>
<SelectTrigger
className={`min-w-[120px] w-fit border border-gray-200 dark:border-gray-700 bg-transparent font-medium rounded-xl ${getColorClass()}`}
className={`min-w-[120px] w-fit border border-gray-200 h-8 dark:border-gray-700 bg-transparent font-normal rounded-md ${getColorClass()}`}
>
<SelectValue
placeholder="Select a daily"
Expand Down

0 comments on commit dd32864

Please sign in to comment.