From 75ef7ebce0f81d7ddcaef13cad2743bc89403879 Mon Sep 17 00:00:00 2001 From: Hannes Verlinde Date: Fri, 20 Oct 2023 12:14:26 +0100 Subject: [PATCH] Don't show section title if no proper workspaces --- components/projects/moveProjectPopup.tsx | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/components/projects/moveProjectPopup.tsx b/components/projects/moveProjectPopup.tsx index ed88088fa..9a03d3005 100644 --- a/components/projects/moveProjectPopup.tsx +++ b/components/projects/moveProjectPopup.tsx @@ -36,7 +36,7 @@ export default function MoveProjectPopup({ }) const onLoadTextInput = useCallback((node: HTMLInputElement | null) => node?.focus(), []) - const allWorkspaces = [...workspaces, ...addedWorkspaces] + const properWorkspaces = [...workspaces, ...addedWorkspaces].filter(workspace => workspace.id !== user.id) return ( @@ -70,18 +70,16 @@ export default function MoveProjectPopup({ checked={project.workspaceID === userWorkspace.id} /> )} - {allWorkspaces.length > 0 && Workspaces} - {allWorkspaces - .filter(workspace => workspace.id !== user.id) - .map((workspace, index) => ( - moveToWorkspace(workspace.id))} - checked={project.workspaceID === workspace.id} - /> - ))} + {properWorkspaces.length > 0 && Workspaces} + {properWorkspaces.map((workspace, index) => ( + moveToWorkspace(workspace.id))} + checked={project.workspaceID === workspace.id} + /> + ))} setNewWorkspaceName('')} />{' '}