Skip to content

Commit 18f7590

Browse files
authored
feat: add translation status display switcher (#298)
1 parent 0783a3c commit 18f7590

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

website/src/components/templates/BaseTemplate.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { html } from "hono/html";
22
import type { FC, PropsWithChildren } from "hono/jsx";
3-
import { basePath, originUrl, typstOfficialDocsUrl } from "../../metadata";
3+
import {
4+
basePath,
5+
displayTranslationStatus,
6+
originUrl,
7+
typstOfficialDocsUrl,
8+
} from "../../metadata";
49
import { Translation, translation } from "../../translation/";
510
import type { Page } from "../../types/model";
611
import { joinPath, shiftBase } from "../../utils/path";
@@ -208,7 +213,10 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
208213
<Breadcrumbs path={path} />
209214

210215
<div class="flex flex-col gap-2 my-4">
211-
<TranslationStatusAlert status={translationStatus} />
216+
{(displayTranslationStatus ||
217+
translationStatus === "community") && (
218+
<TranslationStatusAlert status={translationStatus} />
219+
)}
212220
</div>
213221

214222
{translationStatus !== "community" && (

website/src/components/ui/common/Header.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
discordServerUrl,
3+
displayTranslationStatus,
34
githubRepositoryUrl,
45
typstOfficialDocsUrl,
56
typstOfficialUrl,
@@ -57,7 +58,7 @@ export const Header = () => {
5758
<div class="flex items-center gap-2 flex-shrink-0">
5859
<SiteTitle />
5960
<VersionBadge />
60-
<TranslationCoverageBadge />
61+
{displayTranslationStatus && <TranslationCoverageBadge />}
6162
</div>
6263

6364
<div class="xl:absolute xl:left-1/2 xl:transform xl:-translate-x-1/2">
@@ -128,9 +129,11 @@ export const Header = () => {
128129
<SiteTitle />
129130
<VersionBadge />
130131
</div>
131-
<div>
132-
<TranslationCoverageBadge />
133-
</div>
132+
{displayTranslationStatus && (
133+
<div>
134+
<TranslationCoverageBadge />
135+
</div>
136+
)}
134137
</div>
135138
<div class="flex items-center gap-2 flex-shrink-0 self-center">
136139
<button

website/src/metadata.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ export const discordServerUrl = "https://discord.gg/9xF7k4aAuH";
1818
export const originUrl = "https://typst-jp.github.io/";
1919
/** The base public path for deployment. This must match the value used in typst-docs. */
2020
export const basePath: "/" | `/${string}/` = "/docs/";
21+
/** Indicates whether to display the translation status on the site. Community content is always displayed. */
22+
export const displayTranslationStatus: boolean = true;

0 commit comments

Comments
 (0)