Skip to content

Commit

Permalink
Merge pull request #3523 from ever-co/develop
Browse files Browse the repository at this point in the history
Release main
  • Loading branch information
Sergemuhundu authored Jan 17, 2025
2 parents c3011e8 + a404f97 commit 00b4bdf
Show file tree
Hide file tree
Showing 9 changed files with 337 additions and 170 deletions.
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Description

Please include a summary of the changes and the related issue.
Please include a summary of the changes and the related issues.

## Type of Change

Expand All @@ -13,14 +13,14 @@ Please include a summary of the changes and the related issue.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have commented on my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings

## Previous screenshots

Please add here videos or images of previous status
Please add here videos or images of the previous status

## Current screenshots

Please add here videos or images of previous status
Please add here videos or images of the current (new) status
10 changes: 9 additions & 1 deletion apps/mobile/app.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
"isAccessMediaLocationEnabled": true
}
],
[
"expo-image-picker",
{
"photosPermission": "The app accesses your photos to let you share them with your friends."
}
],
"sentry-expo",
[
"expo-build-properties",
Expand Down Expand Up @@ -57,7 +63,9 @@
"permissions": [
"android.permission.READ_EXTERNAL_STORAGE",
"android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.ACCESS_MEDIA_LOCATION"
"android.permission.ACCESS_MEDIA_LOCATION",
"android.permission.READ_MEDIA_IMAGES",
"android.permission.READ_MEDIA_VIDEO"
]
},
"ios": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function CalendarView({ data, loading, user }: { data?: GroupedTimesheet[
}

const CalendarDataView = ({ data, t }: { data?: GroupedTimesheet[], t: TranslationHooks }) => {
const { getStatusTimesheet, handleSelectRowTimesheet, selectTimesheetId } = useTimesheet({});
const { getStatusTimesheet, handleSelectRowTimesheet, selectTimesheetId, groupedByTimesheetIds} = useTimesheet({});

return (
<div className="w-full dark:bg-dark--theme">
Expand All @@ -86,46 +86,48 @@ const CalendarDataView = ({ data, t }: { data?: GroupedTimesheet[], t: Translati
<div className='flex gap-x-3'>
<span>{formatDate(plan.date)}</span>
</div>
<div className="flex items-center gap-x-1">
<div className="flex gap-x-1 items-center">
<span className="text-[#868687]">Total{" : "}</span>

<TotalDurationByDate
timesheetLog={plan.tasks}
createdAt={formatDate(plan.date)}
className="text-black dark:text-gray-500 text-sm"
className="text-sm text-black dark:text-gray-500"
/>
</div>
</div>
<Accordion type="single" collapsible>
{Object.entries(getStatusTimesheet(plan.tasks)).map(([status, rows]) => (
rows.length > 0 && status && <AccordionItem
key={status}
value={status === 'DENIED' ? 'REJECTED' : status}
{Object.entries(getStatusTimesheet(plan.tasks)).map(([status, rows]) => {
const groupedByTimesheetId = groupedByTimesheetIds({rows});
return Object.entries(groupedByTimesheetId).map(([timesheetId, timesheetRows]) => {
return timesheetRows.length > 0 && status && <AccordionItem
key={`${status}-${timesheetId}`}
value={`${status === 'DENIED' ? 'REJECTED' : status}-${timesheetId}`}
className="p-1 rounded" >
<AccordionTrigger
type="button"
className={cn(
'flex flex-row-reverse justify-end items-center w-full h-[30px] rounded-sm gap-x-2 hover:no-underline px-2',
statusColor(status).text
)}>
<div className="flex items-center justify-between space-x-1 w-full">
<div className="flex items-center w-full gap-2">
<div className="flex justify-between items-center space-x-1 w-full">
<div className="flex gap-2 items-center w-full">
<div className={cn('p-2 rounded', statusColor(status).bg)}></div>
<div className="flex items-center gap-x-1">
<div className="flex gap-x-1 items-center">
<span className="text-base font-medium text-[#71717A] uppercase !text-[14px]">
{status === 'DENIED' ? 'REJECTED' : status}
</span>
<span className="text-gray-400 text-[14px]">({rows.length})</span>
<span className="text-gray-400 text-[14px]">({timesheetRows.length})</span>
</div>
</div>
<div className="flex items-center space-x-2">
<ClockIcon className=' text-[12px] h-3 w-3' />
<TotalTimeDisplay timesheetLog={rows} />
<TotalTimeDisplay timesheetLog={timesheetRows} />
</div>
</div>
</AccordionTrigger>
<AccordionContent className="flex flex-col w-full gap-y-2 ">
{rows.map((task) => (
<AccordionContent className="flex flex-col gap-y-2 w-full">
{timesheetRows.map((task) => (
<div
key={task.id}
style={{
Expand All @@ -134,10 +136,10 @@ const CalendarDataView = ({ data, t }: { data?: GroupedTimesheet[], t: Translati

}}
className={cn(
'group/item border-l-4 rounded-l flex flex-col p-2 gap-2 items-start space-x-4',
'flex flex-col gap-2 items-start p-2 space-x-4 rounded-l border-l-4 group/item',
)}>
<div className="flex pl-3 justify-between items-center w-full">
<div className="flex items-center gap-x-1">
<div className="flex justify-between items-center pl-3 w-full">
<div className="flex gap-x-1 items-center">
<EmployeeAvatar
imageUrl={task.employee.user.imageUrl ?? ''}
className="w-[28px] h-[28px] drop-shadow-[0_4px_4px_rgba(0,0,0,0.25)] rounded-full"
Expand All @@ -160,8 +162,8 @@ const CalendarDataView = ({ data, t }: { data?: GroupedTimesheet[], t: Translati
dash
taskNumberClassName="text-sm"
/>
<div className="flex pr-3 justify-between items-center w-full">
<div className="flex flex-row items-center py-0 gap-2 flex-none self-stretch flex-grow-0">
<div className="flex justify-between items-center pr-3 w-full">
<div className="flex flex-row flex-none flex-grow-0 gap-2 items-center self-stretch py-0">
{task.project?.imageUrl && (
<ProjectLogo
className="w-[28px] h-[28px] drop-shadow-[0_4px_4px_rgba(0,0,0,0.25)] rounded-[8px]"
Expand All @@ -182,7 +184,9 @@ const CalendarDataView = ({ data, t }: { data?: GroupedTimesheet[], t: Translati
))}
</AccordionContent>
</AccordionItem>
))}
})
} )}

</Accordion>
</div>
}
Expand All @@ -194,7 +198,7 @@ const CalendarDataView = ({ data, t }: { data?: GroupedTimesheet[], t: Translati
}

const BaseCalendarDataView = ({ data, daysLabels, t, CalendarComponent }: BaseCalendarDataViewProps) => {
const { getStatusTimesheet, handleSelectRowTimesheet, selectTimesheetId } = useTimesheet({});
const { getStatusTimesheet, handleSelectRowTimesheet, selectTimesheetId, groupedByTimesheetIds } = useTimesheet({});
return (
<CalendarComponent
t={t}
Expand All @@ -205,35 +209,38 @@ const BaseCalendarDataView = ({ data, daysLabels, t, CalendarComponent }: BaseCa
return <>
{plan ? (
<Accordion type="single" collapsible className="w-full">
{Object.entries(getStatusTimesheet(plan.tasks)).map(([status, rows]) => (
rows.length > 0 && status && <AccordionItem
key={status}
value={status === 'DENIED' ? 'REJECTED' : status}
{Object.entries(getStatusTimesheet(plan.tasks)).map(([status, rows]) => {
const groupedByTimesheetId = groupedByTimesheetIds({rows});
return Object.entries(groupedByTimesheetId).map(([timesheetId, timesheetRows]) => {

return timesheetRows.length > 0 && status && <AccordionItem
key={`${status}-${timesheetId}`}
value={`${status === 'DENIED' ? 'REJECTED' : status}-${timesheetId}`}
className="p-1 rounded" >
<AccordionTrigger
type="button"
className={cn(
'flex flex-row-reverse justify-end items-center w-full !h-[16px] rounded-sm gap-x-2 hover:no-underline',
statusColor(status).text
)}>
<div className="flex items-center justify-between space-x-1 w-full">
<div className="flex items-center w-full gap-2">
<div className="flex justify-between items-center space-x-1 w-full">
<div className="flex gap-2 items-center w-full">
<div className={cn('p-2 rounded', statusColor(status).bg)}></div>
<div className="flex items-center gap-x-1">
<div className="flex gap-x-1 items-center">
<span className="text-base font-normal text-gray-400 uppercase !text-[13px]">
{status === 'DENIED' ? 'REJECTED' : status}
</span>
<span className="text-gray-400 text-[13px]">({rows.length})</span>
<span className="text-gray-400 text-[13px]">({timesheetRows.length})</span>
</div>
</div>
<div className="flex items-center space-x-2">
<ClockIcon className=' text-[12px] h-3 w-3' />
<TotalTimeDisplay timesheetLog={rows} />
<TotalTimeDisplay timesheetLog={timesheetRows} />
</div>
</div>
</AccordionTrigger>
<AccordionContent className="flex flex-col gap-y-2 overflow-auto items-start p-0 flex-none order-1 flex-grow-0">
{rows.map((task) => (
<AccordionContent className="flex overflow-auto flex-col flex-none flex-grow-0 order-1 gap-y-2 items-start p-0">
{timesheetRows.map((task) => (
<div
key={task.id}
style={{
Expand All @@ -244,8 +251,8 @@ const BaseCalendarDataView = ({ data, daysLabels, t, CalendarComponent }: BaseCa
className={cn(
'group/item border-l-4 rounded-l space-x-4 box-border flex flex-col items-start py-2.5 gap-2 w-[258px] rounded-tr-md rounded-br-md flex-none order-1 self-stretch flex-grow',
)}>
<div className="flex pl-3 justify-between items-center w-full">
<div className="flex items-center gap-x-1">
<div className="flex justify-between items-center pl-3 w-full">
<div className="flex gap-x-1 items-center">
<EmployeeAvatar
className="w-[28px] h-[28px] drop-shadow-[0_4px_4px_rgba(0,0,0,0.25)] rounded-full"
imageUrl={task.employee.user.imageUrl ?? ''}
Expand All @@ -270,7 +277,7 @@ const BaseCalendarDataView = ({ data, daysLabels, t, CalendarComponent }: BaseCa
taskNumberClassName="text-sm"
/>
<div className="flex justify-between items-center w-full">
<div className="flex flex-row items-center py-0 gap-2 flex-none self-stretch flex-grow-0">
<div className="flex flex-row flex-none flex-grow-0 gap-2 items-center self-stretch py-0">
{task.project?.imageUrl && (
<ProjectLogo
className="w-[28px] h-[28px] drop-shadow-[0_4px_4px_rgba(0,0,0,0.25)] rounded-[8px]"
Expand All @@ -291,7 +298,8 @@ const BaseCalendarDataView = ({ data, daysLabels, t, CalendarComponent }: BaseCa
))}
</AccordionContent>
</AccordionItem>
))}
})}
)}
</Accordion>
) : (
<div className="text-gray-400 text-sm flex items-center justify-center min-h-[150px] sm:w-[250px] md:w-[300px] lg:w-[350px] max-w-full gap-2">
Expand Down
Loading

0 comments on commit 00b4bdf

Please sign in to comment.