Skip to content

Commit 9254626

Browse files
committed
If you have an org with no projects, it displays in the project dropdown with a “New project” button
1 parent da69fa0 commit 9254626

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

apps/webapp/app/components/navigation/SideMenu.tsx

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -357,23 +357,31 @@ function ProjectSelector({
357357
<Fragment key={organization.id}>
358358
<PopoverSectionHeader title={organization.title} />
359359
<div className="flex flex-col gap-1 p-1">
360-
{organization.projects.map((p) => {
361-
const isSelected = p.id === project.id;
362-
return (
363-
<PopoverMenuItem
364-
key={p.id}
365-
to={projectPath(organization, p)}
366-
title={
367-
<div className="flex w-full items-center justify-between text-bright">
368-
<span className="grow truncate text-left">{p.name}</span>
369-
<MenuCount count={p.jobCount} />
370-
</div>
371-
}
372-
isSelected={isSelected}
373-
icon="folder"
374-
/>
375-
);
376-
})}
360+
{organization.projects.length > 0 ? (
361+
organization.projects.map((p) => {
362+
const isSelected = p.id === project.id;
363+
return (
364+
<PopoverMenuItem
365+
key={p.id}
366+
to={projectPath(organization, p)}
367+
title={
368+
<div className="flex w-full items-center justify-between text-bright">
369+
<span className="grow truncate text-left">{p.name}</span>
370+
<MenuCount count={p.jobCount} />
371+
</div>
372+
}
373+
isSelected={isSelected}
374+
icon="folder"
375+
/>
376+
);
377+
})
378+
) : (
379+
<PopoverMenuItem
380+
to={newProjectPath(organization)}
381+
title="New project"
382+
icon="plus"
383+
/>
384+
)}
377385
</div>
378386
</Fragment>
379387
))}

0 commit comments

Comments
 (0)