Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
import { Spinner } from "@diffkit/ui/components/spinner";

/**
* Pending component used for routes rendered inside the dashboard card
* (`DashboardLayout`). The `h-full` chain resolves against the card so the
* spinner stays visually centered within the content area.
*
* For top-level pending fallbacks where the parent is just `<body>` (e.g.
* when `_protected` itself is reloading), use `DashboardViewportLoading`
* instead — `h-full` there collapses to content height and pins the spinner
* to the top of the viewport.
*/

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all these unnecessary comments

export function DashboardContentLoading() {
return (
<div className="flex h-full items-center justify-center">
<Spinner size={20} className="text-muted-foreground" />
</div>
);
}

/**
* Full-viewport pending component. Use for route pending states that render
* directly inside the document body (where no ancestor provides a resolved
* height). Keeps the spinner centered regardless of how little content the
* layout has yet rendered.
*/

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

export function DashboardViewportLoading() {
return (
<div className="flex min-h-dvh items-center justify-center bg-background">
<Spinner size={20} className="text-muted-foreground" />
</div>
);
}
17 changes: 15 additions & 2 deletions apps/dashboard/src/components/repo/repository-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,21 @@ export const RepositoryRow = memo(function RepositoryRow({
>
<div className="flex min-w-0 flex-col gap-0.5">
<div className="flex min-w-0 max-w-full items-center gap-x-2">
<p className="min-w-0 truncate text-sm font-medium">
{repo.fullName}
{/*
* Split owner/name so a long owner login doesn't consume all the
* space and hide the repo name. The owner takes flexible space and
* truncates first; the repo name stays readable at its natural
* size. See diffkit#154.
*/}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

<p
className="flex min-w-0 items-baseline text-sm font-medium"
title={repo.fullName}
>
<span className="min-w-0 flex-1 truncate text-muted-foreground">
{repo.owner}
</span>
<span className="shrink-0 text-muted-foreground">/</span>
<span className="shrink-0 truncate">{repo.name}</span>
</p>
<VisibilityBadge visibility={repo.visibility} />
</div>
Expand Down
2 changes: 2 additions & 0 deletions apps/dashboard/src/routes/_protected.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
import { DashboardViewportLoading } from "#/components/layouts/dashboard-content-loading";
import { DashboardLayout } from "#/components/layouts/dashboard-layout";
import { ErrorScreen } from "#/components/layouts/error-screen";
import { getSession } from "#/lib/auth.functions";
Expand Down Expand Up @@ -67,5 +68,6 @@ export const Route = createFileRoute("/_protected")({
});
},
component: DashboardLayout,
pendingComponent: DashboardViewportLoading,
errorComponent: ErrorScreen,
});
Loading