From 81da389ad49bfb52411b0c268bd367cb12b3dd13 Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Mon, 22 Jan 2024 19:32:04 +0200 Subject: [PATCH 1/8] feat: add function to fetch employee tasks --- .../api/tasks/employee/[employeeId]/route.ts | 28 +++++++++++++-- apps/web/app/hooks/features/useTeamTasks.ts | 27 ++++++++++++-- apps/web/app/services/client/api/tasks.ts | 4 +++ .../web/app/services/server/requests/tasks.ts | 19 ++++++++++ apps/web/app/stores/team-tasks.ts | 7 +++- .../features/activity/user-worked-task.tsx | 36 +++++++++++++++++++ .../features/team/user-team-card/index.tsx | 2 +- .../user-team-card-activity.tsx | 16 ++++++--- 8 files changed, 128 insertions(+), 11 deletions(-) create mode 100644 apps/web/lib/features/activity/user-worked-task.tsx diff --git a/apps/web/app/api/tasks/employee/[employeeId]/route.ts b/apps/web/app/api/tasks/employee/[employeeId]/route.ts index 4f2b8eb82..6fcf221e1 100644 --- a/apps/web/app/api/tasks/employee/[employeeId]/route.ts +++ b/apps/web/app/api/tasks/employee/[employeeId]/route.ts @@ -1,15 +1,37 @@ import { authenticatedGuard } from '@app/services/server/guards/authenticated-guard-app'; -import { deleteEmployeeFromTasksRequest } from '@app/services/server/requests'; +import { deleteEmployeeFromTasksRequest, getEmployeeTasksRequest } from '@app/services/server/requests'; import { NextResponse } from 'next/server'; -export async function DELETE(req: Request, { params }: { params: { employeeId: string } }) { +export async function GET(req: Request, { params }: { params: { employeeId: string } }) { const res = new NextResponse(); const { $res, user, tenantId, access_token: bearer_token } = await authenticatedGuard(req, res); if (!user) return $res('Unauthorized'); const { searchParams } = new URL(req.url); - const { employeeId} = params + const { employeeId } = params; + const { organizationTeamId } = searchParams as unknown as { + organizationTeamId: string; + }; + + return $res( + await getEmployeeTasksRequest({ + tenantId, + employeeId, + organizationTeamId, + bearer_token + }) + ); +} + +export async function DELETE(req: Request, { params }: { params: { employeeId: string } }) { + const res = new NextResponse(); + const { $res, user, tenantId, access_token: bearer_token } = await authenticatedGuard(req, res); + if (!user) return $res('Unauthorized'); + + const { searchParams } = new URL(req.url); + + const { employeeId } = params; const { organizationTeamId } = searchParams as unknown as { organizationTeamId: string; }; diff --git a/apps/web/app/hooks/features/useTeamTasks.ts b/apps/web/app/hooks/features/useTeamTasks.ts index ca3d5a180..65c94c485 100644 --- a/apps/web/app/hooks/features/useTeamTasks.ts +++ b/apps/web/app/hooks/features/useTeamTasks.ts @@ -14,9 +14,16 @@ import { getTeamTasksAPI, updateTaskAPI, deleteEmployeeFromTasksAPI, - getTasksByIdAPI + getTasksByIdAPI, + getTasksByEmployeeIdAPI } from '@app/services/client/api'; -import { activeTeamState, detailedTaskState, memberActiveTaskIdState, userState } from '@app/stores'; +import { + activeTeamState, + detailedTaskState, + employeeTasksState, + memberActiveTaskIdState, + userState +} from '@app/stores'; import { activeTeamTaskState, tasksByTeamState, tasksFetchingState, teamTasksState } from '@app/stores'; import isEqual from 'lodash/isEqual'; import { useCallback, useEffect } from 'react'; @@ -40,6 +47,7 @@ export function useTeamTasks() { const [tasksFetching, setTasksFetching] = useRecoilState(tasksFetchingState); const authUser = useSyncRef(useRecoilValue(userState)); const memberActiveTaskId = useRecoilValue(memberActiveTaskIdState); + const [employeeState, setEmployeeState] = useRecoilState(employeeTasksState); const activeTeam = useRecoilValue(activeTeamState); const activeTeamRef = useSyncRef(activeTeam); @@ -51,6 +59,8 @@ export function useTeamTasks() { // Queries hooks const { queryCall, loading, loadingRef } = useQuery(getTeamTasksAPI); const { queryCall: getTasksByIdQueryCall, loading: getTasksByIdLoading } = useQuery(getTasksByIdAPI); + const { queryCall: getTasksByEmployeeIdQueryCall, loading: getTasksByEmployeeIdLoading } = + useQuery(getTasksByEmployeeIdAPI); const { queryCall: deleteQueryCall, loading: deleteLoading } = useQuery(deleteTaskAPI); @@ -71,6 +81,16 @@ export function useTeamTasks() { [getTasksByIdQueryCall, setDetailedTask] ); + const getTasksByEmployeeId = useCallback( + (employeeId: string, organizationTeamId: string) => { + return getTasksByEmployeeIdQueryCall(employeeId, organizationTeamId).then((res) => { + setEmployeeState(res?.data || []); + return res; + }); + }, + [getTasksByEmployeeIdQueryCall, setEmployeeState] + ); + const deepCheckAndUpdateTasks = useCallback( (responseTasks: ITeamTask[], deepCheck?: boolean) => { if (responseTasks && responseTasks.length) { @@ -398,6 +418,9 @@ export function useTeamTasks() { updateDescription, updatePublicity, handleStatusUpdate, + employeeState, + getTasksByEmployeeId, + getTasksByEmployeeIdLoading, activeTeam, activeTeamId: activeTeam?.id, setAllTasks, diff --git a/apps/web/app/services/client/api/tasks.ts b/apps/web/app/services/client/api/tasks.ts index d2f5c5d46..1698725df 100644 --- a/apps/web/app/services/client/api/tasks.ts +++ b/apps/web/app/services/client/api/tasks.ts @@ -157,3 +157,7 @@ export function allTaskTimesheetStatisticsAPI() { export function deleteEmployeeFromTasksAPI(employeeId: string, organizationTeamId: string) { return api.delete(`/tasks/employee/${employeeId}?organizationTeamId=${organizationTeamId}`); } + +export function getTasksByEmployeeIdAPI(employeeId: string, organizationTeamId: string) { + return api.get(`/tasks/employee/${employeeId}?organizationTeamId=${organizationTeamId}`); +} diff --git a/apps/web/app/services/server/requests/tasks.ts b/apps/web/app/services/server/requests/tasks.ts index a255518fe..076c7fa1a 100644 --- a/apps/web/app/services/server/requests/tasks.ts +++ b/apps/web/app/services/server/requests/tasks.ts @@ -161,3 +161,22 @@ export function deleteEmployeeFromTasksRequest({ tenantId }); } + +export function getEmployeeTasksRequest({ + tenantId, + employeeId, + organizationTeamId, + bearer_token +}: { + tenantId: string; + employeeId: string; + organizationTeamId: string; + bearer_token: string; +}) { + return serverFetch({ + path: `/tasks/employee/${employeeId}?organizationTeamId=${organizationTeamId}`, + method: 'GET', + bearer_token, + tenantId + }); +} diff --git a/apps/web/app/stores/team-tasks.ts b/apps/web/app/stores/team-tasks.ts index cdcd41cdc..18b575331 100644 --- a/apps/web/app/stores/team-tasks.ts +++ b/apps/web/app/stores/team-tasks.ts @@ -23,6 +23,11 @@ export const detailedTaskState = atom({ default: null }); +export const employeeTasksState = atom({ + key: 'employeeTasksState', + default: null +}); + export const tasksByTeamState = selector({ key: 'tasksByTeamState', get: ({ get }) => { @@ -30,7 +35,7 @@ export const tasksByTeamState = selector({ return tasks .filter(() => { - return true + return true; }) .sort((a, b) => moment(b.createdAt).diff(a.createdAt)); } diff --git a/apps/web/lib/features/activity/user-worked-task.tsx b/apps/web/lib/features/activity/user-worked-task.tsx new file mode 100644 index 000000000..8b626a009 --- /dev/null +++ b/apps/web/lib/features/activity/user-worked-task.tsx @@ -0,0 +1,36 @@ +import { useTeamTasks } from '@app/hooks'; +import { OT_Member } from '@app/interfaces'; +import { employeeTasksState } from '@app/stores'; +import React from 'react'; +import { useRecoilValue } from 'recoil'; +import { TaskCard } from '../task/task-card'; + +export function UserWorkedTaskTab({ member }: { member?: OT_Member }) { + const { getTasksByEmployeeId, getTasksByEmployeeIdLoading } = useTeamTasks(); + const employeeTasks = useRecoilValue(employeeTasksState); + + React.useEffect(() => { + getTasksByEmployeeId(member?.employeeId!, member?.organizationTeamId!); + }, [getTasksByEmployeeId, member?.employeeId!, member?.organizationTeamId!]); + return getTasksByEmployeeIdLoading ? ( +
Loading ...
+ ) : ( +
+ {employeeTasks?.map((task) => ( +
+ +
+ ))} +
+ ); +} diff --git a/apps/web/lib/features/team/user-team-card/index.tsx b/apps/web/lib/features/team/user-team-card/index.tsx index e5b292cc0..15163927e 100644 --- a/apps/web/lib/features/team/user-team-card/index.tsx +++ b/apps/web/lib/features/team/user-team-card/index.tsx @@ -193,7 +193,7 @@ export function UserTeamCard({ {/* Card menu */}
{menu}
- + { +const UserTeamActivity = ({ + showActivity, + member +}: { + showActivity: boolean; + profile: any; + hook: any; + member?: OT_Member; +}) => { const { timeSlots } = useTimeSlots(true); const t = useTranslations(); @@ -62,9 +72,7 @@ const UserTeamActivity = ({ showActivity }: { showActivity: boolean; profile: an - {/* */} - - {/* */} + From 5d8627bfffe819646fa636002a435f8175e82e30 Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Mon, 22 Jan 2024 19:32:04 +0200 Subject: [PATCH 2/8] feat: add function to fetch employee tasks --- .../api/tasks/employee/[employeeId]/route.ts | 28 +++++++++++++-- apps/web/app/hooks/features/useTeamTasks.ts | 27 ++++++++++++-- apps/web/app/services/client/api/tasks.ts | 4 +++ .../web/app/services/server/requests/tasks.ts | 19 ++++++++++ apps/web/app/stores/team-tasks.ts | 7 +++- .../features/activity/user-worked-task.tsx | 36 +++++++++++++++++++ .../features/team/user-team-card/index.tsx | 2 +- .../user-team-card-activity.tsx | 16 ++++++--- 8 files changed, 128 insertions(+), 11 deletions(-) create mode 100644 apps/web/lib/features/activity/user-worked-task.tsx diff --git a/apps/web/app/api/tasks/employee/[employeeId]/route.ts b/apps/web/app/api/tasks/employee/[employeeId]/route.ts index 4f2b8eb82..6fcf221e1 100644 --- a/apps/web/app/api/tasks/employee/[employeeId]/route.ts +++ b/apps/web/app/api/tasks/employee/[employeeId]/route.ts @@ -1,15 +1,37 @@ import { authenticatedGuard } from '@app/services/server/guards/authenticated-guard-app'; -import { deleteEmployeeFromTasksRequest } from '@app/services/server/requests'; +import { deleteEmployeeFromTasksRequest, getEmployeeTasksRequest } from '@app/services/server/requests'; import { NextResponse } from 'next/server'; -export async function DELETE(req: Request, { params }: { params: { employeeId: string } }) { +export async function GET(req: Request, { params }: { params: { employeeId: string } }) { const res = new NextResponse(); const { $res, user, tenantId, access_token: bearer_token } = await authenticatedGuard(req, res); if (!user) return $res('Unauthorized'); const { searchParams } = new URL(req.url); - const { employeeId} = params + const { employeeId } = params; + const { organizationTeamId } = searchParams as unknown as { + organizationTeamId: string; + }; + + return $res( + await getEmployeeTasksRequest({ + tenantId, + employeeId, + organizationTeamId, + bearer_token + }) + ); +} + +export async function DELETE(req: Request, { params }: { params: { employeeId: string } }) { + const res = new NextResponse(); + const { $res, user, tenantId, access_token: bearer_token } = await authenticatedGuard(req, res); + if (!user) return $res('Unauthorized'); + + const { searchParams } = new URL(req.url); + + const { employeeId } = params; const { organizationTeamId } = searchParams as unknown as { organizationTeamId: string; }; diff --git a/apps/web/app/hooks/features/useTeamTasks.ts b/apps/web/app/hooks/features/useTeamTasks.ts index ca3d5a180..65c94c485 100644 --- a/apps/web/app/hooks/features/useTeamTasks.ts +++ b/apps/web/app/hooks/features/useTeamTasks.ts @@ -14,9 +14,16 @@ import { getTeamTasksAPI, updateTaskAPI, deleteEmployeeFromTasksAPI, - getTasksByIdAPI + getTasksByIdAPI, + getTasksByEmployeeIdAPI } from '@app/services/client/api'; -import { activeTeamState, detailedTaskState, memberActiveTaskIdState, userState } from '@app/stores'; +import { + activeTeamState, + detailedTaskState, + employeeTasksState, + memberActiveTaskIdState, + userState +} from '@app/stores'; import { activeTeamTaskState, tasksByTeamState, tasksFetchingState, teamTasksState } from '@app/stores'; import isEqual from 'lodash/isEqual'; import { useCallback, useEffect } from 'react'; @@ -40,6 +47,7 @@ export function useTeamTasks() { const [tasksFetching, setTasksFetching] = useRecoilState(tasksFetchingState); const authUser = useSyncRef(useRecoilValue(userState)); const memberActiveTaskId = useRecoilValue(memberActiveTaskIdState); + const [employeeState, setEmployeeState] = useRecoilState(employeeTasksState); const activeTeam = useRecoilValue(activeTeamState); const activeTeamRef = useSyncRef(activeTeam); @@ -51,6 +59,8 @@ export function useTeamTasks() { // Queries hooks const { queryCall, loading, loadingRef } = useQuery(getTeamTasksAPI); const { queryCall: getTasksByIdQueryCall, loading: getTasksByIdLoading } = useQuery(getTasksByIdAPI); + const { queryCall: getTasksByEmployeeIdQueryCall, loading: getTasksByEmployeeIdLoading } = + useQuery(getTasksByEmployeeIdAPI); const { queryCall: deleteQueryCall, loading: deleteLoading } = useQuery(deleteTaskAPI); @@ -71,6 +81,16 @@ export function useTeamTasks() { [getTasksByIdQueryCall, setDetailedTask] ); + const getTasksByEmployeeId = useCallback( + (employeeId: string, organizationTeamId: string) => { + return getTasksByEmployeeIdQueryCall(employeeId, organizationTeamId).then((res) => { + setEmployeeState(res?.data || []); + return res; + }); + }, + [getTasksByEmployeeIdQueryCall, setEmployeeState] + ); + const deepCheckAndUpdateTasks = useCallback( (responseTasks: ITeamTask[], deepCheck?: boolean) => { if (responseTasks && responseTasks.length) { @@ -398,6 +418,9 @@ export function useTeamTasks() { updateDescription, updatePublicity, handleStatusUpdate, + employeeState, + getTasksByEmployeeId, + getTasksByEmployeeIdLoading, activeTeam, activeTeamId: activeTeam?.id, setAllTasks, diff --git a/apps/web/app/services/client/api/tasks.ts b/apps/web/app/services/client/api/tasks.ts index d2f5c5d46..1698725df 100644 --- a/apps/web/app/services/client/api/tasks.ts +++ b/apps/web/app/services/client/api/tasks.ts @@ -157,3 +157,7 @@ export function allTaskTimesheetStatisticsAPI() { export function deleteEmployeeFromTasksAPI(employeeId: string, organizationTeamId: string) { return api.delete(`/tasks/employee/${employeeId}?organizationTeamId=${organizationTeamId}`); } + +export function getTasksByEmployeeIdAPI(employeeId: string, organizationTeamId: string) { + return api.get(`/tasks/employee/${employeeId}?organizationTeamId=${organizationTeamId}`); +} diff --git a/apps/web/app/services/server/requests/tasks.ts b/apps/web/app/services/server/requests/tasks.ts index a255518fe..076c7fa1a 100644 --- a/apps/web/app/services/server/requests/tasks.ts +++ b/apps/web/app/services/server/requests/tasks.ts @@ -161,3 +161,22 @@ export function deleteEmployeeFromTasksRequest({ tenantId }); } + +export function getEmployeeTasksRequest({ + tenantId, + employeeId, + organizationTeamId, + bearer_token +}: { + tenantId: string; + employeeId: string; + organizationTeamId: string; + bearer_token: string; +}) { + return serverFetch({ + path: `/tasks/employee/${employeeId}?organizationTeamId=${organizationTeamId}`, + method: 'GET', + bearer_token, + tenantId + }); +} diff --git a/apps/web/app/stores/team-tasks.ts b/apps/web/app/stores/team-tasks.ts index cdcd41cdc..18b575331 100644 --- a/apps/web/app/stores/team-tasks.ts +++ b/apps/web/app/stores/team-tasks.ts @@ -23,6 +23,11 @@ export const detailedTaskState = atom({ default: null }); +export const employeeTasksState = atom({ + key: 'employeeTasksState', + default: null +}); + export const tasksByTeamState = selector({ key: 'tasksByTeamState', get: ({ get }) => { @@ -30,7 +35,7 @@ export const tasksByTeamState = selector({ return tasks .filter(() => { - return true + return true; }) .sort((a, b) => moment(b.createdAt).diff(a.createdAt)); } diff --git a/apps/web/lib/features/activity/user-worked-task.tsx b/apps/web/lib/features/activity/user-worked-task.tsx new file mode 100644 index 000000000..8b626a009 --- /dev/null +++ b/apps/web/lib/features/activity/user-worked-task.tsx @@ -0,0 +1,36 @@ +import { useTeamTasks } from '@app/hooks'; +import { OT_Member } from '@app/interfaces'; +import { employeeTasksState } from '@app/stores'; +import React from 'react'; +import { useRecoilValue } from 'recoil'; +import { TaskCard } from '../task/task-card'; + +export function UserWorkedTaskTab({ member }: { member?: OT_Member }) { + const { getTasksByEmployeeId, getTasksByEmployeeIdLoading } = useTeamTasks(); + const employeeTasks = useRecoilValue(employeeTasksState); + + React.useEffect(() => { + getTasksByEmployeeId(member?.employeeId!, member?.organizationTeamId!); + }, [getTasksByEmployeeId, member?.employeeId!, member?.organizationTeamId!]); + return getTasksByEmployeeIdLoading ? ( +
Loading ...
+ ) : ( +
+ {employeeTasks?.map((task) => ( +
+ +
+ ))} +
+ ); +} diff --git a/apps/web/lib/features/team/user-team-card/index.tsx b/apps/web/lib/features/team/user-team-card/index.tsx index e5b292cc0..15163927e 100644 --- a/apps/web/lib/features/team/user-team-card/index.tsx +++ b/apps/web/lib/features/team/user-team-card/index.tsx @@ -193,7 +193,7 @@ export function UserTeamCard({ {/* Card menu */}
{menu}
- +
{ +const UserTeamActivity = ({ + showActivity, + member +}: { + showActivity: boolean; + profile: any; + hook: any; + member?: OT_Member; +}) => { const { timeSlots } = useTimeSlots(true); const t = useTranslations(); @@ -62,9 +72,7 @@ const UserTeamActivity = ({ showActivity }: { showActivity: boolean; profile: an - {/* */} - - {/* */} + From 014d5d35014d0de3d94018496df74471086d47fd Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 23 Jan 2024 15:49:34 +0200 Subject: [PATCH 3/8] feat: add error page --- apps/web/app/[locale]/error.tsx | 6 ++-- apps/web/components/pages/error/index.tsx | 35 +++++++++++++++++++ .../components/pages/maintenance/index.tsx | 10 +++--- .../features/team/user-team-card/index.tsx | 5 +-- .../user-team-card-activity.tsx | 4 +-- 5 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 apps/web/components/pages/error/index.tsx diff --git a/apps/web/app/[locale]/error.tsx b/apps/web/app/[locale]/error.tsx index 478fc0bc3..3188a6b90 100644 --- a/apps/web/app/[locale]/error.tsx +++ b/apps/web/app/[locale]/error.tsx @@ -1,11 +1,11 @@ 'use client'; -import Maintenance from '@components/pages/maintenance'; +import ErrorPage from '@components/pages/error'; -const Error = () => { +const Error = ({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) => { return ( <> - + ); }; diff --git a/apps/web/components/pages/error/index.tsx b/apps/web/components/pages/error/index.tsx new file mode 100644 index 000000000..0f23c0477 --- /dev/null +++ b/apps/web/components/pages/error/index.tsx @@ -0,0 +1,35 @@ +import SadCry from '@components/ui/svgs/sad-cry'; +import { Text } from 'lib/components'; +import { useTranslations } from 'next-intl'; +import React from 'react'; + +function ErrorPage({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) { + const t = useTranslations(); + + React.useEffect(() => { + // Log the error to an error reporting service + console.error(error); + }, [error]); + + return ( +
+
+ + Error! +
+ + + {t('pages.offline.HEADING_TITLE')} + {/* Something went wrong! */} + +
+ + {t('pages.offline.HEADING_DESCRIPTION')} + + +
+
+ ); +} + +export default ErrorPage; diff --git a/apps/web/components/pages/maintenance/index.tsx b/apps/web/components/pages/maintenance/index.tsx index 233588aeb..bb102ddb0 100644 --- a/apps/web/components/pages/maintenance/index.tsx +++ b/apps/web/components/pages/maintenance/index.tsx @@ -5,14 +5,16 @@ import { useTranslations } from 'next-intl'; function Maintenance() { const t = useTranslations(); return ( -
+
- - {t('pages.maintenance.HEADING_TITLE')} - + Maintenance
+ + {t('pages.maintenance.HEADING_TITLE')} + + {t('pages.maintenance.HEADING_DESCRIPTION')} diff --git a/apps/web/lib/features/team/user-team-card/index.tsx b/apps/web/lib/features/team/user-team-card/index.tsx index 15163927e..4acd68fce 100644 --- a/apps/web/lib/features/team/user-team-card/index.tsx +++ b/apps/web/lib/features/team/user-team-card/index.tsx @@ -50,9 +50,6 @@ export function UserTeamCard({ const memberInfo = useTeamMemberCard(member); const taskEdition = useTMCardTaskEdit(memberInfo.memberTask); - const profile = useUserProfilePage(); - const hook = useTaskFilter(profile); - const { collaborativeSelect, user_selected, onUserSelect } = useCollaborative(memberInfo.memberUser); const seconds = useRecoilValue(timerSecondsState); @@ -193,7 +190,7 @@ export function UserTeamCard({ {/* Card menu */}
{menu}
- + { const { timeSlots } = useTimeSlots(true); From 5934dae96bac37acaab775afa778d24b82ab5d62 Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 23 Jan 2024 19:35:11 +0200 Subject: [PATCH 4/8] feat: add transaltions --- apps/web/components/pages/error/index.tsx | 6 +++--- apps/web/messages/ar.json | 5 +++++ apps/web/messages/bg.json | 5 +++++ apps/web/messages/de.json | 5 +++++ apps/web/messages/en.json | 5 +++++ apps/web/messages/es.json | 5 +++++ apps/web/messages/fr.json | 5 +++++ apps/web/messages/he.json | 5 +++++ apps/web/messages/it.json | 5 +++++ apps/web/messages/nl.json | 9 +++++++-- apps/web/messages/pl.json | 9 +++++++-- apps/web/messages/pt.json | 5 +++++ apps/web/messages/ru.json | 5 +++++ apps/web/messages/zh.json | 5 +++++ apps/web/public/locales/ar/common.json | 9 +++++++++ apps/web/public/locales/bg/common.json | 9 +++++++++ apps/web/public/locales/de/common.json | 9 +++++++++ apps/web/public/locales/en/common.json | 5 +++++ apps/web/public/locales/es/common.json | 9 +++++++++ apps/web/public/locales/fr/common.json | 5 +++++ apps/web/public/locales/he/common.json | 7 ++++++- apps/web/public/locales/it/common.json | 7 ++++++- apps/web/public/locales/nl/common.json | 9 +++++++-- apps/web/public/locales/pl/common.json | 9 +++++++-- apps/web/public/locales/pt/common.json | 5 +++++ apps/web/public/locales/ru/common.json | 7 ++++++- apps/web/public/locales/zh/common.json | 5 +++++ 27 files changed, 160 insertions(+), 14 deletions(-) diff --git a/apps/web/components/pages/error/index.tsx b/apps/web/components/pages/error/index.tsx index 0f23c0477..5cc126718 100644 --- a/apps/web/components/pages/error/index.tsx +++ b/apps/web/components/pages/error/index.tsx @@ -15,16 +15,16 @@ function ErrorPage({ error, reset }: { error: Error & { digest?: string }; reset
- Error! + {t('pages.error.HEADING_TITLE')}
- {t('pages.offline.HEADING_TITLE')} + {t('pages.error.HEADING_TITLE')} {/* Something went wrong! */}
- {t('pages.offline.HEADING_DESCRIPTION')} + {t('pages.error.HEADING_DESCRIPTION')}
diff --git a/apps/web/messages/ar.json b/apps/web/messages/ar.json index 558c66f7f..73adf78a1 100644 --- a/apps/web/messages/ar.json +++ b/apps/web/messages/ar.json @@ -431,6 +431,11 @@ "HEADING_TITLE": "انقطاع الشبكة!", "HEADING_DESCRIPTION": "أنت غير متصل حاليًا، يرجى التحقق من اتصالك بالإنترنت..." }, + "error": { + "TITLE": "خطأ", + "HEADING_TITLE": "هناك خطأ ما ", + "HEADING_DESCRIPTION": "إذا استمرت المشكلة، قم بإرسال إشارة استغاثة إلى فريق الدعم لدينا." + }, "maintenance": { "HEADING_TITLE": "نحن تحت الصيانة", "HEADING_DESCRIPTION": "نقوم حاليًا بتحديث موقعنا الإلكتروني لخدمتك بشكل أفضل. يرجى التحقق مرة أخرى في وقت لاحق." diff --git a/apps/web/messages/bg.json b/apps/web/messages/bg.json index 143858741..45f9162bb 100644 --- a/apps/web/messages/bg.json +++ b/apps/web/messages/bg.json @@ -434,6 +434,11 @@ "HEADING_TITLE": "Мрежата е прекъсната!", "HEADING_DESCRIPTION": "В момента сте извън линия, моля, проверете интернет връзката си..." }, + "error": { + "TITLE": "грешка!", + "HEADING_TITLE": "Нещо се обърка !", + "HEADING_DESCRIPTION": "Ако проблемът продължава, изпратете сигнал за помощ до нашия екип за поддръжка." + }, "maintenance": { "HEADING_TITLE": "Ние сме в процес на поддръжка", "HEADING_DESCRIPTION": "В момента актуализираме нашия уебсайт, за да ви служим по-добре. Моля, проверете отново по-късно." diff --git a/apps/web/messages/de.json b/apps/web/messages/de.json index 403e64d82..57ce15e08 100644 --- a/apps/web/messages/de.json +++ b/apps/web/messages/de.json @@ -427,6 +427,11 @@ "HEADING_TITLE": "Netzwerk getrennt!", "HEADING_DESCRIPTION": "Sie sind derzeit offline, bitte überprüfen Sie Ihre Internetverbindung..." }, + "error": { + "TITLE": "Error !", + "HEADING_TITLE": "Something went wrong !", + "HEADING_DESCRIPTION": "If the problem persists, send a distress signal to our support team." + }, "maintenance": { "HEADING_TITLE": "We zijn in onderhoud ", "HEADING_DESCRIPTION": "Momenteel zijn wij onze website aan het vernieuwen om u nog beter van dienst te kunnen zijn. Kom later nog eens terug." diff --git a/apps/web/messages/en.json b/apps/web/messages/en.json index 48da8050e..399ed42a2 100644 --- a/apps/web/messages/en.json +++ b/apps/web/messages/en.json @@ -430,6 +430,11 @@ "HEADING_TITLE": "Network Disconnected!", "HEADING_DESCRIPTION": "You are currently Offline, please check your internet connection..." }, + "error": { + "TITLE": "Error !", + "HEADING_TITLE": "Something went wrong !", + "HEADING_DESCRIPTION": "If the problem persists, send a distress signal to our support team." + }, "maintenance": { "HEADING_TITLE": "We are Under Maintenance", "HEADING_DESCRIPTION": "We are currently updating our website to serve you better. Please check back later." diff --git a/apps/web/messages/es.json b/apps/web/messages/es.json index c43acbc9f..c5948e717 100644 --- a/apps/web/messages/es.json +++ b/apps/web/messages/es.json @@ -405,6 +405,11 @@ "HEADING_TITLE": "¡Red Desconectada!", "HEADING_DESCRIPTION": "Actualmente estás desconectado, por favor verifica tu conexión a Internet..." }, + "error": { + "TITLE": "Error !", + "HEADING_TITLE": "Algo salió mal !", + "HEADING_DESCRIPTION": "Si el problema persiste, envíe una señal de socorro a nuestro equipo de soporte." + }, "maintenance": { "HEADING_TITLE": "Estamos en Mantenimiento", "HEADING_DESCRIPTION": "Actualmente estamos actualizando nuestro sitio web para brindarle un mejor servicio. Por favor, vuelva más tarde." diff --git a/apps/web/messages/fr.json b/apps/web/messages/fr.json index 49aff0d0a..72e08f8e4 100644 --- a/apps/web/messages/fr.json +++ b/apps/web/messages/fr.json @@ -422,6 +422,11 @@ "HEADING_TITLE": "Réseau déconnecté !", "HEADING_DESCRIPTION": "Vous êtes actuellement hors ligne, veuillez vérifier votre connexion Internet..." }, + "error": { + "TITLE": "Erreur !", + "HEADING_TITLE": "Quelque chose s'est mal passé !", + "HEADING_DESCRIPTION": "Si le problème persiste, envoyez un signal de détresse à notre équipe d'assistance." + }, "maintenance": { "HEADING_TITLE": "Nous sommes en cours de maintenance", "HEADING_DESCRIPTION": "Nous mettons actuellement à jour notre site Web pour mieux vous servir. Veuillez revenir plus tard." diff --git a/apps/web/messages/he.json b/apps/web/messages/he.json index f5a80aeb7..35497a8cf 100644 --- a/apps/web/messages/he.json +++ b/apps/web/messages/he.json @@ -422,6 +422,11 @@ "HEADING_TITLE": "רשת מנותקת!", "HEADING_DESCRIPTION": "אתה לא מחובר כרגע, בבקשה בדוק את חיבור האינטרנט שלך..." }, + "error": { + "TITLE": "שגיאה", + "HEADING_TITLE": "משהו השתבש", + "HEADING_DESCRIPTION": "אם הבעיה נמשכת, שלח אות מצוקה לצוות התמיכה שלנו" + }, "maintenance": { "HEADING_TITLE": "אנחנו בשלבי תחזוקה ", "HEADING_DESCRIPTION": "אנו מעדכנים כעת את האתר שלנו כדי לשרת אותך טוב יותר. אנא בדוק שוב מאוחר יותר." diff --git a/apps/web/messages/it.json b/apps/web/messages/it.json index ee6987244..e8c0a64cb 100644 --- a/apps/web/messages/it.json +++ b/apps/web/messages/it.json @@ -426,6 +426,11 @@ "HEADING_TITLE": "Rete Disconnessa!", "HEADING_DESCRIPTION": "Attualmente sei offline, controlla la tua connessione Internet..." }, + "error": { + "TITLE": "Errore!", + "HEADING_TITLE": "Qualcosa è andato storto !", + "HEADING_DESCRIPTION": "Se il problema persiste, invia un segnale di soccorso al nostro team di supporto." + }, "maintenance": { "HEADING_TITLE": "Siamo in manutenzione", "HEADING_DESCRIPTION": "Stiamo attualmente aggiornando il nostro sito web per servirti meglio. Per favore controllare più tardi." diff --git a/apps/web/messages/nl.json b/apps/web/messages/nl.json index 28d795e39..04684b954 100644 --- a/apps/web/messages/nl.json +++ b/apps/web/messages/nl.json @@ -424,9 +424,14 @@ "HEADING_TITLE": "Netwerk Verbroken!", "HEADING_DESCRIPTION": "U bent momenteel offline, controleer uw internetverbinding..." }, + "error": { + "TITLE": "Fout !", + "HEADING_TITLE": "Er is iets fout gegaan !", + "HEADING_DESCRIPTION": "Als het probleem aanhoudt, stuur dan een noodsignaal naar ons ondersteuningsteam." + }, "maintenance": { - "HEADING_TITLE": "We are Under Maintenance", - "HEADING_DESCRIPTION": "We are currently updating our website to serve you better. Please check back later." + "HEADING_TITLE": "Wij zijn in onderhoud", + "HEADING_DESCRIPTION": "Momenteel zijn wij onze website aan het vernieuwen om u nog beter van dienst te kunnen zijn. Kom later nog eens terug." } }, diff --git a/apps/web/messages/pl.json b/apps/web/messages/pl.json index 084b7050b..30d961ea4 100644 --- a/apps/web/messages/pl.json +++ b/apps/web/messages/pl.json @@ -426,9 +426,14 @@ "HEADING_TITLE": "Rozłączono sieć!", "HEADING_DESCRIPTION": "Jesteś obecnie offline, sprawdź swoje połączenie z internetem..." }, + "error": { + "TITLE": "Błąd !", + "HEADING_TITLE": "Coś poszło nie tak !", + "HEADING_DESCRIPTION": "Jeśli problem będzie się powtarzał, wyślij sygnał o niebezpieczeństwie do naszego zespołu wsparcia." + }, "maintenance": { - "HEADING_TITLE": "We are Under Maintenance", - "HEADING_DESCRIPTION": "We are currently updating our website to serve you better. Please check back later." + "HEADING_TITLE": "Jesteśmy w trakcie konserwacji", + "HEADING_DESCRIPTION": "Obecnie aktualizujemy naszą stronę internetową, aby lepiej Ci służyć. Sprawdź ponownie później." } }, diff --git a/apps/web/messages/pt.json b/apps/web/messages/pt.json index ffe249d25..5e2a5ddd8 100644 --- a/apps/web/messages/pt.json +++ b/apps/web/messages/pt.json @@ -426,6 +426,11 @@ "HEADING_TITLE": "Rede Desconectada!", "HEADING_DESCRIPTION": "Você está atualmente offline, por favor, verifique sua conexão com a Internet..." }, + "error": { + "TITLE": "Erro!", + "HEADING_TITLE": "Algo deu errado!", + "HEADING_DESCRIPTION": "Se o problema persistir, envie um sinal de socorro à nossa equipe de suporte." + }, "maintenance": { "HEADING_TITLE": "Estamos em manutenção", "HEADING_DESCRIPTION": "Estamos atualizando nosso site para melhor atendê-lo. Por favor, volte mais tarde." diff --git a/apps/web/messages/ru.json b/apps/web/messages/ru.json index a96e8140e..ea18ec5d1 100644 --- a/apps/web/messages/ru.json +++ b/apps/web/messages/ru.json @@ -426,6 +426,11 @@ "HEADING_TITLE": "Сеть отключена!", "HEADING_DESCRIPTION": "В настоящее время вы не подключены к Интернету, проверьте ваше соединение..." }, + "error": { + "TITLE": "Ошибка !", + "HEADING_TITLE": "Что-то пошло не так !", + "HEADING_DESCRIPTION": "Если проблема не устранена, отправьте сигнал бедствия в нашу службу поддержки." + }, "maintenance": { "HEADING_TITLE": "Мы на обслуживании ", "HEADING_DESCRIPTION": "В настоящее время мы обновляем наш веб-сайт, чтобы лучше обслуживать вас. Пожалуйста, зайдите позже." diff --git a/apps/web/messages/zh.json b/apps/web/messages/zh.json index 26e6316e0..e123c980d 100644 --- a/apps/web/messages/zh.json +++ b/apps/web/messages/zh.json @@ -401,6 +401,11 @@ "HEADING_TITLE": "网络断开连接!", "HEADING_DESCRIPTION": "您目前处于离线状态,请检查您的互联网连接..." }, + "error": { + "TITLE": "錯誤 !", + "HEADING_TITLE": "出了點問題 !", + "HEADING_DESCRIPTION": "如果問題仍然存在,請向我們的支援團隊發送求救訊號。" + }, "maintenance": { "HEADING_TITLE": "我們正在維護中", "HEADING_DESCRIPTION": "目前,我們正在更新我們的網站,以便更好地為您服務。請稍後再回來查看。" diff --git a/apps/web/public/locales/ar/common.json b/apps/web/public/locales/ar/common.json index 916f6581b..43af67417 100644 --- a/apps/web/public/locales/ar/common.json +++ b/apps/web/public/locales/ar/common.json @@ -430,6 +430,15 @@ "offline": { "HEADING_TITLE": "انقطاع الشبكة!", "HEADING_DESCRIPTION": "أنت غير متصل حاليًا، يرجى التحقق من اتصالك بالإنترنت..." + }, + "error": { + "TITLE": "خطأ", + "HEADING_TITLE": "هناك خطأ ما ", + "HEADING_DESCRIPTION": "إذا استمرت المشكلة، قم بإرسال إشارة استغاثة إلى فريق الدعم لدينا." + }, + "maintenance": { + "HEADING_TITLE": "نحن تحت الصيانة", + "HEADING_DESCRIPTION": "نقوم حاليًا بتحديث موقعنا الإلكتروني لخدمتك بشكل أفضل. يرجى التحقق مرة أخرى في وقت لاحق." } }, diff --git a/apps/web/public/locales/bg/common.json b/apps/web/public/locales/bg/common.json index 374f637f8..34063e44e 100644 --- a/apps/web/public/locales/bg/common.json +++ b/apps/web/public/locales/bg/common.json @@ -435,6 +435,15 @@ "offline": { "HEADING_TITLE": "Мрежата е прекъсната!", "HEADING_DESCRIPTION": "В момента сте извън линия, моля, проверете интернет връзката си..." + }, + "error": { + "TITLE": "грешка!", + "HEADING_TITLE": "Нещо се обърка !", + "HEADING_DESCRIPTION": "Ако проблемът продължава, изпратете сигнал за помощ до нашия екип за поддръжка." + }, + "maintenance": { + "HEADING_TITLE": "Ние сме в процес на поддръжка", + "HEADING_DESCRIPTION": "В момента актуализираме нашия уебсайт, за да ви служим по-добре. Моля, проверете отново по-късно." } }, diff --git a/apps/web/public/locales/de/common.json b/apps/web/public/locales/de/common.json index 6f4c5e03a..551cac721 100644 --- a/apps/web/public/locales/de/common.json +++ b/apps/web/public/locales/de/common.json @@ -426,6 +426,15 @@ "offline": { "HEADING_TITLE": "Netzwerk getrennt!", "HEADING_DESCRIPTION": "Sie sind derzeit offline, bitte überprüfen Sie Ihre Internetverbindung..." + }, + "error": { + "TITLE": "Error !", + "HEADING_TITLE": "Something went wrong !", + "HEADING_DESCRIPTION": "If the problem persists, send a distress signal to our support team." + }, + "maintenance": { + "HEADING_TITLE": "我們正在維護中", + "HEADING_DESCRIPTION": "目前,我們正在更新我們的網站,以便更好地為您服務。請稍後再回來查看。" } }, "timer": { diff --git a/apps/web/public/locales/en/common.json b/apps/web/public/locales/en/common.json index 395b73732..7ae8476eb 100644 --- a/apps/web/public/locales/en/common.json +++ b/apps/web/public/locales/en/common.json @@ -430,6 +430,11 @@ "HEADING_TITLE": "Network Disconnected!", "HEADING_DESCRIPTION": "You are currently Offline, please check your internet connection..." }, + "error": { + "TITLE": "Error !", + "HEADING_TITLE": "Something went wrong !", + "HEADING_DESCRIPTION": "If the problem persists, send a distress signal to our support team." + }, "maintenance": { "HEADING_TITLE": "We are Under Maintenance", "HEADING_DESCRIPTION": "We are currently updating our website to serve you better. Please check back later." diff --git a/apps/web/public/locales/es/common.json b/apps/web/public/locales/es/common.json index 8ba68a55c..75c2afb26 100644 --- a/apps/web/public/locales/es/common.json +++ b/apps/web/public/locales/es/common.json @@ -410,6 +410,15 @@ "offline": { "HEADING_TITLE": "¡Red Desconectada!", "HEADING_DESCRIPTION": "Actualmente estás desconectado, por favor verifica tu conexión a Internet..." + }, + "error": { + "TITLE": "Error !", + "HEADING_TITLE": "Algo salió mal !", + "HEADING_DESCRIPTION": "Si el problema persiste, envíe una señal de socorro a nuestro equipo de soporte." + }, + "maintenance": { + "HEADING_TITLE": "Estamos en Mantenimiento", + "HEADING_DESCRIPTION": "Actualmente estamos actualizando nuestro sitio web para brindarle un mejor servicio. Por favor, vuelva más tarde." } }, "timer": { diff --git a/apps/web/public/locales/fr/common.json b/apps/web/public/locales/fr/common.json index 61701c7d0..67102f9eb 100644 --- a/apps/web/public/locales/fr/common.json +++ b/apps/web/public/locales/fr/common.json @@ -422,6 +422,11 @@ "HEADING_TITLE": "Réseau déconnecté !", "HEADING_DESCRIPTION": "Vous êtes actuellement hors ligne, veuillez vérifier votre connexion Internet..." }, + "error": { + "TITLE": "Erreur !", + "HEADING_TITLE": "Quelque chose s'est mal passé !", + "HEADING_DESCRIPTION": "Si le problème persiste, envoyez un signal de détresse à notre équipe d'assistance." + }, "maintenance": { "HEADING_TITLE": "Nous sommes en cours de maintenance", "HEADING_DESCRIPTION": "Nous mettons actuellement à jour notre site Web pour mieux vous servir. Veuillez revenir plus tard." diff --git a/apps/web/public/locales/he/common.json b/apps/web/public/locales/he/common.json index 82505d016..19da9f2d2 100644 --- a/apps/web/public/locales/he/common.json +++ b/apps/web/public/locales/he/common.json @@ -422,8 +422,13 @@ "HEADING_TITLE": "רשת מנותקת!", "HEADING_DESCRIPTION": "אתה לא מחובר כרגע, בבקשה בדוק את חיבור האינטרנט שלך..." }, + "error": { + "TITLE": "שגיאה", + "HEADING_TITLE": "משהו השתבש", + "HEADING_DESCRIPTION": "אם הבעיה נמשכת, שלח אות מצוקה לצוות התמיכה שלנו" + }, "maintenance": { - "HEADING_TITLE": "אנחנו בשלבי תחזוקה", + "HEADING_TITLE": "אנחנו בשלבי תחזוקה ", "HEADING_DESCRIPTION": "אנו מעדכנים כעת את האתר שלנו כדי לשרת אותך טוב יותר. אנא בדוק שוב מאוחר יותר." } }, diff --git a/apps/web/public/locales/it/common.json b/apps/web/public/locales/it/common.json index 233ae1262..78ced5d84 100644 --- a/apps/web/public/locales/it/common.json +++ b/apps/web/public/locales/it/common.json @@ -426,8 +426,13 @@ "HEADING_TITLE": "Rete Disconnessa!", "HEADING_DESCRIPTION": "Attualmente sei offline, controlla la tua connessione Internet..." }, + "error": { + "TITLE": "Errore !", + "HEADING_TITLE": "Qualcosa è andato storto !", + "HEADING_DESCRIPTION": "Se il problema persiste, invia un segnale di soccorso al nostro team di supporto." + }, "maintenance": { - "HEADING_TITLE": "Siamo in manutenzione.", + "HEADING_TITLE": "Siamo in manutenzione", "HEADING_DESCRIPTION": "Stiamo attualmente aggiornando il nostro sito web per servirti meglio. Per favore controllare più tardi." } }, diff --git a/apps/web/public/locales/nl/common.json b/apps/web/public/locales/nl/common.json index 0bf591cfd..7a1bb0209 100644 --- a/apps/web/public/locales/nl/common.json +++ b/apps/web/public/locales/nl/common.json @@ -424,9 +424,14 @@ "HEADING_TITLE": "Netwerk Verbroken!", "HEADING_DESCRIPTION": "U bent momenteel offline, controleer uw internetverbinding..." }, + "error": { + "TITLE": "Fout !", + "HEADING_TITLE": "Er is iets fout gegaan !", + "HEADING_DESCRIPTION": "Als het probleem aanhoudt, stuur dan een noodsignaal naar ons ondersteuningsteam." + }, "maintenance": { - "HEADING_TITLE": "We are Under Maintenance", - "HEADING_DESCRIPTION": "We are currently updating our website to serve you better. Please check back later." + "HEADING_TITLE": "Wij zijn in onderhoud", + "HEADING_DESCRIPTION": "Momenteel zijn wij onze website aan het vernieuwen om u nog beter van dienst te kunnen zijn. Kom later nog eens terug." } }, diff --git a/apps/web/public/locales/pl/common.json b/apps/web/public/locales/pl/common.json index 7eaa9bc43..119fbfc26 100644 --- a/apps/web/public/locales/pl/common.json +++ b/apps/web/public/locales/pl/common.json @@ -426,9 +426,14 @@ "HEADING_TITLE": "Rozłączono sieć!", "HEADING_DESCRIPTION": "Jesteś obecnie offline, sprawdź swoje połączenie z internetem..." }, + "error": { + "TITLE": "Błąd !", + "HEADING_TITLE": "Coś poszło nie tak !", + "HEADING_DESCRIPTION": "Jeśli problem będzie się powtarzał, wyślij sygnał o niebezpieczeństwie do naszego zespołu wsparcia." + }, "maintenance": { - "HEADING_TITLE": "We are Under Maintenance", - "HEADING_DESCRIPTION": "We are currently updating our website to serve you better. Please check back later." + "HEADING_TITLE": "Jesteśmy w trakcie konserwacji", + "HEADING_DESCRIPTION": "Obecnie aktualizujemy naszą stronę internetową, aby lepiej Ci służyć. Sprawdź ponownie później." } }, diff --git a/apps/web/public/locales/pt/common.json b/apps/web/public/locales/pt/common.json index 1aa06cd7b..9117cfaaf 100644 --- a/apps/web/public/locales/pt/common.json +++ b/apps/web/public/locales/pt/common.json @@ -426,6 +426,11 @@ "HEADING_TITLE": "Rede Desconectada!", "HEADING_DESCRIPTION": "Você está atualmente offline, por favor, verifique sua conexão com a Internet..." }, + "error": { + "TITLE": "Erro!", + "HEADING_TITLE": "Algo deu errado!", + "HEADING_DESCRIPTION": "Se o problema persistir, envie um sinal de socorro à nossa equipe de suporte." + }, "maintenance": { "HEADING_TITLE": "Estamos em manutenção", "HEADING_DESCRIPTION": "Estamos atualizando nosso site para melhor atendê-lo. Por favor, volte mais tarde." diff --git a/apps/web/public/locales/ru/common.json b/apps/web/public/locales/ru/common.json index d8a784240..4d594e3a6 100644 --- a/apps/web/public/locales/ru/common.json +++ b/apps/web/public/locales/ru/common.json @@ -425,8 +425,13 @@ "HEADING_TITLE": "Сеть отключена!", "HEADING_DESCRIPTION": "В настоящее время вы не подключены к Интернету, проверьте ваше соединение..." }, + "error": { + "TITLE": "Ошибка !", + "HEADING_TITLE": "Что-то пошло не так !", + "HEADING_DESCRIPTION": "Если проблема не устранена, отправьте сигнал бедствия в нашу службу поддержки." + }, "maintenance": { - "HEADING_TITLE": "Мы на обслуживании", + "HEADING_TITLE": "Мы на обслуживании ", "HEADING_DESCRIPTION": "В настоящее время мы обновляем наш веб-сайт, чтобы лучше обслуживать вас. Пожалуйста, зайдите позже." } }, diff --git a/apps/web/public/locales/zh/common.json b/apps/web/public/locales/zh/common.json index ca7869316..ec79e3a88 100644 --- a/apps/web/public/locales/zh/common.json +++ b/apps/web/public/locales/zh/common.json @@ -401,6 +401,11 @@ "HEADING_TITLE": "网络断开连接!", "HEADING_DESCRIPTION": "您目前处于离线状态,请检查您的互联网连接..." }, + "error": { + "TITLE": "錯誤 !", + "HEADING_TITLE": "出了點問題 !", + "HEADING_DESCRIPTION": "如果問題仍然存在,請向我們的支援團隊發送求救訊號。" + }, "maintenance": { "HEADING_TITLE": "我們正在維護中", "HEADING_DESCRIPTION": "目前,我們正在更新我們的網站,以便更好地為您服務。請稍後再回來查看。" From f15e2270472ef75846473928ccbe279be915efc4 Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 23 Jan 2024 21:02:14 +0200 Subject: [PATCH 5/8] feat: add hook for selected User --- .../app/hooks/features/useUserProfilePage.ts | 7 +- .../app/hooks/features/useUserSelectedPage.ts | 69 +++++++++++++++++++ apps/web/components/pages/error/index.tsx | 4 +- .../components/pages/maintenance/index.tsx | 2 +- .../features/team/user-team-card/index.tsx | 2 - .../user-team-card-activity.tsx | 10 +-- 6 files changed, 74 insertions(+), 20 deletions(-) create mode 100644 apps/web/app/hooks/features/useUserSelectedPage.ts diff --git a/apps/web/app/hooks/features/useUserProfilePage.ts b/apps/web/app/hooks/features/useUserProfilePage.ts index 71dce8f34..ca084af77 100644 --- a/apps/web/app/hooks/features/useUserProfilePage.ts +++ b/apps/web/app/hooks/features/useUserProfilePage.ts @@ -8,24 +8,21 @@ import { useAuthTeamTasks } from './useAuthTeamTasks'; import { useOrganizationTeams } from './useOrganizationTeams'; import { useTaskStatistics } from './useTaskStatistics'; import { useTeamTasks } from './useTeamTasks'; -import { useRecoilValue } from 'recoil'; -import { activityTypeState } from '@app/stores/activity-type'; export function useUserProfilePage() { const { activeTeam } = useOrganizationTeams(); const { activeTeamTask, updateTask } = useTeamTasks(); - const activityFilter = useRecoilValue(activityTypeState); const { user: auth } = useAuthenticateUser(); const { getTasksStatsData } = useTaskStatistics(); const params = useParams(); const memberId: string = useMemo(() => { - return (params?.memberId ?? activityFilter.member?.id ?? '') as string; + return (params?.memberId ?? '') as string; // eslint-disable-next-line react-hooks/exhaustive-deps }, [params]); - console.log({memberId}) + console.log({ memberId }); const members = activeTeam?.members || []; const matchUser = members.find((m) => { diff --git a/apps/web/app/hooks/features/useUserSelectedPage.ts b/apps/web/app/hooks/features/useUserSelectedPage.ts new file mode 100644 index 000000000..b3866d684 --- /dev/null +++ b/apps/web/app/hooks/features/useUserSelectedPage.ts @@ -0,0 +1,69 @@ +'use client'; + +import { ITeamTask } from '@app/interfaces'; +import { useCallback, useEffect } from 'react'; +import { useAuthenticateUser } from './useAuthenticateUser'; +import { useAuthTeamTasks } from './useAuthTeamTasks'; +import { useOrganizationTeams } from './useOrganizationTeams'; +import { useTaskStatistics } from './useTaskStatistics'; +import { useTeamTasks } from './useTeamTasks'; + +export function useUserSelectedPage(id: string) { + const { activeTeam } = useOrganizationTeams(); + const { activeTeamTask, updateTask } = useTeamTasks(); + + const { user: auth } = useAuthenticateUser(); + const { getTasksStatsData } = useTaskStatistics(); + + const memberId: string = id; + + console.log({ memberId }); + const members = activeTeam?.members || []; + + const matchUser = members.find((m) => { + return m.employee.userId === memberId; + }); + + const isAuthUser = auth?.employee?.userId === memberId; + + const activeUserTeamTask = isAuthUser ? activeTeamTask : matchUser?.lastWorkedTask; + + const userProfile = isAuthUser ? auth : matchUser?.employee.user; + + const employeeId = isAuthUser ? auth?.employee?.id : matchUser?.employeeId; + + /* Filtering the tasks */ + const tasksGrouped = useAuthTeamTasks(userProfile); + + useEffect(() => { + if (employeeId) { + getTasksStatsData(employeeId); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [employeeId]); + + const assignTask = useCallback( + (task: ITeamTask) => { + if (!matchUser?.employeeId) { + return Promise.resolve(); + } + + return updateTask({ + ...task, + members: [...task.members, (matchUser?.employeeId ? { id: matchUser?.employeeId } : {}) as any] + }); + }, + [updateTask, matchUser] + ); + + return { + isAuthUser, + activeUserTeamTask, + userProfile, + tasksGrouped, + member: matchUser, + assignTask + }; +} + +export type I_UserProfilePage = ReturnType; diff --git a/apps/web/components/pages/error/index.tsx b/apps/web/components/pages/error/index.tsx index 5cc126718..e27baa985 100644 --- a/apps/web/components/pages/error/index.tsx +++ b/apps/web/components/pages/error/index.tsx @@ -7,7 +7,6 @@ function ErrorPage({ error, reset }: { error: Error & { digest?: string }; reset const t = useTranslations(); React.useEffect(() => { - // Log the error to an error reporting service console.error(error); }, [error]); @@ -15,12 +14,11 @@ function ErrorPage({ error, reset }: { error: Error & { digest?: string }; reset
- {t('pages.error.HEADING_TITLE')} + {t('pages.error.TITLE')}
{t('pages.error.HEADING_TITLE')} - {/* Something went wrong! */}
diff --git a/apps/web/components/pages/maintenance/index.tsx b/apps/web/components/pages/maintenance/index.tsx index bb102ddb0..86eadab68 100644 --- a/apps/web/components/pages/maintenance/index.tsx +++ b/apps/web/components/pages/maintenance/index.tsx @@ -15,7 +15,7 @@ function Maintenance() { {t('pages.maintenance.HEADING_TITLE')} - + {t('pages.maintenance.HEADING_DESCRIPTION')}
diff --git a/apps/web/lib/features/team/user-team-card/index.tsx b/apps/web/lib/features/team/user-team-card/index.tsx index 4acd68fce..aeeddd508 100644 --- a/apps/web/lib/features/team/user-team-card/index.tsx +++ b/apps/web/lib/features/team/user-team-card/index.tsx @@ -18,8 +18,6 @@ import React from 'react'; import UserTeamActivity from './user-team-card-activity'; import { CollapseUpIcon, ExpandIcon } from '@components/ui/svgs/expand'; import { activityTypeState } from '@app/stores/activity-type'; -import { useUserProfilePage } from '@app/hooks'; -import { useTaskFilter } from 'lib/features/task/task-filters'; type IUserTeamCard = { active?: boolean; diff --git a/apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx b/apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx index 15b1f0fc8..cdb27b6b1 100644 --- a/apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx +++ b/apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx @@ -13,15 +13,7 @@ import { OT_Member } from '@app/interfaces'; import { UserWorkedTaskTab } from 'lib/features/activity/user-worked-task'; // import { UserProfileTask } from 'lib/features/user-profile-tasks'; -const UserTeamActivity = ({ - showActivity, - member -}: { - showActivity: boolean; - profile?: any; - hook?: any; - member?: OT_Member; -}) => { +const UserTeamActivity = ({ showActivity, member }: { showActivity: boolean; member?: OT_Member }) => { const { timeSlots } = useTimeSlots(true); const t = useTranslations(); From 0d7044f687f6ce3152f1cf1e653e43fda9edfe9c Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 23 Jan 2024 22:56:29 +0200 Subject: [PATCH 6/8] feat: fecth tasks for selected Member --- apps/web/app/hooks/features/useTeamTasks.ts | 12 +-- .../app/hooks/features/useUserProfilePage.ts | 1 - .../app/hooks/features/useUserSelectedPage.ts | 5 +- apps/web/app/stores/team-tasks.ts | 8 +- apps/web/components/pages/error/index.tsx | 8 ++ .../features/activity/user-worked-task.tsx | 93 +++++++++++++------ 6 files changed, 86 insertions(+), 41 deletions(-) diff --git a/apps/web/app/hooks/features/useTeamTasks.ts b/apps/web/app/hooks/features/useTeamTasks.ts index 65c94c485..b1eb8c86d 100644 --- a/apps/web/app/hooks/features/useTeamTasks.ts +++ b/apps/web/app/hooks/features/useTeamTasks.ts @@ -20,7 +20,7 @@ import { import { activeTeamState, detailedTaskState, - employeeTasksState, + // employeeTasksState, memberActiveTaskIdState, userState } from '@app/stores'; @@ -47,7 +47,7 @@ export function useTeamTasks() { const [tasksFetching, setTasksFetching] = useRecoilState(tasksFetchingState); const authUser = useSyncRef(useRecoilValue(userState)); const memberActiveTaskId = useRecoilValue(memberActiveTaskIdState); - const [employeeState, setEmployeeState] = useRecoilState(employeeTasksState); + // const [employeeState, setEmployeeState] = useRecoilState(employeeTasksState); const activeTeam = useRecoilValue(activeTeamState); const activeTeamRef = useSyncRef(activeTeam); @@ -84,11 +84,11 @@ export function useTeamTasks() { const getTasksByEmployeeId = useCallback( (employeeId: string, organizationTeamId: string) => { return getTasksByEmployeeIdQueryCall(employeeId, organizationTeamId).then((res) => { - setEmployeeState(res?.data || []); - return res; + // setEmployeeState(res?.data || []); + return res.data; }); }, - [getTasksByEmployeeIdQueryCall, setEmployeeState] + [getTasksByEmployeeIdQueryCall] ); const deepCheckAndUpdateTasks = useCallback( @@ -418,7 +418,7 @@ export function useTeamTasks() { updateDescription, updatePublicity, handleStatusUpdate, - employeeState, + // employeeState, getTasksByEmployeeId, getTasksByEmployeeIdLoading, activeTeam, diff --git a/apps/web/app/hooks/features/useUserProfilePage.ts b/apps/web/app/hooks/features/useUserProfilePage.ts index ca084af77..9a67841bd 100644 --- a/apps/web/app/hooks/features/useUserProfilePage.ts +++ b/apps/web/app/hooks/features/useUserProfilePage.ts @@ -22,7 +22,6 @@ export function useUserProfilePage() { // eslint-disable-next-line react-hooks/exhaustive-deps }, [params]); - console.log({ memberId }); const members = activeTeam?.members || []; const matchUser = members.find((m) => { diff --git a/apps/web/app/hooks/features/useUserSelectedPage.ts b/apps/web/app/hooks/features/useUserSelectedPage.ts index b3866d684..dd70d5e5b 100644 --- a/apps/web/app/hooks/features/useUserSelectedPage.ts +++ b/apps/web/app/hooks/features/useUserSelectedPage.ts @@ -8,16 +8,15 @@ import { useOrganizationTeams } from './useOrganizationTeams'; import { useTaskStatistics } from './useTaskStatistics'; import { useTeamTasks } from './useTeamTasks'; -export function useUserSelectedPage(id: string) { +export function useUserSelectedPage(id?: string) { const { activeTeam } = useOrganizationTeams(); const { activeTeamTask, updateTask } = useTeamTasks(); const { user: auth } = useAuthenticateUser(); const { getTasksStatsData } = useTaskStatistics(); - const memberId: string = id; + const memberId: string = id || ''; - console.log({ memberId }); const members = activeTeam?.members || []; const matchUser = members.find((m) => { diff --git a/apps/web/app/stores/team-tasks.ts b/apps/web/app/stores/team-tasks.ts index 18b575331..27161efe4 100644 --- a/apps/web/app/stores/team-tasks.ts +++ b/apps/web/app/stores/team-tasks.ts @@ -23,10 +23,10 @@ export const detailedTaskState = atom({ default: null }); -export const employeeTasksState = atom({ - key: 'employeeTasksState', - default: null -}); +// export const employeeTasksState = atom({ +// key: 'employeeTasksState', +// default: null +// }); export const tasksByTeamState = selector({ key: 'tasksByTeamState', diff --git a/apps/web/components/pages/error/index.tsx b/apps/web/components/pages/error/index.tsx index e27baa985..137a40f15 100644 --- a/apps/web/components/pages/error/index.tsx +++ b/apps/web/components/pages/error/index.tsx @@ -1,3 +1,5 @@ +'use client'; + import SadCry from '@components/ui/svgs/sad-cry'; import { Text } from 'lib/components'; import { useTranslations } from 'next-intl'; @@ -26,6 +28,12 @@ function ErrorPage({ error, reset }: { error: Error & { digest?: string }; reset
+ +
+

{JSON.stringify(error.cause)}

+

{error.message}

+

{error.stack}

+
); } diff --git a/apps/web/lib/features/activity/user-worked-task.tsx b/apps/web/lib/features/activity/user-worked-task.tsx index 8b626a009..058a67f7d 100644 --- a/apps/web/lib/features/activity/user-worked-task.tsx +++ b/apps/web/lib/features/activity/user-worked-task.tsx @@ -1,36 +1,75 @@ -import { useTeamTasks } from '@app/hooks'; +// import { useTeamTasks } from '@app/hooks'; import { OT_Member } from '@app/interfaces'; -import { employeeTasksState } from '@app/stores'; +// import { employeeTasksState } from '@app/stores'; import React from 'react'; -import { useRecoilValue } from 'recoil'; import { TaskCard } from '../task/task-card'; +import { useUserSelectedPage } from '@app/hooks/features/useUserSelectedPage'; +import { useTaskFilter } from '../task/task-filters'; +import { Divider, Text } from 'lib/components'; +import { useTranslations } from 'next-intl'; -export function UserWorkedTaskTab({ member }: { member?: OT_Member }) { - const { getTasksByEmployeeId, getTasksByEmployeeIdLoading } = useTeamTasks(); - const employeeTasks = useRecoilValue(employeeTasksState); +export const UserWorkedTaskTab = React.memo(function UserWorkedTask({ member }: { member?: OT_Member }) { + const profile = useUserSelectedPage(member?.employee?.userId); + const hook = useTaskFilter(profile); + // const { getTasksByEmployeeId, getTasksByEmployeeIdLoading } = useTeamTasks(); - React.useEffect(() => { - getTasksByEmployeeId(member?.employeeId!, member?.organizationTeamId!); - }, [getTasksByEmployeeId, member?.employeeId!, member?.organizationTeamId!]); - return getTasksByEmployeeIdLoading ? ( -
Loading ...
- ) : ( + const t = useTranslations(); + + const tasks = hook.tasksFiltered; + const otherTasks = tasks.filter((t) => + profile.member?.running == true ? t.id !== profile.activeUserTeamTask?.id : t + ); + + console.log({ hook, profile }); + + return (
- {employeeTasks?.map((task) => ( -
- + {profile.member?.timerStatus === 'running' && ( + + )} + + {otherTasks.length > 0 && ( +
+ + {t('common.LAST_24_HOURS')} ({otherTasks.length}) + +
- ))} + )} + +
    + {otherTasks.map((task) => { + return ( +
  • + +
  • + ); + })} +
); -} +}); From 3ab4968213c13fd2371165cedb76ad30fdd8266f Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 23 Jan 2024 23:23:20 +0200 Subject: [PATCH 7/8] fix: delete unused Vars --- .../lib/features/activity/user-worked-task.tsx | 15 +++++++-------- .../user-team-card/user-team-card-activity.tsx | 5 ++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/apps/web/lib/features/activity/user-worked-task.tsx b/apps/web/lib/features/activity/user-worked-task.tsx index 058a67f7d..273a4aef4 100644 --- a/apps/web/lib/features/activity/user-worked-task.tsx +++ b/apps/web/lib/features/activity/user-worked-task.tsx @@ -1,17 +1,14 @@ -// import { useTeamTasks } from '@app/hooks'; import { OT_Member } from '@app/interfaces'; -// import { employeeTasksState } from '@app/stores'; -import React from 'react'; +import { memo } from 'react'; import { TaskCard } from '../task/task-card'; import { useUserSelectedPage } from '@app/hooks/features/useUserSelectedPage'; import { useTaskFilter } from '../task/task-filters'; import { Divider, Text } from 'lib/components'; import { useTranslations } from 'next-intl'; -export const UserWorkedTaskTab = React.memo(function UserWorkedTask({ member }: { member?: OT_Member }) { +const UserWorkedTaskTab = ({ member }: { member?: OT_Member }) => { const profile = useUserSelectedPage(member?.employee?.userId); const hook = useTaskFilter(profile); - // const { getTasksByEmployeeId, getTasksByEmployeeIdLoading } = useTeamTasks(); const t = useTranslations(); @@ -20,11 +17,11 @@ export const UserWorkedTaskTab = React.memo(function UserWorkedTask({ member }: profile.member?.running == true ? t.id !== profile.activeUserTeamTask?.id : t ); - console.log({ hook, profile }); + console.log({ hook, profile, otherTasks, r: profile.member?.timerStatus }); return (
- {profile.member?.timerStatus === 'running' && ( + {profile.activeUserTeamTask && (
); -}); +}; + +export default memo(UserWorkedTaskTab); diff --git a/apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx b/apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx index cdb27b6b1..ea335a62b 100644 --- a/apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx +++ b/apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx @@ -10,8 +10,7 @@ import { ScreenshootTeamTab } from 'lib/features/activity/screenshoots'; import { AppsTab } from 'lib/features/activity/apps'; import { VisitedSitesTab } from 'lib/features/activity/visited-sites'; import { OT_Member } from '@app/interfaces'; -import { UserWorkedTaskTab } from 'lib/features/activity/user-worked-task'; -// import { UserProfileTask } from 'lib/features/user-profile-tasks'; +import UserWorkedTaskTab from 'lib/features/activity/user-worked-task'; const UserTeamActivity = ({ showActivity, member }: { showActivity: boolean; member?: OT_Member }) => { const { timeSlots } = useTimeSlots(true); @@ -84,4 +83,4 @@ const UserTeamActivity = ({ showActivity, member }: { showActivity: boolean; mem ); }; -export default UserTeamActivity; +export default React.memo(UserTeamActivity); From b82f94990150ba57b67ff6495beec18a70b60062 Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 23 Jan 2024 23:42:28 +0200 Subject: [PATCH 8/8] refact: show task Activities for Manager only --- .../features/activity/user-worked-task.tsx | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/apps/web/lib/features/activity/user-worked-task.tsx b/apps/web/lib/features/activity/user-worked-task.tsx index 273a4aef4..f34300099 100644 --- a/apps/web/lib/features/activity/user-worked-task.tsx +++ b/apps/web/lib/features/activity/user-worked-task.tsx @@ -5,23 +5,24 @@ import { useUserSelectedPage } from '@app/hooks/features/useUserSelectedPage'; import { useTaskFilter } from '../task/task-filters'; import { Divider, Text } from 'lib/components'; import { useTranslations } from 'next-intl'; +import { useAuthenticateUser } from '@app/hooks'; const UserWorkedTaskTab = ({ member }: { member?: OT_Member }) => { const profile = useUserSelectedPage(member?.employee?.userId); const hook = useTaskFilter(profile); + const { user } = useAuthenticateUser(); const t = useTranslations(); const tasks = hook.tasksFiltered; + const canSeeActivity = profile.userProfile?.id === user?.id || user?.role?.name?.toUpperCase() == 'MANAGER'; const otherTasks = tasks.filter((t) => profile.member?.running == true ? t.id !== profile.activeUserTeamTask?.id : t ); - console.log({ hook, profile, otherTasks, r: profile.member?.timerStatus }); - return (
- {profile.activeUserTeamTask && ( + {profile.activeUserTeamTask && canSeeActivity && ( { /> )} - {otherTasks.length > 0 && ( + {otherTasks.length > 0 && canSeeActivity && (
{t('common.LAST_24_HOURS')} ({otherTasks.length}) @@ -47,25 +48,26 @@ const UserWorkedTaskTab = ({ member }: { member?: OT_Member }) => { )}
    - {otherTasks.map((task) => { - return ( -
  • - -
  • - ); - })} + {canSeeActivity && + otherTasks.map((task) => { + return ( +
  • + +
  • + ); + })}
);