Skip to content

Commit fde3e01

Browse files
committed
tweak: archive banner
1 parent e94e211 commit fde3e01

File tree

5 files changed

+42
-20
lines changed

5 files changed

+42
-20
lines changed

locale/en/translation.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,16 @@
167167
"success": "Thank you! You will be notified when a new TiDB LTS release comes out."
168168
},
169169
"banner": {
170-
"link": "https://labs.tidb.io/?utm_source=docs&utm_medium=direct&utm_campaign=labs_lp_05",
171-
"title": "Explore the new TiDB Labs, learn distributed SQL database and build RAG apps directly from your browser.",
172-
"date": "",
173-
"intro": ""
170+
"archive": {
171+
"title": "You are viewing the archived documentation of TiDB, which no longer receives updates.",
172+
"viewLatestLTSVersion": "View latest LTS version docs"
173+
},
174+
"campaign": {
175+
"link": "https://labs.tidb.io/?utm_source=docs&utm_medium=direct&utm_campaign=labs_lp_05",
176+
"title": "Explore the new TiDB Labs, learn distributed SQL database and build RAG apps directly from your browser.",
177+
"date": "",
178+
"intro": ""
179+
}
174180
},
175181
"campaign": {
176182
"docSurvey": {

locale/ja/translation.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,16 @@
151151
"goToFeedback": "このページは役に立ちましたか?"
152152
},
153153
"banner": {
154-
"link": "https://labs.tidb.io/ja?utm_source=docs&utm_medium=direct&utm_campaign=labs_lp_05",
155-
"title": "新しい TiDB Labs を探索し、ブラウザから直接分散型 SQL データベースを学び、RAG アプリを構築しましょう。",
156-
"date": "",
157-
"intro": ""
154+
"archive": {
155+
"title": "これはアーカイブされた TiDB のドキュメントであり、更新は行われていません。",
156+
"viewLatestLTSVersion": "最新の LTS バージョンのドキュメントを表示する"
157+
},
158+
"campaign": {
159+
"link": "https://labs.tidb.io/ja?utm_source=docs&utm_medium=direct&utm_campaign=labs_lp_05",
160+
"title": "新しい TiDB Labs を探索し、ブラウザから直接分散型 SQL データベースを学び、RAG アプリを構築しましょう。",
161+
"date": "",
162+
"intro": ""
163+
}
158164
},
159165
"campaign": {
160166
"docSurvey": {

locale/zh/translation.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,16 @@
164164
"success": "感谢订阅!当新的 LTS 版本发布时,我们会通过邮件通知您。"
165165
},
166166
"banner": {
167-
"link": "https://labs.pingcap.com/?utm_source=docs&utm_medium=direct&utm_campaign=labs_zh_lp_04",
168-
"title": "探索全新的 TiDB Labs,直接在浏览器中学习分布式 SQL 数据库并构建 RAG 应用。",
169-
"date": "",
170-
"intro": ""
167+
"archive": {
168+
"title": "你正在查看已归档的 TiDB 文档,该文档不再更新。",
169+
"viewLatestLTSVersion": "查看最新 LTS 版本文档"
170+
},
171+
"campaign": {
172+
"link": "https://labs.pingcap.com/?utm_source=docs&utm_medium=direct&utm_campaign=labs_zh_lp_04",
173+
"title": "探索全新的 TiDB Labs,直接在浏览器中学习分布式 SQL 数据库并构建 RAG 应用。",
174+
"date": "",
175+
"intro": ""
176+
}
171177
},
172178
"campaign": {
173179
"docSurvey": {

src/components/Layout/Banner/ArchiveBanner.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
import { ErrorOutlineOutlined, OpenInNewOutlined } from "@mui/icons-material";
2-
import { Box, Icon, Stack, Typography } from "@mui/material";
2+
import { Box, Stack, Typography } from "@mui/material";
33
import LinkComponent from "components/Link";
4-
import { PathConfig } from "shared/interface";
4+
import { Locale, PathConfig } from "shared/interface";
55
import { generateUrl } from "shared/utils";
6-
6+
import { useTranslation } from "react-i18next";
77
interface ArchiveBannerProps {
88
name?: string;
99
pathConfig?: PathConfig;
1010
}
1111

1212
export function ArchiveBanner({ name, pathConfig }: ArchiveBannerProps) {
13-
let targetUrl = `https://docs.pingcap.com`;
13+
const { t } = useTranslation();
14+
let targetUrl = "";
1415
if (name && pathConfig) {
1516
const stableCfg = { ...pathConfig, version: "stable" };
1617
const path = generateUrl(name, stableCfg);
1718
targetUrl = `https://docs.pingcap.com${path}`;
19+
} else {
20+
const lang =
21+
pathConfig?.locale === Locale.en ? "" : `/${pathConfig?.locale}`;
22+
targetUrl = `https://docs.pingcap.com${lang}/tidb/stable`;
1823
}
1924

2025
return (
@@ -48,8 +53,7 @@ export function ArchiveBanner({ name, pathConfig }: ArchiveBannerProps) {
4853
<ErrorOutlineOutlined sx={{ fontSize: "1rem", color: "#F2AA18" }} />
4954

5055
<Typography component="span" variant="body2" color="inherit">
51-
You are viewing the archived documentation of TiDB, which no longer
52-
receives updates.
56+
{t("banner.archive.title")}
5357
</Typography>
5458

5559
<LinkComponent
@@ -62,7 +66,7 @@ export function ArchiveBanner({ name, pathConfig }: ArchiveBannerProps) {
6266
>
6367
<Stack direction="row" alignItems="center" spacing="4px">
6468
<Typography variant="body2" color="secondary">
65-
View latest LTS version docs
69+
{t("banner.archive.viewLatestLTSVersion")}
6670
</Typography>
6771
<OpenInNewOutlined
6872
sx={{

src/components/Layout/Banner/Banner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function Banner() {
4343
// ["title", "date", "intro"],
4444
["title"],
4545
"link",
46-
"banner"
46+
"banner.campaign"
4747
);
4848

4949
return (

0 commit comments

Comments
 (0)