Skip to content

Commit d27e015

Browse files
authored
Fix double breadcrumbs (#1346)
* fix double breadcrumbs on `/projects` error page * fix double breadcrumbs on `/projects` error page * format * move
1 parent 4e571f6 commit d27e015

File tree

8 files changed

+21
-27
lines changed

8 files changed

+21
-27
lines changed

.changeset/stale-pugs-rhyme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@inkeep/agents-manage-ui": patch
3+
---
4+
5+
fix double breadcrumbs on `/projects` error page

agents-manage-ui/src/app/[tenantId]/projects/(index)/layout.tsx

Lines changed: 0 additions & 5 deletions
This file was deleted.

agents-manage-ui/src/app/[tenantId]/projects/(index)/loading.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

agents-manage-ui/src/app/[tenantId]/projects/[projectId]/loading.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BodyTemplate } from '@/components/layout/body-template';
2-
import BaseSkeleton from '../(index)/loading';
2+
import { Skeleton } from '@/components/ui/skeleton';
33

44
/**
55
* Base loading skeleton for this route segment.
@@ -11,7 +11,13 @@ import BaseSkeleton from '../(index)/loading';
1111
export default function Loading() {
1212
return (
1313
<BodyTemplate breadcrumbs={[]}>
14-
<BaseSkeleton />
14+
<Skeleton className="h-7 mb-2" style={{ width: 70 }} />
15+
<Skeleton className="h-5 mb-8" style={{ width: 420 }} />
16+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3 md:gap-4">
17+
{Array.from({ length: 6 }).map((_, i) => (
18+
<Skeleton key={i} className="h-36 w-full rounded-lg" />
19+
))}
20+
</div>
1521
</BodyTemplate>
1622
);
1723
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './[projectId]/loading';

agents-manage-ui/src/app/[tenantId]/projects/(index)/page.tsx renamed to agents-manage-ui/src/app/[tenantId]/projects/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Plus } from 'lucide-react';
22
import FullPageError from '@/components/errors/full-page-error';
3+
import { BodyTemplate } from '@/components/layout/body-template';
34
import EmptyState from '@/components/layout/empty-state';
45
import { PageHeader } from '@/components/layout/page-header';
56
import { NewProjectDialog } from '@/components/projects/new-project-dialog';
@@ -14,7 +15,7 @@ async function ProjectsPage({ params }: PageProps<'/[tenantId]/projects'>) {
1415

1516
try {
1617
const projects = await fetchProjects(tenantId);
17-
return projects.data.length > 0 ? (
18+
const content = projects.data.length ? (
1819
<>
1920
<PageHeader
2021
title="Projects"
@@ -44,6 +45,7 @@ async function ProjectsPage({ params }: PageProps<'/[tenantId]/projects'>) {
4445
}
4546
/>
4647
);
48+
return <BodyTemplate breadcrumbs={[]}>{content}</BodyTemplate>;
4749
} catch (error) {
4850
return <FullPageError errorCode={getErrorCode(error)} context="projects" />;
4951
}

agents-manage-ui/src/app/[tenantId]/settings/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BodyTemplate } from '@/components/layout/body-template';
22
import { PageHeader } from '@/components/layout/page-header';
33

4-
export default function Layout({ children }: LayoutProps<'/[tenantId]/projects'>) {
4+
export default function Layout({ children }: LayoutProps<'/[tenantId]/settings'>) {
55
return (
66
<BodyTemplate breadcrumbs={['Settings']}>
77
<PageHeader title="Organization Settings" description="Manage your organization settings" />

agents-manage-ui/src/components/ui/breadcrumbs.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ export function Breadcrumbs({ items }: BreadcrumbsProps) {
5555
<ol className="flex items-center gap-2">
5656
{allItems.map((label, idx, arr) => {
5757
const isLast = idx === arr.length - 1;
58-
const item: { label: string; href?: string } =
59-
typeof label === 'string' ? { label } : label;
58+
const item = typeof label === 'string' ? { label } : label;
59+
6060
return (
6161
<li
6262
key={`${item.label}-${idx}`}
@@ -65,7 +65,7 @@ export function Breadcrumbs({ items }: BreadcrumbsProps) {
6565
!isLast && 'after:content-["›"] after:text-muted-foreground/60'
6666
)}
6767
>
68-
{item.href && !isLast ? (
68+
{'href' in item && !isLast ? (
6969
<Link href={item.href} className="hover:text-foreground">
7070
{item.label}
7171
</Link>

0 commit comments

Comments
 (0)