From db3cb623983ff4bd7c80be8f0ed3edce322556c7 Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Mon, 15 Jan 2024 20:50:09 +0200 Subject: [PATCH 1/9] feat: add Modal to Team Member Card --- .../features/team/user-team-card/index.tsx | 13 ++++++----- .../user-team-card-activity.tsx | 22 +++++++++++++++++++ 2 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx 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 b661d0d4d..4fcbd6b7c 100644 --- a/apps/web/lib/features/team/user-team-card/index.tsx +++ b/apps/web/lib/features/team/user-team-card/index.tsx @@ -12,6 +12,7 @@ import { TaskEstimateInfo } from './task-estimate'; import { TaskInfo } from './task-info'; import { UserInfo } from './user-info'; import { UserTeamCardMenu } from './user-team-card-menu'; +import UserTeamCardActivity from './user-team-card-activity'; export function UserTeamCardHeader() { const t = useTranslations(); @@ -172,11 +173,13 @@ export function UserTeamCard({ {/* TodayWorkedTime */} - + + + {/* Card menu */}
{menu}
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 new file mode 100644 index 000000000..3b876b846 --- /dev/null +++ b/apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx @@ -0,0 +1,22 @@ +import { useModal } from '@app/hooks'; +import { Modal } from 'lib/components'; +import React, { PropsWithChildren } from 'react'; + +const UserTeamCardActivity = ({ children, id }: PropsWithChildren<{ id: string | undefined }>) => { + const { closeModal, isOpen, openModal } = useModal(); + return ( +
+
{children}
+ + Details {id} + +
+ ); +}; + +export default UserTeamCardActivity; From 212c3262d3c111d58cb85d661d8dfb1a20ba88bb Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 16 Jan 2024 00:28:51 +0200 Subject: [PATCH 2/9] feat: Toogle to see Team Member activity --- apps/web/app/hooks/features/useTimeSlot.ts | 9 +- .../features/team/user-team-card/index.tsx | 89 ++++++++++--------- .../user-team-card-activity.tsx | 72 +++++++++++---- 3 files changed, 106 insertions(+), 64 deletions(-) diff --git a/apps/web/app/hooks/features/useTimeSlot.ts b/apps/web/app/hooks/features/useTimeSlot.ts index cb919849a..949c95aed 100644 --- a/apps/web/app/hooks/features/useTimeSlot.ts +++ b/apps/web/app/hooks/features/useTimeSlot.ts @@ -9,7 +9,7 @@ import { useAuthenticateUser } from './useAuthenticateUser'; import { deleteTimerLogsRequestAPI, getTimerLogsRequestAPI } from '@app/services/client/api'; import { useUserProfilePage } from './useUserProfilePage'; -export function useTimeSlots() { +export function useTimeSlots(id?: string) { const { user } = useAuthenticateUser(); const [timeSlots, setTimeSlots] = useRecoilState(timeSlotsState); const profile = useUserProfilePage(); @@ -20,12 +20,12 @@ export function useTimeSlots() { const getTimeSlots = useCallback(() => { const todayStart = moment().startOf('day').toDate(); const todayEnd = moment().endOf('day').toDate(); - const employeeId = profile.member?.employeeId ?? ''; - if (profile.userProfile?.id === user?.id || user?.role?.name?.toUpperCase() == 'MANAGER') { + const employeeId = id ? id : profile.member?.employeeId ; + if ( profile.userProfile?.id === user?.id || user?.role?.name?.toUpperCase() == 'MANAGER') { queryCall({ tenantId: user?.tenantId ?? '', organizationId: user?.employee.organizationId ?? '', - employeeId: employeeId, + employeeId: employeeId ?? '', todayEnd, todayStart }).then((response) => { @@ -36,6 +36,7 @@ export function useTimeSlots() { }); } }, [ + id, profile.member?.employeeId, profile.userProfile?.id, user?.id, 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 4fcbd6b7c..37ab823e3 100644 --- a/apps/web/lib/features/team/user-team-card/index.tsx +++ b/apps/web/lib/features/team/user-team-card/index.tsx @@ -12,8 +12,8 @@ import { TaskEstimateInfo } from './task-estimate'; import { TaskInfo } from './task-info'; import { UserInfo } from './user-info'; import { UserTeamCardMenu } from './user-team-card-menu'; -import UserTeamCardActivity from './user-team-card-activity'; - +import React from 'react'; +import UserTeamActivity from './user-team-card-activity'; export function UserTeamCardHeader() { const t = useTranslations(); return ( @@ -77,6 +77,7 @@ export function UserTeamCard({ const seconds = useRecoilValue(timerSecondsState); const { activeTaskTotalStat, addSeconds } = useTaskStatistics(seconds); + const [showActivity, setShowActivity] = React.useState(false); let totalWork = <>; if (memberInfo.isAuthUser) { @@ -128,7 +129,7 @@ export function UserTeamCard({ ) => { - const { closeModal, isOpen, openModal } = useModal(); +const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefined; showActivity: boolean }) => { + const id = member?.employeeId ?? ''; + const { timeSlots, loading } = useTimeSlots(id); + const t = useTranslations(); + + const activityPercent = timeSlots.reduce((acc, el) => acc + el.percentage, 0) / timeSlots.length; + // const workedSeconds = timeSlots.reduce((acc, el) => acc + el.duration, 0); + const { + time: { h, m } + } = useLiveTimerStatus(); return ( -
-
{children}
- - Details {id} - -
+ +
+
+
+
+ {t('timer.TIME_ACTIVITY')} +

{activityPercent.toFixed(2)} %

+ +
+
+ {t('timer.TOTAL_HOURS')} +

{`${h}:${m}:00`}

+ +
+
+
Sites Visited
+
Apps
+
+
Screenshot
+ {timeSlots.length < 1 && !loading && ( +
+

{t('timer.NO_SCREENSHOOT')}

+
+ )} + {loading && timeSlots.length < 1 && } +
+
); }; -export default UserTeamCardActivity; +export default UserTeamActivity; From 6ea3281f8d90de220661b00c5906a6066b3d13f2 Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 16 Jan 2024 12:52:12 +0200 Subject: [PATCH 3/9] feat: add tab for activities filters --- apps/web/lib/features/index.ts | 1 + .../lib/features/team-members-block-view.tsx | 2 +- .../features/team/user-team-card/index.tsx | 80 ++----------------- .../team/user-team-card/task-skeleton.tsx | 71 ++++++++++++++++ .../user-team-card-activity.tsx | 56 ++++++++++--- 5 files changed, 126 insertions(+), 84 deletions(-) create mode 100644 apps/web/lib/features/team/user-team-card/task-skeleton.tsx diff --git a/apps/web/lib/features/index.ts b/apps/web/lib/features/index.ts index 07b6641b1..5fc67fb4d 100644 --- a/apps/web/lib/features/index.ts +++ b/apps/web/lib/features/index.ts @@ -25,6 +25,7 @@ export * from './team/teams-dropdown'; export * from './team/team-item'; export * from './unverified-email'; export * from './team/team-invitations'; +export * from './team/user-team-card/task-skeleton'; export * from './auth-user-task-input'; export * from './user-nav-menu'; diff --git a/apps/web/lib/features/team-members-block-view.tsx b/apps/web/lib/features/team-members-block-view.tsx index 5ecad073e..94b623e09 100644 --- a/apps/web/lib/features/team-members-block-view.tsx +++ b/apps/web/lib/features/team-members-block-view.tsx @@ -4,7 +4,7 @@ import { Transition } from '@headlessui/react'; import { UserTeamBlock } from './team/user-team-block'; import { useRecoilValue } from 'recoil'; import { taskBlockFilterState } from '@app/stores/task-filter'; -import { UserTeamCardSkeleton } from './team/user-team-card'; +import { UserTeamCardSkeleton } from './team/user-team-card/task-skeleton'; interface Props { teamMembers: OT_Member[]; 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 37ab823e3..e53fb690e 100644 --- a/apps/web/lib/features/team/user-team-card/index.tsx +++ b/apps/web/lib/features/team/user-team-card/index.tsx @@ -1,9 +1,11 @@ +'use client'; + import { secondsToTime } from '@app/helpers'; import { useCollaborative, useTMCardTaskEdit, useTaskStatistics, useTeamMemberCard } from '@app/hooks'; import { IClassName, IOrganizationTeamList } from '@app/interfaces'; import { timerSecondsState } from '@app/stores'; import { clsxm } from '@app/utils'; -import { Card, HorizontalSeparator, InputField, Text, Tooltip, VerticalSeparator } from 'lib/components'; +import { Card, HorizontalSeparator, InputField, Text, VerticalSeparator } from 'lib/components'; import { DraggerIcon } from 'lib/components/svgs'; import { TaskTimes, TodayWorkedTime } from 'lib/features'; import { useTranslations } from 'next-intl'; @@ -14,35 +16,6 @@ import { UserInfo } from './user-info'; import { UserTeamCardMenu } from './user-team-card-menu'; import React from 'react'; import UserTeamActivity from './user-team-card-activity'; -export function UserTeamCardHeader() { - const t = useTranslations(); - return ( -
- {/*
  • {t('common.STATUS')}
  • */} -
    {t('common.NAME')}
    -
    -
    {t('common.TASK')}
    -
    - -
    - {t('task.taskTableHead.TASK_WORK.TITLE')} -
    - {t('common.TASK')} -
    -
    -
    -
    {t('common.ESTIMATE')}
    -
    - -
    - {t('task.taskTableHead.TOTAL_WORK.TITLE')} -
    - {t('common.TODAY')} -
    -
    -
    - ); -} type IUserTeamCard = { active?: boolean; @@ -63,10 +36,10 @@ export function UserTeamCard({ member, publicTeam = false, draggable = false, - onDragStart, - onDragEnd, - onDragEnter, - onDragOver, + onDragStart = () => null, + onDragEnd = () => null, + onDragEnter = () => null, + onDragOver = () => null, currentExit = false }: IUserTeamCard) { const t = useTranslations(); @@ -227,42 +200,3 @@ export function UserTeamCard({ ); } - -export function UserTeamCardSkeleton() { - return ( -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - ); -} - -export function InviteUserTeamSkeleton() { - return ( -
    -
    -
    -
    -
    -
    -
    -
    - ); -} diff --git a/apps/web/lib/features/team/user-team-card/task-skeleton.tsx b/apps/web/lib/features/team/user-team-card/task-skeleton.tsx new file mode 100644 index 000000000..186766258 --- /dev/null +++ b/apps/web/lib/features/team/user-team-card/task-skeleton.tsx @@ -0,0 +1,71 @@ +import { Tooltip } from 'lib/components'; +import { useTranslations } from 'next-intl'; + +export function UserTeamCardSkeleton() { + return ( +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + ); +} + +export function InviteUserTeamSkeleton() { + return ( +
    +
    +
    +
    +
    +
    +
    +
    + ); +} + +export function UserTeamCardHeader() { + const t = useTranslations(); + return ( +
    + {/*
  • {t('common.STATUS')}
  • */} +
    {t('common.NAME')}
    +
    +
    {t('common.TASK')}
    +
    + +
    + {t('task.taskTableHead.TASK_WORK.TITLE')} +
    + {t('common.TASK')} +
    +
    +
    +
    {t('common.ESTIMATE')}
    +
    + +
    + {t('task.taskTableHead.TOTAL_WORK.TITLE')} +
    + {t('common.TODAY')} +
    +
    +
    + ); +} 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 a36b6a88f..93b480c5d 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 @@ -1,5 +1,5 @@ import { Transition } from '@headlessui/react'; -import { ProgressBar } from 'lib/components'; +import { HorizontalSeparator, ProgressBar } from 'lib/components'; import React from 'react'; import { useTimeSlots } from '@app/hooks/features/useTimeSlot'; // import { groupDataByHour } from '@app/helpers/array-data'; @@ -7,6 +7,9 @@ import { useTranslations } from 'next-intl'; import { useLiveTimerStatus } from '@app/hooks'; import { ScreenshootSkeleton } from 'lib/features/activity/components/screenshoots-per-hour-skeleton'; import { OT_Member } from '@app/interfaces'; +import { Tab } from '@headlessui/react'; +import { ActivityFilters } from '@app/constants'; +import { clsxm } from '@app/utils'; const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefined; showActivity: boolean }) => { const id = member?.employeeId ?? ''; @@ -29,6 +32,7 @@ const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefi leaveTo="opacity-0" >
    +
    @@ -42,16 +46,48 @@ const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefi
    -
    Sites Visited
    -
    Apps
    -
    -
    Screenshot
    - {timeSlots.length < 1 && !loading && ( -
    -

    {t('timer.NO_SCREENSHOOT')}

    +
    + + + {Object.values(ActivityFilters) + .filter((el) => el !== 'Tasks') + .map((filter: string) => ( + + clsxm( + 'w-full rounded-lg py-2.5 text-sm font-medium leading-5', + ' focus:outline-none focus:ring-2', + selected + ? 'bg-white dark:bg-dark text-blue-700 shadow' + : ' hover:bg-white/[0.50' + ) + } + > + {filter} + + ))} + + + +
    Screenshot
    + {timeSlots.length < 1 && !loading && ( +
    +

    {t('timer.NO_SCREENSHOOT')}

    +
    + )} + {loading && timeSlots.length < 1 && } +
    + +
    Apps
    +
    + +
    Visited Sites
    +
    +
    +
    - )} - {loading && timeSlots.length < 1 && } +
    ); From 6fd73d03c074a8ce3729391985c24fa524ef45a2 Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 16 Jan 2024 14:14:13 +0200 Subject: [PATCH 4/9] feat: add ScreenShot Tab UI to Activity section --- apps/web/app/interfaces/IScreenshoot.ts | 1 + .../components/screenshoots-per-hour.tsx | 35 +++++++++++++++++++ .../activity/components/screenshot-item.tsx | 8 +++-- .../lib/features/activity/screenshoots.tsx | 28 ++++++++++++++- .../user-team-card-activity.tsx | 15 +++----- 5 files changed, 73 insertions(+), 14 deletions(-) diff --git a/apps/web/app/interfaces/IScreenshoot.ts b/apps/web/app/interfaces/IScreenshoot.ts index d0418bcc2..fd30efe8d 100644 --- a/apps/web/app/interfaces/IScreenshoot.ts +++ b/apps/web/app/interfaces/IScreenshoot.ts @@ -10,5 +10,6 @@ export interface IScreenShootItem { imageUrl: string; percent: number | string; showProgress?: boolean; + isTeamPage?: boolean onShow: () => any; } diff --git a/apps/web/lib/features/activity/components/screenshoots-per-hour.tsx b/apps/web/lib/features/activity/components/screenshoots-per-hour.tsx index ad2a173b2..1d4dfc476 100644 --- a/apps/web/lib/features/activity/components/screenshoots-per-hour.tsx +++ b/apps/web/lib/features/activity/components/screenshoots-per-hour.tsx @@ -37,3 +37,38 @@ export const ScreenshootPerHour = ({ ); }; + +export const ScreenshootPerHourTeam = ({ + timeSlots, + startedAt, + stoppedAt +}: { + timeSlots: ITimerSlot[]; + startedAt: string; + stoppedAt: string; +}) => { + const { isOpen, closeModal, openModal } = useModal(); + return ( +
    +

    + {startedAt} - {stoppedAt} +

    +
    + {timeSlots.map((el, i) => ( +
    + openModal()} + idSlot={el.id} + isTeamPage + /> + +
    + ))} +
    +
    + ); +}; diff --git a/apps/web/lib/features/activity/components/screenshot-item.tsx b/apps/web/lib/features/activity/components/screenshot-item.tsx index c976108d9..6c69cb488 100644 --- a/apps/web/lib/features/activity/components/screenshot-item.tsx +++ b/apps/web/lib/features/activity/components/screenshot-item.tsx @@ -15,7 +15,8 @@ const ScreenshotItem = ({ percent, startTime, showProgress = true, - onShow + onShow, + isTeamPage = false }: IScreenShootItem) => { const t = useTranslations(); const { deleteTimeSlots } = useTimeSlots(); @@ -24,7 +25,8 @@ const ScreenshotItem = ({
    diff --git a/apps/web/lib/features/activity/screenshoots.tsx b/apps/web/lib/features/activity/screenshoots.tsx index 4c9db24c4..0c45e14b2 100644 --- a/apps/web/lib/features/activity/screenshoots.tsx +++ b/apps/web/lib/features/activity/screenshoots.tsx @@ -1,5 +1,5 @@ import { ProgressBar } from 'lib/components'; -import { ScreenshootPerHour } from './components/screenshoots-per-hour'; +import { ScreenshootPerHour, ScreenshootPerHourTeam } from './components/screenshoots-per-hour'; import { useTimeSlots } from '@app/hooks/features/useTimeSlot'; import { groupDataByHour } from '@app/helpers/array-data'; import { useTranslations } from 'next-intl'; @@ -47,3 +47,29 @@ export function ScreenshootTab() {
    ); } + + +export function ScreenshootTeamTab({ id}: {id:string}) { + const { timeSlots, loading } = useTimeSlots(id); + const t = useTranslations(); + + return ( +
    + {groupDataByHour(timeSlots).map((hourData, i) => ( + + ))} + {timeSlots.length < 1 && !loading && ( +
    +

    {t('timer.NO_SCREENSHOOT')}

    +
    + )} + {loading && timeSlots.length < 1 && } +
    + ); +} 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 93b480c5d..4665ca5e1 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,6 +10,7 @@ import { OT_Member } from '@app/interfaces'; import { Tab } from '@headlessui/react'; import { ActivityFilters } from '@app/constants'; import { clsxm } from '@app/utils'; +import { ScreenshootTeamTab } from 'lib/features/activity/screenshoots'; const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefined; showActivity: boolean }) => { const id = member?.employeeId ?? ''; @@ -35,12 +36,12 @@ const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefi
    -
    +
    {t('timer.TIME_ACTIVITY')}

    {activityPercent.toFixed(2)} %

    -
    +
    {t('timer.TOTAL_HOURS')}

    {`${h}:${m}:00`}

    @@ -70,19 +71,13 @@ const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefi -
    Screenshot
    - {timeSlots.length < 1 && !loading && ( -
    -

    {t('timer.NO_SCREENSHOOT')}

    -
    - )} - {loading && timeSlots.length < 1 && } +
    Apps
    -
    Visited Sites
    +
    From 39e5aaffc8554eed92275a6ca55abfa3aafab957 Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 16 Jan 2024 14:15:05 +0200 Subject: [PATCH 5/9] fix: delete unsused Vars --- .../features/team/user-team-card/user-team-card-activity.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 4665ca5e1..b94fd7792 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 @@ -2,10 +2,8 @@ import { Transition } from '@headlessui/react'; import { HorizontalSeparator, ProgressBar } from 'lib/components'; import React from 'react'; import { useTimeSlots } from '@app/hooks/features/useTimeSlot'; -// import { groupDataByHour } from '@app/helpers/array-data'; import { useTranslations } from 'next-intl'; import { useLiveTimerStatus } from '@app/hooks'; -import { ScreenshootSkeleton } from 'lib/features/activity/components/screenshoots-per-hour-skeleton'; import { OT_Member } from '@app/interfaces'; import { Tab } from '@headlessui/react'; import { ActivityFilters } from '@app/constants'; @@ -14,11 +12,10 @@ import { ScreenshootTeamTab } from 'lib/features/activity/screenshoots'; const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefined; showActivity: boolean }) => { const id = member?.employeeId ?? ''; - const { timeSlots, loading } = useTimeSlots(id); + const { timeSlots } = useTimeSlots(id); const t = useTranslations(); const activityPercent = timeSlots.reduce((acc, el) => acc + el.percentage, 0) / timeSlots.length; - // const workedSeconds = timeSlots.reduce((acc, el) => acc + el.duration, 0); const { time: { h, m } } = useLiveTimerStatus(); From 270febce2dfa56670bb597c638f91985047ae761 Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 16 Jan 2024 15:02:28 +0200 Subject: [PATCH 6/9] feat: add Apps visited to Team Member Card --- apps/web/lib/features/activity/apps.tsx | 8 ++++---- apps/web/lib/features/activity/visited-sites.tsx | 2 +- apps/web/lib/features/team/user-team-card/index.tsx | 2 +- .../team/user-team-card/user-team-card-activity.tsx | 6 ++++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/web/lib/features/activity/apps.tsx b/apps/web/lib/features/activity/apps.tsx index 8bbb5845f..ca933ba7e 100644 --- a/apps/web/lib/features/activity/apps.tsx +++ b/apps/web/lib/features/activity/apps.tsx @@ -3,9 +3,9 @@ import { AppVisitedSkeleton } from './components/app-visited-skeleton'; import { groupAppsByHour } from '@app/helpers/array-data'; import { useTranslations } from 'next-intl'; import AppVisitedItem from './components/app-visited-Item'; -import { AppVisitedModal } from './components/app-visited-details'; +// import { AppVisitedModal } from './components/app-visited-details'; -export function AppsTab() { +export function AppsTab({ id}: {id?: string}) { const { visitedApps, loading } = useTimeDailyActivity('APP'); const t = useTranslations(); const apps = groupAppsByHour(visitedApps); @@ -28,13 +28,13 @@ export function AppsTab() {
    {app.apps?.map((item, i) => (
    - + {/* */} - + {/* */}
    ))}
    diff --git a/apps/web/lib/features/activity/visited-sites.tsx b/apps/web/lib/features/activity/visited-sites.tsx index 5738cd177..63af6d68a 100644 --- a/apps/web/lib/features/activity/visited-sites.tsx +++ b/apps/web/lib/features/activity/visited-sites.tsx @@ -4,7 +4,7 @@ import { groupAppsByHour } from '@app/helpers/array-data'; import { useTranslations } from 'next-intl'; import AppVisitedItem from './components/app-visited-Item'; -export function VisitedSitesTab() { +export function VisitedSitesTab({ id }: { id?: string}) { const { visitedSites, loading } = useTimeDailyActivity('URL'); const t = useTranslations(); const sites = groupAppsByHour(visitedSites); 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 e53fb690e..dc1f88829 100644 --- a/apps/web/lib/features/team/user-team-card/index.tsx +++ b/apps/web/lib/features/team/user-team-card/index.tsx @@ -110,7 +110,7 @@ export function UserTeamCard({ className )} > -
    +
    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 b94fd7792..a580c579f 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 @@ -9,6 +9,8 @@ import { Tab } from '@headlessui/react'; import { ActivityFilters } from '@app/constants'; import { clsxm } from '@app/utils'; import { ScreenshootTeamTab } from 'lib/features/activity/screenshoots'; +import { AppsTab } from 'lib/features/activity/apps'; +import { VisitedSitesTab } from 'lib/features/activity/visited-sites'; const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefined; showActivity: boolean }) => { const id = member?.employeeId ?? ''; @@ -71,10 +73,10 @@ const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefi -
    Apps
    +
    -
    +
    From 958c3a8fe4b8f94a22d0ee9ec4ffe888bb9f7fff Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 16 Jan 2024 15:20:12 +0200 Subject: [PATCH 7/9] feat: fecth data by TeamMember id --- apps/web/app/hooks/features/useTimeDailyActivity.ts | 4 ++-- apps/web/lib/features/activity/apps.tsx | 2 +- apps/web/lib/features/activity/visited-sites.tsx | 2 +- .../team/user-team-card/user-team-card-activity.tsx | 13 +++---------- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/apps/web/app/hooks/features/useTimeDailyActivity.ts b/apps/web/app/hooks/features/useTimeDailyActivity.ts index 7b2fa9251..dff66b892 100644 --- a/apps/web/app/hooks/features/useTimeDailyActivity.ts +++ b/apps/web/app/hooks/features/useTimeDailyActivity.ts @@ -9,7 +9,7 @@ import { useAuthenticateUser } from './useAuthenticateUser'; import { getTimerDailyRequestAPI } from '@app/services/client/api'; import { useUserProfilePage } from './useUserProfilePage'; -export function useTimeDailyActivity(type: string) { +export function useTimeDailyActivity(type: string, id?: string) { const profile = useUserProfilePage(); const { user } = useAuthenticateUser(); const [visitedApps, setVisitedApps] = useRecoilState(timeAppsState); @@ -22,7 +22,7 @@ export function useTimeDailyActivity(type: string) { ({ title }: { title?: string }) => { const todayStart = moment().startOf('day').toDate(); const todayEnd = moment().endOf('day').toDate(); - const employeeId = profile.member?.employeeId ?? ''; + const employeeId = id ?? profile.member?.employeeId ?? ''; if (profile.userProfile?.id === user?.id || user?.role?.name?.toUpperCase() == 'MANAGER') { queryCall({ tenantId: user?.tenantId ?? '', diff --git a/apps/web/lib/features/activity/apps.tsx b/apps/web/lib/features/activity/apps.tsx index ca933ba7e..4754e2da3 100644 --- a/apps/web/lib/features/activity/apps.tsx +++ b/apps/web/lib/features/activity/apps.tsx @@ -6,7 +6,7 @@ import AppVisitedItem from './components/app-visited-Item'; // import { AppVisitedModal } from './components/app-visited-details'; export function AppsTab({ id}: {id?: string}) { - const { visitedApps, loading } = useTimeDailyActivity('APP'); + const { visitedApps, loading } = useTimeDailyActivity('APP', id); const t = useTranslations(); const apps = groupAppsByHour(visitedApps); return ( diff --git a/apps/web/lib/features/activity/visited-sites.tsx b/apps/web/lib/features/activity/visited-sites.tsx index 63af6d68a..b38a32506 100644 --- a/apps/web/lib/features/activity/visited-sites.tsx +++ b/apps/web/lib/features/activity/visited-sites.tsx @@ -5,7 +5,7 @@ import { useTranslations } from 'next-intl'; import AppVisitedItem from './components/app-visited-Item'; export function VisitedSitesTab({ id }: { id?: string}) { - const { visitedSites, loading } = useTimeDailyActivity('URL'); + const { visitedSites, loading } = useTimeDailyActivity('URL', id); const t = useTranslations(); const sites = groupAppsByHour(visitedSites); return ( 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 a580c579f..cf2e3d9cb 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 @@ -18,9 +18,6 @@ const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefi const t = useTranslations(); const activityPercent = timeSlots.reduce((acc, el) => acc + el.percentage, 0) / timeSlots.length; - const { - time: { h, m } - } = useLiveTimerStatus(); return (
    {t('timer.TIME_ACTIVITY')} -

    {activityPercent.toFixed(2)} %

    +

    {activityPercent ? activityPercent.toFixed(2): "00"} %

    -
    - {t('timer.TOTAL_HOURS')} -

    {`${h}:${m}:00`}

    - -
    +
    @@ -60,7 +53,7 @@ const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefi ' focus:outline-none focus:ring-2', selected ? 'bg-white dark:bg-dark text-blue-700 shadow' - : ' hover:bg-white/[0.50' + : ' hover:bg-white/[0.50]' ) } > From 30b740a3be7e5865f55fbb8e6f6a842906bfd885 Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 16 Jan 2024 16:44:15 +0200 Subject: [PATCH 8/9] feat: Visited sites tab --- apps/web/lib/features/activity/apps.tsx | 1 + .../features/team/user-team-card/user-team-card-activity.tsx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/web/lib/features/activity/apps.tsx b/apps/web/lib/features/activity/apps.tsx index 4754e2da3..c83eca996 100644 --- a/apps/web/lib/features/activity/apps.tsx +++ b/apps/web/lib/features/activity/apps.tsx @@ -9,6 +9,7 @@ export function AppsTab({ id}: {id?: string}) { const { visitedApps, loading } = useTimeDailyActivity('APP', id); const t = useTranslations(); const apps = groupAppsByHour(visitedApps); + console.log("INTO APP TAB"); return (
    {/* TODO: Filters components */}
    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 cf2e3d9cb..93d5e0acd 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 @@ -29,7 +29,8 @@ const UserTeamActivity = ({ member, showActivity }: { member: OT_Member | undefi leaveTo="opacity-0" >
    - + +

    Activity for Today

    From ddefc402256608abf420055e7bb0babf3a8bfb89 Mon Sep 17 00:00:00 2001 From: cedric karungu Date: Tue, 16 Jan 2024 18:50:39 +0200 Subject: [PATCH 9/9] fix: build error --- .../lib/features/team/user-team-card/user-team-card-activity.tsx | 1 - 1 file changed, 1 deletion(-) 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 93d5e0acd..7dca90bdb 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 @@ -3,7 +3,6 @@ import { HorizontalSeparator, ProgressBar } from 'lib/components'; import React from 'react'; import { useTimeSlots } from '@app/hooks/features/useTimeSlot'; import { useTranslations } from 'next-intl'; -import { useLiveTimerStatus } from '@app/hooks'; import { OT_Member } from '@app/interfaces'; import { Tab } from '@headlessui/react'; import { ActivityFilters } from '@app/constants';