Skip to content

Commit 5124751

Browse files
committed
smooth loading ui, fix upgrade button always visible
1 parent e162963 commit 5124751

File tree

2 files changed

+42
-30
lines changed

2 files changed

+42
-30
lines changed

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ export async function FernCliVersionDisplay({
2929
return (
3030
<div className="text-gray-1100 flex items-center gap-2">
3131
<FernIcon className="size-5" fill="fill-gray-800" /> {fernVersionInfo?.current}
32-
<UpgradeFernButton
33-
orgName={orgName}
34-
docsUrl={docsUrl}
35-
githubUrl={githubUrl}
36-
currentVersion={fernVersionInfo.current}
37-
latestVersion={fernVersionInfo.latest}
38-
baseBranch={baseBranch}
39-
existingPr={fernVersionInfo.existingPr}
40-
abbreviateText
41-
/>
32+
{fernVersionInfo?.needsUpgrade && (
33+
<UpgradeFernButton
34+
orgName={orgName}
35+
docsUrl={docsUrl}
36+
githubUrl={githubUrl}
37+
currentVersion={fernVersionInfo.current}
38+
latestVersion={fernVersionInfo.latest}
39+
baseBranch={baseBranch}
40+
existingPr={fernVersionInfo.existingPr}
41+
abbreviateText
42+
/>
43+
)}
4244
</div>
4345
);
4446
}

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

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import type { Auth0SessionData } from "@/app/services/auth0/getCurrentSession";
44
import type { GithubSourceRepo } from "@/app/services/github/types";
55
import Card from "@/components/ui/card";
66
import { useLocalBranches } from "@/hooks/useLocalBranches";
7+
import { useLocalBranchesForSite } from "@/hooks/useLocalBranchesForSite";
78
import type { DocsUrl } from "@/utils/types";
89
import { BranchList } from "../BranchList";
910
import { GoToEditorButton } from "../GoToEditorButton";
1011
import { VisualEditorEmptyCard } from "./VisualEditorEmptyCard";
1112
import { VisualEditorHeader } from "./VisualEditorHeader";
13+
import { VisualEditorLoadingCard } from "./VisualEditorLoadingCard";
1214

1315
export function VisualEditorSectionClient({
1416
maybeCriticalUpdateWarning,
@@ -21,28 +23,36 @@ export function VisualEditorSectionClient({
2123
docsUrl: DocsUrl;
2224
sourceRepo?: GithubSourceRepo;
2325
}) {
24-
const { userHasCreatedAnyBranch, loading } = useLocalBranches();
26+
const { loading } = useLocalBranches();
27+
const { filteredBranches } = useLocalBranchesForSite(docsUrl);
2528

26-
if (!userHasCreatedAnyBranch && !loading) {
27-
return (
28-
<VisualEditorEmptyCard>
29+
return (
30+
<>
31+
{loading ? (
32+
<VisualEditorLoadingCard />
33+
) : (
2934
<>
30-
{maybeCriticalUpdateWarning}
31-
<div className="flex flex-col gap-2 sm:flex-row">
32-
<GoToEditorButton docsUrl={docsUrl} session={session} />
33-
</div>
35+
{filteredBranches.length === 0 ? (
36+
<VisualEditorEmptyCard>
37+
<>
38+
{maybeCriticalUpdateWarning}
39+
<div className="flex flex-col gap-2 sm:flex-row">
40+
<GoToEditorButton docsUrl={docsUrl} session={session} />
41+
</div>
42+
</>
43+
</VisualEditorEmptyCard>
44+
) : (
45+
<Card className="flex flex-col">
46+
{maybeCriticalUpdateWarning}
47+
<div className="flex items-center justify-between">
48+
<VisualEditorHeader />
49+
<GoToEditorButton docsUrl={docsUrl} session={session} />
50+
</div>
51+
<BranchList docsUrl={docsUrl} sourceRepo={sourceRepo} />
52+
</Card>
53+
)}
3454
</>
35-
</VisualEditorEmptyCard>
36-
);
37-
}
38-
return (
39-
<Card className="flex flex-col">
40-
{maybeCriticalUpdateWarning}
41-
<div className="flex items-center justify-between">
42-
<VisualEditorHeader />
43-
<GoToEditorButton docsUrl={docsUrl} session={session} />
44-
</div>
45-
<BranchList docsUrl={docsUrl} sourceRepo={sourceRepo} />
46-
</Card>
55+
)}
56+
</>
4757
);
4858
}

0 commit comments

Comments
 (0)