Skip to content

Commit 25006e0

Browse files
committed
clean up loading UIs
1 parent e6da352 commit 25006e0

File tree

5 files changed

+18
-22
lines changed

5 files changed

+18
-22
lines changed

packages/fern-dashboard/src/app/[orgName]/(homepage)/docs/[docsUrl]/loading.tsx

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

packages/fern-dashboard/src/app/[orgName]/(homepage)/docs/[docsUrl]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import getDocsSitesForOrg from "@/app/services/dal/fdr/getDocsSitesForOrg";
88
import { getDocsGithubUrl } from "@/app/services/dal/github/getDocsGithubUrl";
99
import { getAuthenticatedSessionOrRedirect } from "@/app/services/dal/organization";
1010
import { DocsSiteOverviewCard } from "@/components/docs-page/DocsSiteOverviewCard";
11-
import { VisualEditorEmptyCard } from "@/components/docs-page/visual-editor-section/VisualEditorEmptyCard";
11+
import { VisualEditorLoadingCard } from "@/components/docs-page/visual-editor-section/VisualEditorLoadingCard";
1212
import { VisualEditorSection } from "@/components/docs-page/visual-editor-section/VisualEditorSection";
1313
import { getDocsSiteUrl } from "@/utils/getDocsSiteUrl";
1414
import { parseDocsUrlParam } from "@/utils/parseDocsUrlParam";
@@ -43,7 +43,7 @@ export default async function Page(props: { params: Promise<{ orgName: Auth0OrgN
4343
return (
4444
<div className="flex w-full flex-col gap-4">
4545
<DocsSiteOverviewCard docsUrl={docsUrl} docsSite={currentDocsSite} orgName={orgName} />
46-
<Suspense fallback={null}>
46+
<Suspense fallback={<VisualEditorLoadingCard />}>
4747
<VisualEditorSection docsUrl={docsUrl} session={session} orgName={orgName} />
4848
</Suspense>
4949
</div>

packages/fern-dashboard/src/components/docs-page/BranchList.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function BranchList({ docsUrl, sourceRepo }: { docsUrl: DocsUrl; sourceRe
1515
const orgName = useOrgName();
1616
const router = useRouter();
1717

18-
const { deleteBranch } = useLocalBranches();
18+
const { deleteBranch, loading } = useLocalBranches();
1919
const { filteredBranches } = useLocalBranchesForSite(docsUrl);
2020

2121
// Pagination state
@@ -74,7 +74,9 @@ export function BranchList({ docsUrl, sourceRepo }: { docsUrl: DocsUrl; sourceRe
7474
</div>
7575
) : (
7676
<div className="py-8 text-center">
77-
<p className="dark:text-gray-1200 text-gray-500">No open sessions found</p>
77+
<p className="dark:text-gray-1200 text-gray-500">
78+
{loading ? "Loading..." : "No open sessions found"}
79+
</p>
7880
</div>
7981
)}
8082
</>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Card from "@/components/ui/card";
2+
import { Skeleton } from "@/components/ui/skeleton";
3+
4+
export function VisualEditorLoadingCard() {
5+
return (
6+
<Card className="flex flex-col">
7+
<Skeleton className="h-24" />
8+
</Card>
9+
);
10+
}

packages/fern-dashboard/src/components/docs-page/visual-editor-section/VisualEditorSectionClient.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use client";
22

33
import type { Auth0SessionData } from "@/app/services/auth0/getCurrentSession";
4-
import type { Auth0OrgName } from "@/app/services/auth0/types";
54
import type { GithubSourceRepo } from "@/app/services/github/types";
65
import Card from "@/components/ui/card";
76
import { useLocalBranches } from "@/hooks/useLocalBranches";
@@ -22,10 +21,9 @@ export function VisualEditorSectionClient({
2221
docsUrl: DocsUrl;
2322
sourceRepo?: GithubSourceRepo;
2423
}) {
25-
const { userHasCreatedAnyBranch } = useLocalBranches();
26-
console.log("userHasCreatedAnyBranch", userHasCreatedAnyBranch);
24+
const { userHasCreatedAnyBranch, loading } = useLocalBranches();
2725

28-
if (!userHasCreatedAnyBranch) {
26+
if (!userHasCreatedAnyBranch && !loading) {
2927
return (
3028
<VisualEditorEmptyCard>
3129
<>

0 commit comments

Comments
 (0)