Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion desktop/src/features/projects/ui/ProjectCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,13 @@ function StatusPill({ status }: { status: string }) {
);
}

export function EmptyState() {
export function EmptyState({
onCreateProject,
isCreating,
}: {
onCreateProject?: () => void;
isCreating?: boolean;
}) {
return (
<div className="flex flex-1 flex-col items-center justify-center gap-3 px-4 py-16 text-center">
<FolderGit2 className="h-10 w-10 text-muted-foreground/40" />
Expand All @@ -273,6 +279,17 @@ export function EmptyState() {
Projects published to this relay will appear here.
</p>
</div>
{onCreateProject ? (
<Button
disabled={isCreating}
onClick={onCreateProject}
size="sm"
type="button"
>
<FolderGit2 className="h-4 w-4" />
New Project
</Button>
) : null}
</div>
);
}
Expand Down
20 changes: 19 additions & 1 deletion desktop/src/features/projects/ui/ProjectsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,25 @@ export function ProjectsView() {
}

if (projects.length === 0) {
return <EmptyState />;
return (
<>
<CreateProjectDialog
isCreating={createProjectMutation.isPending}
onCreate={async (input) => {
const project = await createProjectMutation.mutateAsync(input);
toast.success(`Project "${project.name}" created.`);
handleRepositoryScopeChange("all");
handleFilterChange("repositories");
}}
onOpenChange={setCreateProjectOpen}
open={createProjectOpen}
/>
<EmptyState
isCreating={createProjectMutation.isPending}
onCreateProject={() => setCreateProjectOpen(true)}
/>
</>
);
}

const repositoryItems =
Expand Down