Add approval by to step details panel and add text size prop to UserWithProfilePicture component

This commit is contained in:
Joao Correia
2025-01-25 04:23:28 +00:00
parent f71a7182dd
commit 2eff08bf86
2 changed files with 26 additions and 5 deletions

View File

@@ -4,12 +4,14 @@ interface Props {
prefix: string;
name: string;
profileImage: string;
textSize?: string;
}
export default function UserWithProfilePic({ prefix, name, profileImage }: Props) {
export default function UserWithProfilePic({ prefix, name, profileImage, textSize }: Props) {
const textClassName = `${textSize ? textSize : "text-xs"} font-medium`
return (
<div className="flex items-center space-x-2">
<p className="text-xs font-medium">{prefix} {name}</p>
<p className={textClassName}>{prefix} {name}</p>
<Image
src={profileImage}
alt={name}

View File

@@ -180,7 +180,7 @@ export default function Home({ user, workflow, workflowAssignees, workflowReques
</div>
{selectedStep.completed ? (
<div className={"text-base font-medium text-gray-500 my-7"}>
<div className={"text-base font-medium text-gray-500 flex flex-col gap-6"}>
Approved on {new Date(selectedStep.completedDate!).toLocaleString("en-CA", {
year: "numeric",
month: "2-digit",
@@ -190,9 +190,27 @@ export default function Home({ user, workflow, workflowAssignees, workflowReques
second: "2-digit",
hour12: false,
}).replace(", ", " at ")}
<p className="my-4 text-sm">No additional actions are required.</p>
<div className="flex flex-row gap-1 text-sm">
<p className="text-base">Approved by:</p>
{(() => {
const assignee = workflowAssignees.find(
(assignee) => assignee.id === selectedStep.completedBy
);
return assignee ? (
<UserWithProfilePic
textSize="text-base"
prefix={getUserTypeLabelShort(assignee.type)}
name={assignee.name}
profileImage={assignee.profilePicture}
/>
) : (
"Unknown"
);
})()}
</div>
<p className="text-sm">No additional actions are required.</p>
</div>
) : (
<div className={"text-base font-medium text-gray-500"}>
One assignee is required to sign off to complete this step:
@@ -200,6 +218,7 @@ export default function Home({ user, workflow, workflowAssignees, workflowReques
{workflowAssignees.map(user => (
<span key={user.id}>
<UserWithProfilePic
textSize="text-sm"
prefix={getUserTypeLabelShort(user.type)}
name={user.name}
profileImage={user.profilePicture}