NTP-62417| varshitha |Activity Adherence and Calls (#1455)
* NTP-62417| varshitha |Activity Adherence and Calls * NTP-62417| varshitha |Activity Adherence and Calls
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@cp/src/components/TooltipV2/TooltipV2';
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@cp/src/components/TooltipV2/TooltipV2';
|
||||||
import { ActivityTypeLabels, EXPECTED_DURATION_IN_MINUTES } from './constants';
|
import { ActivityTypeLabels, EXPECTED_DURATION_IN_MINUTES, LoginStatus } from './constants';
|
||||||
import { ActivityItem } from './types';
|
import { ActivityItem } from './types';
|
||||||
import {
|
import {
|
||||||
calculateActivityBarWidths,
|
calculateActivityBarWidths,
|
||||||
@@ -19,6 +19,7 @@ const renderActivityBar = ({
|
|||||||
showLoginTime = false,
|
showLoginTime = false,
|
||||||
showExpectedDuration = false,
|
showExpectedDuration = false,
|
||||||
expectedDurationInMinutes = EXPECTED_DURATION_IN_MINUTES,
|
expectedDurationInMinutes = EXPECTED_DURATION_IN_MINUTES,
|
||||||
|
loginStatus,
|
||||||
totalExpectedMinutes
|
totalExpectedMinutes
|
||||||
}: {
|
}: {
|
||||||
activities: ActivityItem[];
|
activities: ActivityItem[];
|
||||||
@@ -26,6 +27,7 @@ const renderActivityBar = ({
|
|||||||
showLoginTime?: boolean;
|
showLoginTime?: boolean;
|
||||||
showExpectedDuration?: boolean;
|
showExpectedDuration?: boolean;
|
||||||
expectedDurationInMinutes?: number;
|
expectedDurationInMinutes?: number;
|
||||||
|
loginStatus?: LoginStatus;
|
||||||
totalExpectedMinutes: number;
|
totalExpectedMinutes: number;
|
||||||
}) => {
|
}) => {
|
||||||
const calculatedActivities = calculateActivityBarWidths(activities, totalExpectedMinutes);
|
const calculatedActivities = calculateActivityBarWidths(activities, totalExpectedMinutes);
|
||||||
@@ -35,6 +37,8 @@ const renderActivityBar = ({
|
|||||||
calculatedActivities
|
calculatedActivities
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const isLateLogin = loginStatus === LoginStatus.LATE_LOGIN;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-row items-start relative">
|
<div className="flex flex-row items-start relative">
|
||||||
{showLoginTime ? (
|
{showLoginTime ? (
|
||||||
@@ -44,7 +48,7 @@ const renderActivityBar = ({
|
|||||||
<div
|
<div
|
||||||
className={`w-[3px] h-[28px] !rounded-sm absolute mt-[-2px]`}
|
className={`w-[3px] h-[28px] !rounded-sm absolute mt-[-2px]`}
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: isLateLogin(loginTimeStamp || 0)
|
backgroundColor: isLateLogin
|
||||||
? getActivityColorClassMap['lateLogin']
|
? getActivityColorClassMap['lateLogin']
|
||||||
: getActivityColorClassMap['inTimeLogin']
|
: getActivityColorClassMap['inTimeLogin']
|
||||||
}}
|
}}
|
||||||
@@ -79,7 +83,12 @@ const renderActivityBar = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip key={`activity-${index}`} placement="top" hideStrategy="referenceHidden">
|
<Tooltip
|
||||||
|
key={`activity-${index}`}
|
||||||
|
placement="top"
|
||||||
|
hideStrategy="referenceHidden"
|
||||||
|
hiddenPadding={0}
|
||||||
|
>
|
||||||
<div style={{ width: `${activity.durationInPercentage}%`, height: '100%' }}>
|
<div style={{ width: `${activity.durationInPercentage}%`, height: '100%' }}>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ const TodayActivity = ({ isLoading }: { isLoading: boolean }) => {
|
|||||||
showLoginTime: true,
|
showLoginTime: true,
|
||||||
showExpectedDuration: true,
|
showExpectedDuration: true,
|
||||||
expectedDurationInMinutes: Number(loginMetrics?.expectedActiveMinutes || 0),
|
expectedDurationInMinutes: Number(loginMetrics?.expectedActiveMinutes || 0),
|
||||||
|
loginStatus: loginMetrics.loginStatus,
|
||||||
totalExpectedMinutes: EXPECTED_DURATION_IN_MINUTES
|
totalExpectedMinutes: EXPECTED_DURATION_IN_MINUTES
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -67,3 +67,8 @@ export const ActivityTypeLabels = {
|
|||||||
contentInTip: 'Other breaks'
|
contentInTip: 'Other breaks'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export enum LoginStatus {
|
||||||
|
ON_TIME_LOGGED_IN = 'ON_TIME_LOGGED_IN',
|
||||||
|
LATE_LOGIN = 'LATE_LOGIN'
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user