Fix animations

This commit is contained in:
Joao Correia
2025-01-25 15:10:52 +00:00
parent 2eff08bf86
commit 2c0153e055
4 changed files with 29 additions and 36 deletions

View File

@@ -13,7 +13,7 @@ import { requestUser } from "@/utils/api";
import { getEntities } from "@/utils/entities.be";
import { shouldRedirectHome } from "@/utils/navigation.disabled";
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 Head from "next/head";
import Link from "next/link";
@@ -251,34 +251,27 @@ export default function Home({ user, userEntitiesWithLabel, userEntitiesTeachers
</Button>
</div>
<LayoutGroup>
{(!currentWorkflow.name || !currentWorkflow.entityId) && (
<AnimatePresence mode="wait">
<LayoutGroup key={currentWorkflow.id}>
<motion.div
key={0}
initial={{ opacity: 0, y: -20 }}
key="form"
initial={{ opacity: 0, y: -30 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -20 }}
transition={{ duration: 0.3 }}
exit={{ opacity: 0, x: 60 }}
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
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>
</LayoutGroup>
</AnimatePresence>
</>
)}
</form>