From ac072b0a5a509b3a2fa1f27c3bdc8d3853e13816 Mon Sep 17 00:00:00 2001 From: Joao Correia Date: Sat, 25 Jan 2025 15:47:33 +0000 Subject: [PATCH] small fixes and animate side panel content --- .../ApprovalWorkflows/UserWithProfilePic.tsx | 2 +- src/pages/approval-workflows/[id].tsx | 203 ++++++++++-------- src/pages/approval-workflows/create.tsx | 6 + 3 files changed, 115 insertions(+), 96 deletions(-) diff --git a/src/components/ApprovalWorkflows/UserWithProfilePic.tsx b/src/components/ApprovalWorkflows/UserWithProfilePic.tsx index 34c78adb..9b647847 100644 --- a/src/components/ApprovalWorkflows/UserWithProfilePic.tsx +++ b/src/components/ApprovalWorkflows/UserWithProfilePic.tsx @@ -17,7 +17,7 @@ export default function UserWithProfilePic({ prefix, name, profileImage, textSiz alt={name} width={24} height={24} - className="w-6 h-6 rounded-full" + className="rounded-full" /> ); diff --git a/src/pages/approval-workflows/[id].tsx b/src/pages/approval-workflows/[id].tsx index 5ecd6ca2..b9c39671 100644 --- a/src/pages/approval-workflows/[id].tsx +++ b/src/pages/approval-workflows/[id].tsx @@ -23,6 +23,7 @@ import { ToastContainer } from "react-toastify"; import approvalWorkflowsData from '../../demo/approval_workflows.json'; // to test locally import Tip from "@/components/ApprovalWorkflows/Tip"; +import { AnimatePresence, LayoutGroup, motion } from "framer-motion"; export const getServerSideProps = withIronSessionSsr(async ({ req, res, params }) => { const user = await requestUser(req, res); @@ -149,106 +150,118 @@ export default function Home({ user, workflow, workflowAssignees, workflowReques ))} -
- {isPanelOpen && ( -
-
-

Step {selectedStepIndex + 1}

-
- -
-
- -
- -
-
- {selectedStep.stepType === "approval-by" ? ( - <> - - Approval Step - - ) : ( - <> - - Form Intake Step - - ) - } -
- - {selectedStep.completed ? ( -
- Approved on {new Date(selectedStep.completedDate!).toLocaleString("en-CA", { - year: "numeric", - month: "2-digit", - day: "2-digit", - hour: "2-digit", - minute: "2-digit", - second: "2-digit", - hour12: false, - }).replace(", ", " at ")} -
-

Approved by:

- {(() => { - const assignee = workflowAssignees.find( - (assignee) => assignee.id === selectedStep.completedBy - ); - return assignee ? ( - - ) : ( - "Unknown" - ); - })()} -
-

No additional actions are required.

-
- - ) : ( -
- One assignee is required to sign off to complete this step: -
- {workflowAssignees.map(user => ( - - - - ))} + {/* Side panel */} + + +
+ {isPanelOpen && selectedStep && ( + +
+

Step {selectedStepIndex + 1}

+
+
- )} -
+
-