Skip to content

Commit

Permalink
Don't show section title if no proper workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
hverlind committed Oct 20, 2023
1 parent 78fc1e1 commit 75ef7eb
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions components/projects/moveProjectPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<PopupContent className='p-4 min-w-[340px]'>
Expand Down Expand Up @@ -70,18 +70,16 @@ export default function MoveProjectPopup({
checked={project.workspaceID === userWorkspace.id}
/>
)}
{allWorkspaces.length > 0 && <PopupSectionTitle>Workspaces</PopupSectionTitle>}
{allWorkspaces
.filter(workspace => workspace.id !== user.id)
.map((workspace, index) => (
<PopupLabelItem
key={index}
label={workspace.name}
icon={folderIcon}
onClick={withDismiss(() => moveToWorkspace(workspace.id))}
checked={project.workspaceID === workspace.id}
/>
))}
{properWorkspaces.length > 0 && <PopupSectionTitle>Workspaces</PopupSectionTitle>}
{properWorkspaces.map((workspace, index) => (
<PopupLabelItem
key={index}
label={workspace.name}
icon={folderIcon}
onClick={withDismiss(() => moveToWorkspace(workspace.id))}
checked={project.workspaceID === workspace.id}
/>
))}
<PopupSectionDivider />
<PopupLabelItem label='Add new Workspace' icon={addIcon} onClick={() => setNewWorkspaceName('')} />{' '}
</>
Expand Down

0 comments on commit 75ef7eb

Please sign in to comment.