From 7d3ddade0ccdee3af5e4f3d26df7cacd16c2ffdf Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Mon, 15 Apr 2024 09:23:12 +0800 Subject: [PATCH 1/4] add the latest LTS entry for the archive website --- locale/en/translation.json | 1 + locale/ja/translation.json | 1 + locale/zh/translation.json | 1 + src/components/Dropdown/VersionSelect.tsx | 48 +++++++++++++++++++++++ src/static/index.ts | 2 + 5 files changed, 53 insertions(+) diff --git a/locale/en/translation.json b/locale/en/translation.json index 2bf4850ab..2eacd9dd8 100644 --- a/locale/en/translation.json +++ b/locale/en/translation.json @@ -20,6 +20,7 @@ "home": "Home", "archive-home": "Archived Docs Home", "archive-label": "Archived Docs", + "lts-label": "Latest LTS Docs", "tidb": "TiDB", "tools": "Tools", "cloud": "TiDB Cloud", diff --git a/locale/ja/translation.json b/locale/ja/translation.json index b503d6f21..76b8b7ae7 100644 --- a/locale/ja/translation.json +++ b/locale/ja/translation.json @@ -21,6 +21,7 @@ "home": "Home", "archive-home": "Archived Docs Home", "archive-label": "Archived Docs", + "lts-label": "Latest LTS Docs", "tidb": "TiDB", "tools": "ツール", "cloud": "TiDB Cloud", diff --git a/locale/zh/translation.json b/locale/zh/translation.json index 8bd589154..bd4a434ce 100644 --- a/locale/zh/translation.json +++ b/locale/zh/translation.json @@ -18,6 +18,7 @@ "home": "文档中心", "archive-home": "归档文档中心", "archive-label": "归档文档", + "lts-label": "最新 LTS 文档", "tidb": "TiDB", "tools": "生态工具", "appdev": "开发指南", diff --git a/src/components/Dropdown/VersionSelect.tsx b/src/components/Dropdown/VersionSelect.tsx index 8dd8fc903..9ab9a1771 100644 --- a/src/components/Dropdown/VersionSelect.tsx +++ b/src/components/Dropdown/VersionSelect.tsx @@ -295,6 +295,26 @@ const VersionItemsArchived = (props: { ))} + + + {t("navbar.archive-label")} + + ); }; @@ -488,3 +508,31 @@ function generateArchivedWebsiteUrlByLangAndType(lang?: string, type?: string) { return url; } + +function generateLTSWebsiteUrlByLangAndType(lang?: string, type?: string) { + let url = LTS_WEBSITE_URL; + + switch (lang) { + case "zh": + url = `${LTS_WEBSITE_URL}/zh`; + break; + case "jp": + url = `${LTS__WEBSITE_URL}/jp`; + break; + default: + break; + } + switch (type) { + case "tidb-in-kubernetes": + url = `${url}/tidb-in-kubernetes/stable`; + break; + case "tidb-data-migration": + url = `${url}/tidb/stable/dm-overview`; + break; + default: + url = `${url}/tidb/stable`; + break; + } + + return url; +} diff --git a/src/static/index.ts b/src/static/index.ts index 8b3cdc6a3..b18326c7e 100644 --- a/src/static/index.ts +++ b/src/static/index.ts @@ -539,3 +539,5 @@ export const ZH_DOC_TYPE_LIST = [ ]; export const ARCHIVE_WEBSITE_URL = "https://docs-archive.pingcap.com"; + +export const LTS_WEBSITE_URL = "https://docs.pingcap.com"; From 5dfb91c21e72065e93c829ff6eafa6206b381dee Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Mon, 15 Apr 2024 15:27:06 +0800 Subject: [PATCH 2/4] Update src/components/Dropdown/VersionSelect.tsx --- src/components/Dropdown/VersionSelect.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Dropdown/VersionSelect.tsx b/src/components/Dropdown/VersionSelect.tsx index 9ab9a1771..d5c03dfb4 100644 --- a/src/components/Dropdown/VersionSelect.tsx +++ b/src/components/Dropdown/VersionSelect.tsx @@ -312,7 +312,7 @@ const VersionItemsArchived = (props: { cursor: "pointer", }} > - {t("navbar.archive-label")} + {t("navbar.lts-label")} From 738e2cc420339590a32480dc3de1e1c510103f9f Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 16 Apr 2024 16:45:21 +0800 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Yuiham --- locale/en/translation.json | 2 +- locale/ja/translation.json | 2 +- locale/zh/translation.json | 2 +- src/components/Dropdown/VersionSelect.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/en/translation.json b/locale/en/translation.json index 2eacd9dd8..d2082ad00 100644 --- a/locale/en/translation.json +++ b/locale/en/translation.json @@ -20,7 +20,7 @@ "home": "Home", "archive-home": "Archived Docs Home", "archive-label": "Archived Docs", - "lts-label": "Latest LTS Docs", + "ltsLabel": "Latest LTS Docs", "tidb": "TiDB", "tools": "Tools", "cloud": "TiDB Cloud", diff --git a/locale/ja/translation.json b/locale/ja/translation.json index 76b8b7ae7..a31b2caf3 100644 --- a/locale/ja/translation.json +++ b/locale/ja/translation.json @@ -21,7 +21,7 @@ "home": "Home", "archive-home": "Archived Docs Home", "archive-label": "Archived Docs", - "lts-label": "Latest LTS Docs", + "ltsLabel": "Latest LTS Docs", "tidb": "TiDB", "tools": "ツール", "cloud": "TiDB Cloud", diff --git a/locale/zh/translation.json b/locale/zh/translation.json index bd4a434ce..5863b76ba 100644 --- a/locale/zh/translation.json +++ b/locale/zh/translation.json @@ -18,7 +18,7 @@ "home": "文档中心", "archive-home": "归档文档中心", "archive-label": "归档文档", - "lts-label": "最新 LTS 文档", + "ltsLabel": "最新 LTS 文档", "tidb": "TiDB", "tools": "生态工具", "appdev": "开发指南", diff --git a/src/components/Dropdown/VersionSelect.tsx b/src/components/Dropdown/VersionSelect.tsx index d5c03dfb4..248bb3f1e 100644 --- a/src/components/Dropdown/VersionSelect.tsx +++ b/src/components/Dropdown/VersionSelect.tsx @@ -312,7 +312,7 @@ const VersionItemsArchived = (props: { cursor: "pointer", }} > - {t("navbar.lts-label")} + {t("navbar.ltsLabel")} From 89a86296c70f215433f91188aff7d8ce87f8666b Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 16 Apr 2024 17:24:35 +0800 Subject: [PATCH 4/4] Update VersionSelect.tsx --- src/components/Dropdown/VersionSelect.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Dropdown/VersionSelect.tsx b/src/components/Dropdown/VersionSelect.tsx index 248bb3f1e..22e9ce64f 100644 --- a/src/components/Dropdown/VersionSelect.tsx +++ b/src/components/Dropdown/VersionSelect.tsx @@ -16,6 +16,7 @@ import ChevronRightIcon from "@mui/icons-material/ChevronRight"; import { PathConfig, BuildType } from "static/Type"; import { ARCHIVE_WEBSITE_URL } from "static"; +import { LTS_WEBSITE_URL } from "static"; import { AllVersion } from "utils"; import CONFIG from "../../../docs/docs.json"; import LinkComponent from "components/Link";