refactor fetched users into single array and replace Image tag with img
This commit is contained in:
@@ -5,6 +5,7 @@ import Tip from "@/components/ApprovalWorkflows/Tip";
|
||||
import UserWithProfilePic from "@/components/ApprovalWorkflows/UserWithProfilePic";
|
||||
import WorkflowStepComponent from "@/components/ApprovalWorkflows/WorkflowStepComponent";
|
||||
import Layout from "@/components/High/Layout";
|
||||
import Button from "@/components/Low/Button";
|
||||
import { ApprovalWorkflow, getUserTypeLabelShort, WorkflowStep } from "@/interfaces/approval.workflow";
|
||||
import { User } from "@/interfaces/user";
|
||||
import { sessionOptions } from "@/lib/session";
|
||||
@@ -82,10 +83,14 @@ export default function Home({ user, workflow, workflowAssignees, workflowReques
|
||||
setIsPanelOpen(true);
|
||||
};
|
||||
|
||||
const saveComments = () => {
|
||||
const handleSaveComments = () => {
|
||||
|
||||
};
|
||||
|
||||
const handleApproveStep = () => {
|
||||
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
@@ -99,7 +104,7 @@ export default function Home({ user, workflow, workflowAssignees, workflowReques
|
||||
</Head>
|
||||
<ToastContainer />
|
||||
{user && (
|
||||
<Layout user={user} className="gap-6">
|
||||
<Layout user={user} className="gap-6 min-h-[900px]">
|
||||
|
||||
<section className="flex items-center gap-2">
|
||||
<Link
|
||||
@@ -224,7 +229,7 @@ export default function Home({ user, workflow, workflowAssignees, workflowReques
|
||||
</div>
|
||||
|
||||
) : (
|
||||
<div className={"text-base font-medium text-gray-500"}>
|
||||
<div className={"text-base font-medium text-gray-500 mb-6"}>
|
||||
One assignee is required to sign off to complete this step:
|
||||
<div className="flex flex-col gap-2 mt-3">
|
||||
{workflowAssignees.filter(user => selectedStep.assignees.includes(user.id)).map(user => (
|
||||
@@ -240,6 +245,19 @@ export default function Home({ user, workflow, workflowAssignees, workflowReques
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{selectedStepIndex === currentStep &&
|
||||
<Button
|
||||
color="purple"
|
||||
variant="solid"
|
||||
disabled={!selectedStep.assignees.includes(user.id)}
|
||||
onClick={handleApproveStep}
|
||||
padding="px-6 py-2"
|
||||
className="mb-3 w-full text-lg"
|
||||
>
|
||||
Approve Step
|
||||
</Button>
|
||||
}
|
||||
|
||||
<hr className="my-4 h-[4px] bg-mti-purple-ultralight rounded-full w-full" />
|
||||
|
||||
@@ -247,11 +265,19 @@ export default function Home({ user, workflow, workflowAssignees, workflowReques
|
||||
value={comments}
|
||||
onChange={(e) => setComments(e.target.value)}
|
||||
placeholder="Input comments here"
|
||||
className="w-full h-80 p-2 border-2 rounded-xl shadow-lg focus:border-mti-purple focus:outline-none mt-4"
|
||||
className="w-full h-64 p-2 border-2 rounded-xl shadow-lg focus:border-mti-purple focus:outline-none mt-3 resize-none"
|
||||
/>
|
||||
<button onClick={saveComments} className="mt-4 px-6 py-2 bg-mti-purple-dark text-white rounded-full">
|
||||
<Button
|
||||
color="purple"
|
||||
variant="solid"
|
||||
onClick={handleSaveComments}
|
||||
padding="px-6 py-2"
|
||||
className="mt-6 mb-3 w-full text-lg"
|
||||
>
|
||||
Save Comments
|
||||
</button>
|
||||
</Button>
|
||||
|
||||
<hr className="my-4 h-[4px] bg-mti-purple-ultralight rounded-full w-full" />
|
||||
|
||||
</div>
|
||||
</motion.div>
|
||||
|
||||
Reference in New Issue
Block a user