code refactoring

This commit is contained in:
Joao Correia
2025-01-23 22:12:25 +00:00
parent a4f60455b5
commit c921d54d50
3 changed files with 55 additions and 54 deletions

View File

@@ -118,7 +118,7 @@ export default function Home({ user, userEntitiesWithLabel, userEntitiesTeachers
setWorkflows(prev => prev.filter(wf => wf.id !== id));
if (selectedWorkflowId === id) {
setSelectedWorkflowId(undefined);
workflows.length > 0 ? setSelectedWorkflowId(workflows[0].id) : setSelectedWorkflowId(undefined);
}
};
@@ -159,6 +159,8 @@ export default function Home({ user, userEntitiesWithLabel, userEntitiesTeachers
Add New Workflow
</Button>
{workflows.length !== 0 && <div className="bg-gray-300 w-[1px]"></div>}
<div className="flex flex-wrap gap-2">
{workflows.map((workflow) => (
<Button
@@ -172,7 +174,7 @@ export default function Home({ user, userEntitiesWithLabel, userEntitiesTeachers
onClick={() => handleSelectWorkflow(workflow.id)}
className="min-w-fit text-lg font-medium flex items-center gap-2 text-left"
>
{workflow.name.trim() === "" ? "New Workflow" : workflow.name}
{workflow.name.trim() === "" ? "Workflow" : workflow.name}
</Button>
))}
@@ -213,7 +215,7 @@ export default function Home({ user, userEntitiesWithLabel, userEntitiesTeachers
placeholder="Entity..."
/>
<Button
color="purple"
color="red"
variant="solid"
onClick={() => handleDeleteWorkflow(currentWorkflow.id)}
type="button"