Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better lighthouse score #51

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions zbook_frontend/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions zbook_frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions zbook_frontend/messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@
"DayAfter": "{duration} 天后"
},
"GenerateMetaData": {
"HomePageDescription": "这是 ZBook 的首页,用于展示 ZBook 的主要功能,以及一些关键入口。",
"User": "用户",
"Session": "会话",
"Repo": "仓库",
Expand Down
1 change: 1 addition & 0 deletions zbook_frontend/src/app/[locale]/auth/forget/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export async function generateMetadata(): Promise<Metadata> {
const t = await getTranslations("GenerateMetaData");
return {
title: t("ForgetPassword"),
description: t("ForgetPassword"),
};
}
export default async function forget() {
Expand Down
1 change: 1 addition & 0 deletions zbook_frontend/src/app/[locale]/auth/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export async function generateMetadata(): Promise<Metadata> {
const t = await getTranslations("GenerateMetaData");
return {
title: t("Login"),
description: t("Login"),
};
}
export default async function Login() {
Expand Down
1 change: 1 addition & 0 deletions zbook_frontend/src/app/[locale]/auth/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export async function generateMetadata(): Promise<Metadata> {
const t = await getTranslations("GenerateMetaData");
return {
title: t("Register"),
description: t("Register"),
};
}
export default async function Register({
Expand Down
1 change: 1 addition & 0 deletions zbook_frontend/src/app/[locale]/cases/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export async function generateMetadata(): Promise<Metadata> {
const t = await getTranslations("GenerateMetaData");
return {
title: t("Cases"),
description: t("Cases"),
};
}

Expand Down
1 change: 1 addition & 0 deletions zbook_frontend/src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
};
}

Expand Down
6 changes: 3 additions & 3 deletions zbook_frontend/src/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ export default async function Home() {
<h1 className="max-w-2xl block">{t("SimpleDocumentation")}</h1>
<h1 className="max-w-2xl block">{t("VisuallyAppealing")}</h1>
</div>
<div className="mt-3.5 flex justify-center">
<h3 className="max-w-sm">{t("DocumentationForTeam")}</h3>
</div>
<p className="mt-4 max-w-[26rem] mx-auto md:max-w-xl text-primary dark:text-primary-light/80 md:leading-loose">
{t("DocumentationForTeam")}
</p>
</div>
<div className="px-12 mt-8 flex justify-center items-center flex-col sm:flex-row space-y-4 sm:space-y-0 sm:space-x-10">
<Link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
5 changes: 4 additions & 1 deletion zbook_frontend/src/components/navbars/NavLang.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export default function NavLink() {
return (
<Listbox value={selected} onChange={setSelected}>
<div className="relative">
<Listbox.Button className="relative flex w-full cursor-pointer rounded-lg text-left focus:outline-none focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-white/75 focus-visible:ring-offset-2 focus-visible:ring-offset-orange-300 sm:text-sm">
<Listbox.Button
aria-label="Select language"
className="relative flex w-full cursor-pointer rounded-lg text-left focus:outline-none focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-white/75 focus-visible:ring-offset-2 focus-visible:ring-offset-orange-300 sm:text-sm"
>
<svg
stroke="currentColor"
fill="currentColor"
Expand Down
5 changes: 4 additions & 1 deletion zbook_frontend/src/components/navbars/NavNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ export default function NavNotification({
}}
>
<Badge count={unReadCount} className="text-slate-700 dark:text-slate-200">
<MdOutlineNotificationsNone className="block w-6 h-6 hover:text-sky-600 dark:hover:text-sky-400 cursor-pointer" />
<MdOutlineNotificationsNone
aria-label="notifications"
className="block w-6 h-6 hover:text-sky-600 dark:hover:text-sky-400 cursor-pointer"
/>
</Badge>
</div>
);
Expand Down
5 changes: 4 additions & 1 deletion zbook_frontend/src/components/navbars/NavTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export default function NavLang() {
return (
<Listbox value={theme} onChange={setTheme}>
<div className="relative">
<Listbox.Button className="relative flex w-full cursor-pointer rounded-lg text-left focus:outline-none focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-white/75 focus-visible:ring-offset-2 focus-visible:ring-offset-orange-300 sm:text-sm">
<Listbox.Button
aria-label="Select Theme(e.g. dark)"
className="relative flex w-full cursor-pointer rounded-lg text-left focus:outline-none focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-white/75 focus-visible:ring-offset-2 focus-visible:ring-offset-orange-300 sm:text-sm"
>
<NavBarIcon
Icon={
theme == "dark"
Expand Down
15 changes: 12 additions & 3 deletions zbook_frontend/src/components/navbars/NavUserState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,29 @@ export default async function UserState() {
}}
>
<button type="submit">
<RiLogoutBoxLine className="block w-6 h-6 hover:text-sky-600 dark:hover:text-sky-400 cursor-pointer" />
<RiLogoutBoxLine
aria-label="Logout"
className="block w-6 h-6 hover:text-sky-600 dark:hover:text-sky-400 cursor-pointer"
/>
</button>
</form>
<GlobalSearchButton />
<Link href={`/workspace/${session.username}`}>
<AiOutlineUser className="block w-6 h-6 hover:text-sky-600 dark:hover:text-sky-400 cursor-pointer" />
<AiOutlineUser
aria-label="User Center"
className="block w-6 h-6 hover:text-sky-600 dark:hover:text-sky-400 cursor-pointer"
/>
</Link>
</>
);
} else {
return (
<>
<Link href={`/auth/login`}>
<RiLoginBoxLine className="block w-6 h-6 hover:text-sky-600 dark:hover:text-sky-400 cursor-pointer" />
<RiLoginBoxLine
aria-label="Login"
className="block w-6 h-6 hover:text-sky-600 dark:hover:text-sky-400 cursor-pointer"
/>
</Link>
</>
);
Expand Down
1 change: 1 addition & 0 deletions zbook_frontend/src/components/navbars/SideBarToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default function SideBarToggle() {
setSideBarOpen(!sideBarOpen);
localStorage.setItem("sidebarValue", JSON.stringify(!sideBarOpen));
}}
aria-label="sidebar toggle"
mounted={true}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
);
Expand Down
Loading