Skip to content

Commit

Permalink
add the latest LTS entry for the archive website
Browse files Browse the repository at this point in the history
  • Loading branch information
qiancai committed Apr 15, 2024
1 parent b7ea268 commit 7d3ddad
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions locale/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions locale/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions locale/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"home": "文档中心",
"archive-home": "归档文档中心",
"archive-label": "归档文档",
"lts-label": "最新 LTS 文档",
"tidb": "TiDB",
"tools": "生态工具",
"appdev": "开发指南",
Expand Down
48 changes: 48 additions & 0 deletions src/components/Dropdown/VersionSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,26 @@ const VersionItemsArchived = (props: {
</LinkComponent>
</MenuItem>
))}
<LinkComponent
isI18n
to={generateLTSWebsiteUrlByLangAndType(language, pathConfig.repo)}
style={{
width: "100%",
color: "#666666",
}}
>
<FormLabel
sx={{
fontSize: "0.875rem",
lineHeight: "1.25rem",
fontWeight: "bold",
pl: "0.5rem",
cursor: "pointer",
}}
>
{t("navbar.archive-label")}
</FormLabel>
</LinkComponent>
</>
);
};
Expand Down Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions src/static/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

0 comments on commit 7d3ddad

Please sign in to comment.