Skip to content

Commit

Permalink
Merge pull request #1990 from ever-co/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
evereq authored Dec 12, 2023
2 parents 6a87ec6 + 2a03907 commit c3203ec
Show file tree
Hide file tree
Showing 15 changed files with 212 additions and 69 deletions.
147 changes: 103 additions & 44 deletions apps/web/lib/features/task/task-times.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { secondsToTime } from '@app/helpers';
import { I_TeamMemberCardHook, useOrganizationTeams } from '@app/hooks';
import { IClassName, ITeamTask, Nullable, OT_Member } from '@app/interfaces';
import { clsxm } from '@app/utils';
import { Text } from 'lib/components';
import { Text, Tooltip } from 'lib/components';
import { useTranslation } from 'react-i18next';

type Props = {
Expand Down Expand Up @@ -40,9 +40,23 @@ export function TaskTimes({ className, task, memberInfo, showDaily = true, showT
return (
<div className={clsxm(className)}>
{isBlock ? (
<TimeBlockInfo showDaily={showDaily} showTotal={showTotal} daily={{ h: dh, m: dm }} total={{ h, m }} />
<TimeBlockInfo
showDaily={showDaily}
showTotal={showTotal}
currentUser={currentMember}
task={task}
daily={{ h: dh, m: dm }}
total={{ h, m }}
/>
) : (
<TimeInfo showDaily={showDaily} showTotal={showTotal} daily={{ h: dh, m: dm }} total={{ h, m }} />
<TimeInfo
currentUser={currentMember}
showDaily={showDaily}
showTotal={showTotal}
daily={{ h: dh, m: dm }}
total={{ h, m }}
task={task}
/>
)}
</div>
);
Expand All @@ -52,37 +66,56 @@ function TimeInfo({
daily,
total,
showDaily = true,
showTotal = true
showTotal = true,
currentUser,
task
}: {
daily: { h: number; m: number };
total: { h: number; m: number };
showDaily?: boolean;
showTotal?: boolean;
currentUser: OT_Member | undefined;
task: Nullable<ITeamTask>;
}) {
const { t } = useTranslation();

return (
<>
{showDaily && (
<div className="flex items-center space-x-2 text-base font-normal">
<span className="text-[#7B8089] text-center">{t('common.TODAY')}:</span>
<Text>
{daily.h}h : {daily.m}m
</Text>
</div>
<Tooltip
enabled={task ? true : false}
label={`${currentUser?.employee.fullName} ${t('task.WORKED_TODAY_ON_TASK_TOOLTIP')} ${daily.h}h : ${
daily.m
}m`}
>
<div className="flex items-center space-x-2 text-base font-normal">
<span className="text-[#7B8089] text-center">{t('common.TODAY')}:</span>
<Text>
{daily.h}h : {daily.m}m
</Text>
</div>
</Tooltip>
)}

{showTotal && (
<div
className={clsxm(
'flex space-x-4 items-center font-normal text-sm'
// showDaily && ['text-sm']
)}
<Tooltip
enabled={task ? true : false}
label={`${currentUser?.employee.fullName} ${t('task.WORKED_TOTAL_ON_TASK_TOOLTIP')} ${total.h}h : ${
total.m
}m`}
>
<span className="text-[#7B8089] text-center">{t('common.TOTAL')}:</span>
<Text>
{total.h}h : {total.m}m
</Text>
</div>
<div
className={clsxm(
'flex space-x-4 items-center font-normal text-sm'
// showDaily && ['text-sm']
)}
>
<span className="text-[#7B8089] text-center">{t('common.TOTAL')}:</span>
<Text>
{total.h}h : {total.m}m
</Text>
</div>
</Tooltip>
)}
</>
);
Expand All @@ -92,41 +125,59 @@ function TimeBlockInfo({
daily,
total,
showDaily = true,
showTotal = true
showTotal = true,
currentUser,
task
}: {
daily: { h: number; m: number };
total: { h: number; m: number };
showDaily?: boolean;
showTotal?: boolean;
currentUser: OT_Member | undefined;
task: Nullable<ITeamTask>;
}) {
const { t } = useTranslation();
return (
<div className="flex gap-1">
{showDaily && (
<div className=" text-base font-normal flex flex-col items-center ">
<span className="text-[#7B8089] text-center text-xs">
{t('common.WORKED_ON_TASK')} {t('common.TODAY')}:
</span>
<Text className="text-lg font-semibold">
{daily.h}h : {daily.m}m
</Text>
</div>
<Tooltip
enabled={task ? true : false}
label={`${currentUser?.employee.fullName} ${t('task.WORKED_TODAY_ON_TASK_TOOLTIP')} ${daily.h}h : ${
daily.m
}m`}
>
<div className=" text-base font-normal flex flex-col items-center ">
<span className="text-[#7B8089] text-center text-xs">
{t('common.WORKED_ON_TASK')} {t('common.TODAY')}:
</span>
<Text className="text-lg font-semibold">
{daily.h}h : {daily.m}m
</Text>
</div>
</Tooltip>
)}

{showTotal && (
<div
className={clsxm(
'font-normal text-base flex flex-col items-center '
// showDaily && ['text-sm']
)}
<Tooltip
enabled={task ? true : false}
label={`${currentUser?.employee.fullName} ${t('task.WORKED_TOTAL_ON_TASK_TOOLTIP')} ${total.h}h : ${
total.m
}m`}
>
<span className="text-[#7B8089] text-center text-xs">
{t('common.WORKED_ON_TASK')} {t('common.TOTAL')}:
</span>
<Text className="text-lg font-semibold">
{total.h}h : {total.m}m
</Text>
</div>
<div
className={clsxm(
'font-normal text-base flex flex-col items-center '
// showDaily && ['text-sm']
)}
>
<span className="text-[#7B8089] text-center text-xs">
{t('common.WORKED_ON_TASK')} {t('common.TOTAL')}:
</span>
<Text className="text-lg font-semibold">
{total.h}h : {total.m}m
</Text>
</div>
</Tooltip>
)}
</div>
);
Expand All @@ -136,6 +187,8 @@ export function TodayWorkedTime({ className, memberInfo }: Omit<Props, 'task' |
// Get current timer seconds
const { activeTeam } = useOrganizationTeams();

const { t } = useTranslation();

const currentMember = activeTeam?.members.find((member) => member.id === memberInfo?.member?.id);
const { h, m } = secondsToTime(
(currentMember?.totalTodayTasks &&
Expand All @@ -148,9 +201,15 @@ export function TodayWorkedTime({ className, memberInfo }: Omit<Props, 'task' |

return (
<div className={clsxm('text-center font-normal', className)}>
<Text>
{h ? h : '0'}h : {m ? m : '0'}m
</Text>
<Tooltip
label={`${currentMember?.employee.fullName} ${t(
'task.WORKED_TODAY_ON_ALL_TOOLTIP'
)} ${activeTeam?.name} ${t('task.TASKS_FOR_TOOLTIP')} ${h}h : ${m}m`}
>
<Text>
{h ? h : '0'}h : {m ? m : '0'}m
</Text>
</Tooltip>
</div>
);
}
26 changes: 15 additions & 11 deletions apps/web/lib/features/team/user-team-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useCollaborative, useTMCardTaskEdit, useTaskStatistics, useTeamMemberCa
import { IClassName, IOrganizationTeamList } from '@app/interfaces';
import { timerSecondsState } from '@app/stores';
import { clsxm } from '@app/utils';
import { Card, InputField, Text, VerticalSeparator } from 'lib/components';
import { Card, InputField, Text, Tooltip, VerticalSeparator } from 'lib/components';
import { DraggerIcon } from 'lib/components/svgs';
import { TaskTimes, TodayWorkedTime } from 'lib/features';
import { useTranslation } from 'react-i18next';
Expand All @@ -22,19 +22,23 @@ export function UserTeamCardHeader() {
<div className="w-1"></div>
<div className="2xl:w-80 3xl:w-[32rem] w-1/5 text-center">{t('common.TASK')}</div>
<div className="w-1"></div>
<div className="2xl:w-48 3xl:w-[12rem] w-1/5 flex flex-col justify-center text-center">
{t('task.taskTableHead.TASK_WORK.TITLE')}
<br />
{t('common.TASK')}
</div>
<Tooltip label={t('task.taskTableHead.TOTAL_WORKED_TODAY_HEADER_TOOLTIP')}>
<div className="2xl:w-48 3xl:w-[12rem] w-1/5 flex flex-col justify-center text-center">
{t('task.taskTableHead.TASK_WORK.TITLE')}
<br />
{t('common.TASK')}
</div>
</Tooltip>
<div className="w-1"></div>
<div className="w-1/5 text-center 2xl:w-52 3xl:w-64">{t('common.ESTIMATE')}</div>
<div className="w-1"></div>
<div className="2xl:w-[11.75rem] 3xl:w-[10rem] w-1/6 text-center">
{t('task.taskTableHead.TOTAL_WORK.TITLE')}
<br />
{t('common.TODAY')}
</div>
<Tooltip label={t('task.taskTableHead.WORKED_ON_TASK_HEADER_TOOLTIP')}>
<div className="2xl:w-[11.75rem] 3xl:w-[10rem] w-1/6 text-center">
{t('task.taskTableHead.TOTAL_WORK.TITLE')}
<br />
{t('common.TODAY')}
</div>
</Tooltip>
</div>
);
}
Expand Down
8 changes: 7 additions & 1 deletion apps/web/public/locales/ar/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@
"ASSIGN_NEW_TASK": "تعيين مهمة جديدة",
"ASSIGNED_BY": "تم التعيين بواسطة",
"NO_ONE_FOR_TASK": "لم يتم تعيين أحد لهذه المهمة",
"WORKED_TODAY_ON_TASK_TOOLTIP": "عمل اليوم على هذه المهمة لمدة",
"WORKED_TOTAL_ON_TASK_TOOLTIP": "عمل على هذه المهمة لمدة إجمالية",
"WORKED_TODAY_ON_ALL_TOOLTIP": "عمل اليوم على الكل",
"TASKS_FOR_TOOLTIP": "المهام ل",
"taskLabel": {
"WORK_LABEL": "عمل",
"TASK_ASSIGNED": "معينة",
Expand All @@ -475,7 +479,9 @@
"TITLE": "إجمالي العمل",
"DESCRIPTION": "اليوم",
"LABEL": "إجمالي العمل اليوم"
}
},
"TOTAL_WORKED_TODAY_HEADER_TOOLTIP": "كم ساعة عمل الموظف اليوم والإجمالي في المهمة",
"WORKED_ON_TASK_HEADER_TOOLTIP": "كم ساعة عمل الموظف اليوم في جميع المهام للفريق المحدد"
},
"CONFIRM_CLOSE_TASK": "يرجى تأكيد رغبتك في إغلاق المهمة"
},
Expand Down
12 changes: 10 additions & 2 deletions apps/web/public/locales/bg/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@
"SENT_EMAIL_VERIFICATION_RESEND": "за да изпратите кода отново, ако не сте го получили.",
"INVITATIONS": "Поканени сте да се присъедините към",
"CONFIRM_ACCEPT_INVITATION": "Сигурни ли сте, че искате да приемете поканата?",
"CONFIRM_REJECT_INVITATION": "Сигурни ли сте, че искате да отхвърлите поканата?"
"CONFIRM_REJECT_INVITATION": "Сигурни ли сте, че искате да отхвърлите поканата?",
"TOTAL_WORKED_TODAY_HEADER_TOOLTIP": "How many hours employee worked for total and today on task",
"WORKED_ON_TASK_HEADER_TOOLTIP": "How many hours employee worked today on all tasks for selected Team"
},

"profile": {
Expand Down Expand Up @@ -454,6 +456,10 @@
"ASSIGN_NEW_TASK": "Възлагане на нова задача",
"ASSIGNED_BY": "Възложено от",
"NO_ONE_FOR_TASK": "Няма отговорник за тази задача",
"WORKED_TODAY_ON_TASK_TOOLTIP": "работено днес по тази задача за",
"WORKED_TOTAL_ON_TASK_TOOLTIP": "работено по тази задача общо за",
"WORKED_TODAY_ON_ALL_TOOLTIP": "работено днес по всички",
"TASKS_FOR_TOOLTIP": "задачи за",

"taskLabel": {
"WORK_LABEL": "Работено",
Expand All @@ -480,7 +486,9 @@
"TITLE": "Общо работено",
"DESCRIPTION": "Днес",
"LABEL": "Общо работено днес"
}
},
"TOTAL_WORKED_TODAY_HEADER_TOOLTIP": "Колко часа работил служителят общо и днес по задача",
"WORKED_ON_TASK_HEADER_TOOLTIP": "Колко часа е работил служителят днес по всички задачи за избрания екип"
},
"CONFIRM_CLOSE_TASK": "Моля, потвърдете ако искате да затворите задачата"
},
Expand Down
8 changes: 7 additions & 1 deletion apps/web/public/locales/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@
"ASSIGN_NEW_TASK": "Neue Aufgabe zuweisen",
"ASSIGNED_BY": "Zugewiesen von",
"NO_ONE_FOR_TASK": "Niemand dieser Aufgabe zugewiesen",
"WORKED_TODAY_ON_TASK_TOOLTIP": "heute an dieser Aufgabe gearbeitet für",
"WORKED_TOTAL_ON_TASK_TOOLTIP": "insgesamt an dieser Aufgabe gearbeitet für",
"WORKED_TODAY_ON_ALL_TOOLTIP": "heute an allem gearbeitet für",
"TASKS_FOR_TOOLTIP": "Aufgaben für",
"taskLabel": {
"WORK_LABEL": "Gearbeitet",
"TASK_ASSIGNED": "Zugewiesen",
Expand All @@ -470,7 +474,9 @@
"TITLE": "Insgesamt gearbeitet",
"DESCRIPTION": "Heute",
"LABEL": "Heute insgesamt gearbeitet"
}
},
"TOTAL_WORKED_TODAY_HEADER_TOOLTIP": "Wie viele Stunden hat der Mitarbeiter heute und insgesamt an der Aufgabe gearbeitet",
"WORKED_ON_TASK_HEADER_TOOLTIP": "Wie viele Stunden hat der Mitarbeiter heute an allen Aufgaben für das ausgewählte Team gearbeitet"
},
"CONFIRM_CLOSE_TASK": "Bitte bestätigen Sie, ob Sie die Aufgabe schließen möchten"
},
Expand Down
8 changes: 7 additions & 1 deletion apps/web/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@
"ASSIGN_NEW_TASK": "Assign new task",
"ASSIGNED_BY": "Assigned By",
"NO_ONE_FOR_TASK": "No One Assigned to this Task",
"WORKED_TODAY_ON_TASK_TOOLTIP": "worked today on this task for",
"WORKED_TOTAL_ON_TASK_TOOLTIP": "worked on this task for a total of",
"WORKED_TODAY_ON_ALL_TOOLTIP": "worked today on all",
"TASKS_FOR_TOOLTIP": "tasks for",
"taskLabel": {
"WORK_LABEL": "Worked",
"TASK_ASSIGNED": "Assigned",
Expand All @@ -472,7 +476,9 @@
"TITLE": "Total Worked",
"DESCRIPTION": "Today",
"LABEL": "Total worked Today"
}
},
"TOTAL_WORKED_TODAY_HEADER_TOOLTIP": "How many hours employee worked for total and today on task",
"WORKED_ON_TASK_HEADER_TOOLTIP": "How many hours employee worked today on all tasks for selected Team"
},
"CONFIRM_CLOSE_TASK": "Please confirm if you want to close the task"
},
Expand Down
8 changes: 7 additions & 1 deletion apps/web/public/locales/es/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@
"ASSIGN_NEW_TASK": "Asignar nueva tarea",
"ASSIGNED_BY": "Asignado por",
"NO_ONE_FOR_TASK": "Nadie asignado a esta tarea",
"WORKED_TODAY_ON_TASK_TOOLTIP": "trabajó hoy en esta tarea durante",
"WORKED_TOTAL_ON_TASK_TOOLTIP": "trabajó en esta tarea durante un total de",
"WORKED_TODAY_ON_ALL_TOOLTIP": "trabajó hoy en todas",
"TASKS_FOR_TOOLTIP": "tareas para",
"taskLabel": {
"WORK_LABEL": "Trabajado",
"TASK_ASSIGNED": "Asignado",
Expand All @@ -460,7 +464,9 @@
"TITLE": "Total trabajado",
"DESCRIPTION": "Hoy",
"LABEL": "Total trabajado hoy"
}
},
"TOTAL_WORKED_TODAY_HEADER_TOOLTIP": "Cuántas horas trabajó el empleado en total y hoy en la tarea",
"WORKED_ON_TASK_HEADER_TOOLTIP": "Cuántas horas trabajó el empleado hoy en todas las tareas para el equipo seleccionado"
},
"CONFIRM_CLOSE_TASK": "Por favor, confirma si deseas cerrar la tarea"
},
Expand Down
Loading

0 comments on commit c3203ec

Please sign in to comment.