code refactoring
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user