Fix animations
This commit is contained in:
@@ -95,12 +95,8 @@ export default function WorkflowForm({ workflow, onWorkflowChange, entityTeacher
|
|||||||
<>
|
<>
|
||||||
{workflow.entityId && workflow.name &&
|
{workflow.entityId && workflow.name &&
|
||||||
<div>
|
<div>
|
||||||
<motion.div
|
<div
|
||||||
className="flex flex-col gap-6"
|
className="flex flex-col gap-6"
|
||||||
initial={{ opacity: 0, y: 20 }}
|
|
||||||
animate={{ opacity: 1, y: 0 }}
|
|
||||||
exit={{ opacity: 0, x: 20 }}
|
|
||||||
transition={{ duration: 0.3 }}
|
|
||||||
>
|
>
|
||||||
<Tip text="Introduce here all the steps associated with this instance." />
|
<Tip text="Introduce here all the steps associated with this instance." />
|
||||||
<Button
|
<Button
|
||||||
@@ -113,7 +109,7 @@ export default function WorkflowForm({ workflow, onWorkflowChange, entityTeacher
|
|||||||
<IoIosAddCircleOutline className="size-6" />
|
<IoIosAddCircleOutline className="size-6" />
|
||||||
Add Step
|
Add Step
|
||||||
</Button>
|
</Button>
|
||||||
</motion.div>
|
</div>
|
||||||
|
|
||||||
<Reorder.Group
|
<Reorder.Group
|
||||||
axis="y"
|
axis="y"
|
||||||
@@ -126,10 +122,10 @@ export default function WorkflowForm({ workflow, onWorkflowChange, entityTeacher
|
|||||||
<Reorder.Item
|
<Reorder.Item
|
||||||
key={step.key}
|
key={step.key}
|
||||||
value={step}
|
value={step}
|
||||||
initial={{ opacity: 0, y: 20 }}
|
initial={{ opacity: 0, y: -30 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
exit={{ opacity: 0, x: 20 }}
|
exit={{ opacity: 0, x: 30 }}
|
||||||
transition={{ duration: 0.3 }}
|
transition={{ duration: 0.20 }}
|
||||||
layout
|
layout
|
||||||
drag={!(step.firstStep || step.finalStep)}
|
drag={!(step.firstStep || step.finalStep)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export default function WorkflowStepComponent({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
className={clsx("flex flex-row gap-5 w-[600px] p-6 my-4 rounded-2xl transition ease-in-out duration-300 disabled:cursor-not-allowed cursor-pointer", {
|
className={clsx("flex flex-row gap-5 w-[600px] p-6 mb-5 rounded-2xl transition ease-in-out duration-300 cursor-pointer", {
|
||||||
"bg-mti-purple-ultralight": selected,
|
"bg-mti-purple-ultralight": selected,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { RiThumbUpLine } from "react-icons/ri";
|
|||||||
import { ToastContainer } from "react-toastify";
|
import { ToastContainer } from "react-toastify";
|
||||||
|
|
||||||
import approvalWorkflowsData from '../../demo/approval_workflows.json'; // to test locally
|
import approvalWorkflowsData from '../../demo/approval_workflows.json'; // to test locally
|
||||||
|
import Tip from "@/components/ApprovalWorkflows/Tip";
|
||||||
|
|
||||||
export const getServerSideProps = withIronSessionSsr(async ({ req, res, params }) => {
|
export const getServerSideProps = withIronSessionSsr(async ({ req, res, params }) => {
|
||||||
const user = await requestUser(req, res);
|
const user = await requestUser(req, res);
|
||||||
@@ -125,6 +126,9 @@ export default function Home({ user, workflow, workflowAssignees, workflowReques
|
|||||||
status={workflow.status}
|
status={workflow.status}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{steps.find((step) => !step.completed) === undefined &&
|
||||||
|
<Tip text="All steps in this instance have been completed." />
|
||||||
|
}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="flex flex-col gap-0">
|
<section className="flex flex-col gap-0">
|
||||||
@@ -235,7 +239,7 @@ export default function Home({ user, workflow, workflowAssignees, workflowReques
|
|||||||
value={comments}
|
value={comments}
|
||||||
onChange={(e) => setComments(e.target.value)}
|
onChange={(e) => setComments(e.target.value)}
|
||||||
placeholder="Input comments here"
|
placeholder="Input comments here"
|
||||||
className="w-full h-80 p-2 border-2 rounded-xl focus:border-mti-purple focus:outline-none mt-4"
|
className="w-full h-80 p-2 border-2 rounded-xl shadow-lg focus:border-mti-purple focus:outline-none mt-4"
|
||||||
/>
|
/>
|
||||||
<button onClick={saveComments} className="mt-4 px-6 py-2 bg-mti-purple-dark text-white rounded-full">
|
<button onClick={saveComments} className="mt-4 px-6 py-2 bg-mti-purple-dark text-white rounded-full">
|
||||||
Save Comments
|
Save Comments
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { requestUser } from "@/utils/api";
|
|||||||
import { getEntities } from "@/utils/entities.be";
|
import { getEntities } from "@/utils/entities.be";
|
||||||
import { shouldRedirectHome } from "@/utils/navigation.disabled";
|
import { shouldRedirectHome } from "@/utils/navigation.disabled";
|
||||||
import { getEntitiesUsers } from "@/utils/users.be";
|
import { getEntitiesUsers } from "@/utils/users.be";
|
||||||
import { LayoutGroup, motion } from "framer-motion";
|
import { AnimatePresence, LayoutGroup, motion } from "framer-motion";
|
||||||
import { withIronSessionSsr } from "iron-session/next";
|
import { withIronSessionSsr } from "iron-session/next";
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
@@ -251,34 +251,27 @@ export default function Home({ user, userEntitiesWithLabel, userEntitiesTeachers
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<LayoutGroup>
|
<AnimatePresence mode="wait">
|
||||||
{(!currentWorkflow.name || !currentWorkflow.entityId) && (
|
<LayoutGroup key={currentWorkflow.id}>
|
||||||
<motion.div
|
<motion.div
|
||||||
key={0}
|
key="form"
|
||||||
initial={{ opacity: 0, y: -20 }}
|
initial={{ opacity: 0, y: -30 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
exit={{ opacity: 0, y: -20 }}
|
exit={{ opacity: 0, x: 60 }}
|
||||||
transition={{ duration: 0.3 }}
|
transition={{ duration: 0.20 }}
|
||||||
>
|
>
|
||||||
<Tip text="Please fill in workflow name and associated entity to start configuring workflow." />
|
{(!currentWorkflow.name || !currentWorkflow.entityId) && (
|
||||||
|
<Tip text="Please fill in workflow name and associated entity to start configuring workflow." />
|
||||||
|
)}
|
||||||
|
<WorkflowForm
|
||||||
|
workflow={currentWorkflow}
|
||||||
|
onWorkflowChange={onWorkflowChange}
|
||||||
|
entityTeachers={entityTeachers}
|
||||||
|
entityCorporates={entityCorporates}
|
||||||
|
/>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
)}
|
</LayoutGroup>
|
||||||
|
</AnimatePresence>
|
||||||
<motion.div
|
|
||||||
key={1}
|
|
||||||
initial={{ opacity: 0, y: -20 }}
|
|
||||||
animate={{ opacity: 1, y: 0 }}
|
|
||||||
exit={{ opacity: 0, y: -20 }}
|
|
||||||
transition={{ duration: 0.3 }}
|
|
||||||
>
|
|
||||||
<WorkflowForm
|
|
||||||
workflow={currentWorkflow}
|
|
||||||
onWorkflowChange={onWorkflowChange}
|
|
||||||
entityTeachers={entityTeachers}
|
|
||||||
entityCorporates={entityCorporates}
|
|
||||||
/>
|
|
||||||
</motion.div>
|
|
||||||
</LayoutGroup>
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Reference in New Issue
Block a user