Skip to content
Draft
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
43 changes: 30 additions & 13 deletions agents-manage-ui/src/app/[tenantId]/projects/(index)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plus } from 'lucide-react';
import { PartyPopper, Plus } from 'lucide-react';
import FullPageError from '@/components/errors/full-page-error';
import EmptyState from '@/components/layout/empty-state';
import { PageHeader } from '@/components/layout/page-header';
Expand All @@ -9,13 +9,27 @@ import { emptyStateProjectDescription, projectDescription } from '@/constants/pa
import { fetchProjects } from '@/lib/api/projects';
import { getErrorCode } from '@/lib/utils/error-serialization';

function PreviewBranchBanner() {
return (
<div className="mb-6 flex items-center gap-3 rounded-lg border border-green-500/50 bg-green-500/10 p-4">
<PartyPopper className="h-6 w-6 text-green-500" />
<div>
<h3 className="font-semibold text-green-500">
🎉 Congrats, you made it to my preview branch!
</h3>
</div>
</div>
);
}

async function ProjectsPage({ params }: PageProps<'/[tenantId]/projects'>) {
const { tenantId } = await params;

try {
const projects = await fetchProjects(tenantId);
return projects.data.length > 0 ? (
<>
<PreviewBranchBanner />
<PageHeader
title="Projects"
description={projectDescription}
Expand All @@ -31,18 +45,21 @@ async function ProjectsPage({ params }: PageProps<'/[tenantId]/projects'>) {
<ProjectList tenantId={tenantId} projects={projects.data} />
</>
) : (
<EmptyState
title="No projects yet."
description={emptyStateProjectDescription}
action={
<NewProjectDialog tenantId={tenantId}>
<Button size="lg">
<Plus />
Create your first project
</Button>
</NewProjectDialog>
}
/>
<>
<PreviewBranchBanner />
<EmptyState
title="No projects yet."
description={emptyStateProjectDescription}
action={
<NewProjectDialog tenantId={tenantId}>
<Button size="lg">
<Plus />
Create your first project
</Button>
</NewProjectDialog>
}
/>
</>
);
} catch (error) {
return <FullPageError errorCode={getErrorCode(error)} context="projects" />;
Expand Down