From adee173b336a78b9ccdeffae9668c8d0c641c436 Mon Sep 17 00:00:00 2001 From: SeeLey Wang Date: Tue, 1 Oct 2024 19:34:48 +0800 Subject: [PATCH 1/2] add description for seo --- zbook_frontend/messages/de.json | 1 + zbook_frontend/messages/en.json | 1 + zbook_frontend/messages/zh.json | 1 + zbook_frontend/src/app/[locale]/auth/forget/page.tsx | 1 + zbook_frontend/src/app/[locale]/auth/login/page.tsx | 1 + zbook_frontend/src/app/[locale]/auth/register/page.tsx | 1 + zbook_frontend/src/app/[locale]/cases/page.tsx | 1 + zbook_frontend/src/app/[locale]/layout.tsx | 1 + .../workspace/[username]/(dashboards)/comments/page.tsx | 2 ++ .../workspace/[username]/(dashboards)/dashboard/page.tsx | 2 ++ .../workspace/[username]/(dashboards)/favorite/page.tsx | 1 + .../workspace/[username]/(dashboards)/follower/page.tsx | 1 + .../workspace/[username]/(dashboards)/following/page.tsx | 1 + .../src/app/[locale]/workspace/[username]/(dashboards)/page.tsx | 1 + .../[locale]/workspace/[username]/(dashboards)/reports/page.tsx | 1 + .../[locale]/workspace/[username]/(dashboards)/repos/page.tsx | 1 + .../workspace/[username]/(dashboards)/sessions/page.tsx | 2 ++ .../[locale]/workspace/[username]/(dashboards)/users/page.tsx | 1 + .../[username]/(repos)/o/[reponame]/[...href]/page.tsx | 1 + .../workspace/[username]/(repos)/o/[reponame]/~visi/page.tsx | 2 ++ 20 files changed, 24 insertions(+) diff --git a/zbook_frontend/messages/de.json b/zbook_frontend/messages/de.json index 22d1e85..d40b50e 100644 --- a/zbook_frontend/messages/de.json +++ b/zbook_frontend/messages/de.json @@ -285,6 +285,7 @@ "DayAfter": "{duration, plural, =0 {gerade eben} =1 {in # Tag} other {in # Tagen} }" }, "GenerateMetaData": { + "HomePageDescription": "Dies ist die Startseite von ZBook, die die Hauptfunktionen zeigt und wichtige Einstiegspunkte bietet.", "User": "Benutzer", "Session": "Sitzung", "Repo": "Repository", diff --git a/zbook_frontend/messages/en.json b/zbook_frontend/messages/en.json index 09dc481..9272aaf 100644 --- a/zbook_frontend/messages/en.json +++ b/zbook_frontend/messages/en.json @@ -289,6 +289,7 @@ "DayAfter": "{duration, plural, =0 {just now} =1 {in # day} other {in # days} }" }, "GenerateMetaData": { + "HomePageDescription": "This is the homepage of ZBook, showcasing its main features and providing key entry points.", "User": "User", "Session": "Session", "Repo": "Repo", diff --git a/zbook_frontend/messages/zh.json b/zbook_frontend/messages/zh.json index fead7e8..dbb53e8 100644 --- a/zbook_frontend/messages/zh.json +++ b/zbook_frontend/messages/zh.json @@ -292,6 +292,7 @@ "DayAfter": "{duration} 天后" }, "GenerateMetaData": { + "HomePageDescription": "这是 ZBook 的首页,用于展示 ZBook 的主要功能,以及一些关键入口。", "User": "用户", "Session": "会话", "Repo": "仓库", diff --git a/zbook_frontend/src/app/[locale]/auth/forget/page.tsx b/zbook_frontend/src/app/[locale]/auth/forget/page.tsx index dd09d45..c8089a2 100644 --- a/zbook_frontend/src/app/[locale]/auth/forget/page.tsx +++ b/zbook_frontend/src/app/[locale]/auth/forget/page.tsx @@ -5,6 +5,7 @@ export async function generateMetadata(): Promise { const t = await getTranslations("GenerateMetaData"); return { title: t("ForgetPassword"), + description: t("ForgetPassword"), }; } export default async function forget() { diff --git a/zbook_frontend/src/app/[locale]/auth/login/page.tsx b/zbook_frontend/src/app/[locale]/auth/login/page.tsx index 56e7ae5..f5f3e24 100644 --- a/zbook_frontend/src/app/[locale]/auth/login/page.tsx +++ b/zbook_frontend/src/app/[locale]/auth/login/page.tsx @@ -11,6 +11,7 @@ export async function generateMetadata(): Promise { const t = await getTranslations("GenerateMetaData"); return { title: t("Login"), + description: t("Login"), }; } export default async function Login() { diff --git a/zbook_frontend/src/app/[locale]/auth/register/page.tsx b/zbook_frontend/src/app/[locale]/auth/register/page.tsx index 7d2c73a..8d4a015 100644 --- a/zbook_frontend/src/app/[locale]/auth/register/page.tsx +++ b/zbook_frontend/src/app/[locale]/auth/register/page.tsx @@ -7,6 +7,7 @@ export async function generateMetadata(): Promise { const t = await getTranslations("GenerateMetaData"); return { title: t("Register"), + description: t("Register"), }; } export default async function Register({ diff --git a/zbook_frontend/src/app/[locale]/cases/page.tsx b/zbook_frontend/src/app/[locale]/cases/page.tsx index 355b4af..f954e6d 100644 --- a/zbook_frontend/src/app/[locale]/cases/page.tsx +++ b/zbook_frontend/src/app/[locale]/cases/page.tsx @@ -6,6 +6,7 @@ export async function generateMetadata(): Promise { const t = await getTranslations("GenerateMetaData"); return { title: t("Cases"), + description: t("Cases"), }; } diff --git a/zbook_frontend/src/app/[locale]/layout.tsx b/zbook_frontend/src/app/[locale]/layout.tsx index 1c8730a..41d552b 100644 --- a/zbook_frontend/src/app/[locale]/layout.tsx +++ b/zbook_frontend/src/app/[locale]/layout.tsx @@ -39,6 +39,7 @@ export async function generateMetadata({ template: "%s - ZBook", default: "ZBook | " + t("Slogan"), // a default is required when creating a template }, + description: t("HomePageDescription"), }; } diff --git a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/comments/page.tsx b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/comments/page.tsx index e903fec..a652af6 100644 --- a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/comments/page.tsx +++ b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/comments/page.tsx @@ -10,6 +10,8 @@ export async function generateMetadata({ const t = await getTranslations("GenerateMetaData"); return { title: params.username + " - " + t("DashBoard") + " - " + t("Comments"), + description: + params.username + " - " + t("DashBoard") + " - " + t("Comments"), }; } export default async function AdminCommentsPage({ diff --git a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/dashboard/page.tsx b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/dashboard/page.tsx index b826042..04ae7ba 100644 --- a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/dashboard/page.tsx +++ b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/dashboard/page.tsx @@ -17,6 +17,8 @@ export async function generateMetadata({ const t = await getTranslations("GenerateMetaData"); return { title: params.username + " - " + t("DashBoard") + " - " + t("OverView"), + description: + params.username + " - " + t("DashBoard") + " - " + t("OverView"), }; } export default async function AdminOverviewPage({ diff --git a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/favorite/page.tsx b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/favorite/page.tsx index 04eddc1..fe3ab15 100644 --- a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/favorite/page.tsx +++ b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/favorite/page.tsx @@ -10,6 +10,7 @@ export async function generateMetadata({ const t = await getTranslations("GenerateMetaData"); return { title: params.username + " - " + t("Favorite"), + description: params.username + " - " + t("Favorite"), }; } export default async function LikeRepoPage({ diff --git a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/follower/page.tsx b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/follower/page.tsx index bbbf281..e51aeed 100644 --- a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/follower/page.tsx +++ b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/follower/page.tsx @@ -10,6 +10,7 @@ export async function generateMetadata({ const t = await getTranslations("GenerateMetaData"); return { title: params.username + " - " + t("Follower"), + description: params.username + " - " + t("Follower"), }; } export default async function RepoPage({ diff --git a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/following/page.tsx b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/following/page.tsx index 8e984ed..94b87af 100644 --- a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/following/page.tsx +++ b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/following/page.tsx @@ -10,6 +10,7 @@ export async function generateMetadata({ const t = await getTranslations("GenerateMetaData"); return { title: params.username + " - " + t("Following"), + description: params.username + " - " + t("Following"), }; } export default async function RepoPage({ diff --git a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/page.tsx b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/page.tsx index 0c17ad3..b7442bd 100644 --- a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/page.tsx +++ b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/page.tsx @@ -10,6 +10,7 @@ export async function generateMetadata({ const t = await getTranslations("GenerateMetaData"); return { title: params.username + " - " + t("Repo"), + description: params.username + " - " + t("Repo"), }; } export default async function OwnRepoPage({ diff --git a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/reports/page.tsx b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/reports/page.tsx index 6e7e405..6598d59 100644 --- a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/reports/page.tsx +++ b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/reports/page.tsx @@ -10,6 +10,7 @@ export async function generateMetadata({ const t = await getTranslations("GenerateMetaData"); return { title: params.username + " - " + t("DashBoard") + " - " + t("Report"), + description: params.username + " - " + t("DashBoard") + " - " + t("Report"), }; } export default async function RepoPage({ diff --git a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/repos/page.tsx b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/repos/page.tsx index e9ec967..97e791a 100644 --- a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/repos/page.tsx +++ b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/repos/page.tsx @@ -10,6 +10,7 @@ export async function generateMetadata({ const t = await getTranslations("GenerateMetaData"); return { title: params.username + " - " + t("DashBoard") + " - " + t("Repo"), + description: params.username + " - " + t("DashBoard") + " - " + t("Repo"), }; } export default async function RepoPage({ diff --git a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/sessions/page.tsx b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/sessions/page.tsx index cf22a9e..c1a98b3 100644 --- a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/sessions/page.tsx +++ b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/sessions/page.tsx @@ -10,6 +10,8 @@ export async function generateMetadata({ const t = await getTranslations("GenerateMetaData"); return { title: params.username + " - " + t("DashBoard") + " - " + t("Session"), + description: + params.username + " - " + t("DashBoard") + " - " + t("Session"), }; } export default async function RepoPage({ diff --git a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/users/page.tsx b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/users/page.tsx index 94a1fcc..19c3cf4 100644 --- a/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/users/page.tsx +++ b/zbook_frontend/src/app/[locale]/workspace/[username]/(dashboards)/users/page.tsx @@ -10,6 +10,7 @@ export async function generateMetadata({ const t = await getTranslations("GenerateMetaData"); return { title: params.username + " - " + t("DashBoard") + " - " + t("User"), + description: params.username + " - " + t("DashBoard") + " - " + t("User"), }; } export default async function RepoPage({ diff --git a/zbook_frontend/src/app/[locale]/workspace/[username]/(repos)/o/[reponame]/[...href]/page.tsx b/zbook_frontend/src/app/[locale]/workspace/[username]/(repos)/o/[reponame]/[...href]/page.tsx index 97f5d44..b0ec332 100644 --- a/zbook_frontend/src/app/[locale]/workspace/[username]/(repos)/o/[reponame]/[...href]/page.tsx +++ b/zbook_frontend/src/app/[locale]/workspace/[username]/(repos)/o/[reponame]/[...href]/page.tsx @@ -56,6 +56,7 @@ export async function generateMetadata({ const [firstPart, lastPart] = [parts[0] ?? "", parts[parts.length - 1]]; return { title: parts.length > 1 ? `${firstPart}: ${lastPart}` : lastPart, + description: parts.length > 1 ? `${firstPart}: ${lastPart}` : lastPart, }; } diff --git a/zbook_frontend/src/app/[locale]/workspace/[username]/(repos)/o/[reponame]/~visi/page.tsx b/zbook_frontend/src/app/[locale]/workspace/[username]/(repos)/o/[reponame]/~visi/page.tsx index 1a32cab..44e85cc 100644 --- a/zbook_frontend/src/app/[locale]/workspace/[username]/(repos)/o/[reponame]/~visi/page.tsx +++ b/zbook_frontend/src/app/[locale]/workspace/[username]/(repos)/o/[reponame]/~visi/page.tsx @@ -15,6 +15,8 @@ export async function generateMetadata({ const t = await getTranslations("GenerateMetaData"); return { title: params.username + " - repo - " + params.reponame + t("WhoCanSee"), + description: + params.username + " - repo - " + params.reponame + t("WhoCanSee"), }; } export default async function ListRepoVisi({ From ab613155f2802ee95923cb1db87a7d106d6c6f0f Mon Sep 17 00:00:00 2001 From: SeeLey Wang Date: Tue, 1 Oct 2024 20:35:12 +0800 Subject: [PATCH 2/2] add arialabel --- zbook_frontend/src/app/[locale]/page.tsx | 6 +++--- zbook_frontend/src/components/navbars/NavLang.tsx | 5 ++++- .../src/components/navbars/NavNotification.tsx | 5 ++++- .../src/components/navbars/NavTheme.tsx | 5 ++++- .../src/components/navbars/NavUserState.tsx | 15 ++++++++++++--- .../src/components/navbars/SideBarToggle.tsx | 1 + .../src/providers/dialogs/GlobalSearchButton.tsx | 1 + 7 files changed, 29 insertions(+), 9 deletions(-) diff --git a/zbook_frontend/src/app/[locale]/page.tsx b/zbook_frontend/src/app/[locale]/page.tsx index 0f5a9ca..5c88f92 100644 --- a/zbook_frontend/src/app/[locale]/page.tsx +++ b/zbook_frontend/src/app/[locale]/page.tsx @@ -188,9 +188,9 @@ export default async function Home() {

{t("SimpleDocumentation")}

{t("VisuallyAppealing")}

-
-

{t("DocumentationForTeam")}

-
+

+ {t("DocumentationForTeam")} +

- + - +
); diff --git a/zbook_frontend/src/components/navbars/NavTheme.tsx b/zbook_frontend/src/components/navbars/NavTheme.tsx index 14e1980..9d6fa13 100644 --- a/zbook_frontend/src/components/navbars/NavTheme.tsx +++ b/zbook_frontend/src/components/navbars/NavTheme.tsx @@ -26,7 +26,10 @@ export default function NavLang() { return (
- + - + ); @@ -30,7 +36,10 @@ export default async function UserState() { return ( <> - + ); diff --git a/zbook_frontend/src/components/navbars/SideBarToggle.tsx b/zbook_frontend/src/components/navbars/SideBarToggle.tsx index ce8ca89..1a31ff9 100644 --- a/zbook_frontend/src/components/navbars/SideBarToggle.tsx +++ b/zbook_frontend/src/components/navbars/SideBarToggle.tsx @@ -28,6 +28,7 @@ export default function SideBarToggle() { setSideBarOpen(!sideBarOpen); localStorage.setItem("sidebarValue", JSON.stringify(!sideBarOpen)); }} + aria-label="sidebar toggle" mounted={true} /> ); diff --git a/zbook_frontend/src/providers/dialogs/GlobalSearchButton.tsx b/zbook_frontend/src/providers/dialogs/GlobalSearchButton.tsx index 57af581..bab7150 100644 --- a/zbook_frontend/src/providers/dialogs/GlobalSearchButton.tsx +++ b/zbook_frontend/src/providers/dialogs/GlobalSearchButton.tsx @@ -13,6 +13,7 @@ export default function GlobalSearchButton() { setSearchType(SearchType.DOCUMENT); setSearchDialogOpen(true); }} + aria-label="search" className="block w-6 h-6 hover:text-sky-600 dark:hover:text-sky-400 cursor-pointer" /> );