Skip to content

Commit

Permalink
Do not show CDKTF language switcher if there is no to switch
Browse files Browse the repository at this point in the history
Signed-off-by: Damian Stasik <[email protected]>
  • Loading branch information
damianstasik committed Sep 3, 2024
1 parent 3998286 commit 70c8ff2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
15 changes: 0 additions & 15 deletions frontend/src/components/LanguagePicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ function Language({ name, code }: LanguageProps) {
);
}

function LanguageSkeleton() {
return <span className="ml-2 flex h-10 w-24 animate-pulse bg-gray-500/25" />;
}

interface LanguagePickerProps {
languages: Array<{ name: string; code: string }>;
}
Expand All @@ -46,14 +42,3 @@ export function LanguagePicker({ languages }: LanguagePickerProps) {
</nav>
);
}

export function LanguagePickerSkeleton() {
return (
<nav className="flex items-center">
<span className="mr-2 text-gray-700 dark:text-gray-300">
Provider language
</span>
<LanguageSkeleton />
</nav>
);
}
14 changes: 3 additions & 11 deletions frontend/src/routes/Provider/components/VersionInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { OldVersionBanner } from "@/components/OldVersionBanner";
import {
LanguagePicker,
LanguagePickerSkeleton,
} from "@/components/LanguagePicker";
import { LanguagePicker } from "@/components/LanguagePicker";
import { VersionInfo, VersionInfoSkeleton } from "@/components/VersionInfo";
import { useSuspenseQueries } from "@tanstack/react-query";
import { getProviderDataQuery, getProviderVersionDataQuery } from "../query";
Expand Down Expand Up @@ -50,7 +47,7 @@ export function ProviderVersionInfo() {
<div className="flex flex-col gap-5">
<div className="flex items-center justify-between">
<VersionInfo currentVersion={version} latestVersion={latestVersion} />
<LanguagePicker languages={languages} />
{languages.length > 0 && <LanguagePicker languages={languages} />}
</div>
{version !== latestVersion && (
<OldVersionBanner latestVersionLink={latestVersionLink} />
Expand All @@ -60,10 +57,5 @@ export function ProviderVersionInfo() {
}

export function ProviderVersionInfoSkeleton() {
return (
<div className="flex items-center justify-between">
<VersionInfoSkeleton />
<LanguagePickerSkeleton />
</div>
);
return <VersionInfoSkeleton />;
}

0 comments on commit 70c8ff2

Please sign in to comment.