-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Add "Sheets Tools" to navigation routes
This commit adds a new navigation route for "Sheets Tools" in the Genshin Impact header component. The route is "/sheets-tools" and is now included in the navigation menu. Refactor the Genshin Impact header component to include the new "Sheets Tools" navigation route.
- Loading branch information
Showing
22 changed files
with
662 additions
and
933 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"wish-tally-community": { | ||
"name": "Wish Tally - Community", | ||
"purpose": "This sheet aggregates all shared Wish Tally documents from our community, providing you with detailed statistics on wishes.", | ||
"creator": "Yippy", | ||
"url": "https://docs.google.com/spreadsheets/d/1NV2dvHQpD5_pCH92-YgnCEH2LVNmMxwGUW6E3fwL4CM/edit", | ||
"hoyolab": "https://www.hoyolab.com/article/390587", | ||
"categories": ["Statistic"], | ||
"tags": ["Statistic", "Tracker", "Wish"], | ||
"images": ["/sheets/wish_tally_01.webp", "/sheets/wish_tally_02.webp"] | ||
}, | ||
"teyvat-central-banking-systems": { | ||
"name": "Teyvat Central Banking Systems", | ||
"purpose": "Effortlessly track and manage your Genshin Impact resources, including Primogems, Genesis Crystals, Resin, and Mora, with this document. Automatically update your records by using the provided feedback URL, which securely connects to miHoYo's API. Stay on top of your in-game progress with precise and up-to-date information.", | ||
"creator": "Yippy", | ||
"url": "https://docs.google.com/spreadsheets/d/1VrNIbZGj2XhVZv7eRMgoSO3xUhOm0EVFGFqW0y1BLpI/edit", | ||
"hoyolab": "https://www.hoyolab.com/article/1940532", | ||
"categories": ["Tracker"], | ||
"tags": ["Fragile Resin", "Genesis Crystal", "Mora", "Primogem", "Tracker"], | ||
"images": [ | ||
"/sheets/teyvat_central_banking_systems_01.png", | ||
"/sheets/teyvat_central_banking_systems_02.webp" | ||
] | ||
}, | ||
"parametric-transformer": { | ||
"name": "Parametric Transformer", | ||
"purpose": "This sheet organizes and analyzes the distribution of groups for each material used in the Parametric Transformer. It provides a comprehensive overview of how materials are grouped, enabling efficient tracking and optimization of your Parametric Transformer usage.", | ||
"url": "https://docs.google.com/spreadsheets/d/1M2EpQp0_i34Mb7dpjsczK0wSC8QHj3w4nBhC4vIfDXM/edit", | ||
"categories": ["Statistic"], | ||
"tags": ["Statistic"], | ||
"images": [ | ||
"/sheets/parametric_transformer_01.jpg", | ||
"/sheets/parametric_transformer_02.jpg" | ||
] | ||
}, | ||
"genshin-impact-helper-teams-character-builds": { | ||
"name": "Genshin Impact Helper Team’s Character Builds", | ||
"purpose": "This sheet compiles and showcases the optimized character builds recommended by the Genshin Impact Helper Team. It serves as a comprehensive resource for selecting the best weapons, artifacts, and talent priorities to maximize the performance of your characters in various scenarios.", | ||
"url": "https://docs.google.com/spreadsheets/d/1gNxZ2xab1J6o1TuNVWMeLOZ7TPOqrsf3SshP5DLvKzI/edit", | ||
"categories": ["Character Build"], | ||
"tags": ["Characters"], | ||
"images": [ | ||
"/sheets/genshin_impact_helper_teams_character_builds_01.jpg", | ||
"/sheets/genshin_impact_helper_teams_character_builds_02.jpg" | ||
] | ||
}, | ||
"genshin-impact-calculators": { | ||
"name": "Genshin Impact Calculators", | ||
"purpose": "This collection of Genshin Impact calculators provides precise tools for optimizing various aspects of your gameplay, from damage output and resource management to character leveling and artifact enhancement. Use these calculators to make informed decisions and enhance your in-game efficiency.", | ||
"url": "https://docs.google.com/spreadsheets/d/1yNV3ld2kOzl8VvZb2bg6GLQ1KRryovrb6C8Wp9tw2Q8/edit", | ||
"categories": ["Calculator"], | ||
"tags": ["Calculator"], | ||
"images": [ | ||
"/sheets/genshin-impact-calculators_01.jpg", | ||
"/sheets/genshin-impact-calculators_02.jpg" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
import type { Metadata } from "next"; | ||
import importDynamic from "next/dynamic"; | ||
import { notFound } from "next/navigation"; | ||
|
||
import { genPageMetadata } from "@app/seo"; | ||
import Badge from "@components/ui/Badge"; | ||
import useTranslations from "@hooks/use-translations"; | ||
import { i18n } from "@i18n-config"; | ||
import { AD_ARTICLE_SLOT } from "@lib/constants"; | ||
import { getUrl } from "@lib/imgUrl"; | ||
import { getData } from "@lib/localData"; | ||
|
||
const Ads = importDynamic(() => import("@components/ui/Ads"), { ssr: false }); | ||
const FrstAds = importDynamic(() => import("@components/ui/FrstAds"), { | ||
ssr: false, | ||
}); | ||
|
||
export const dynamic = "force-static"; | ||
|
||
interface GenshinImpactCalculators { | ||
name: string; | ||
purpose: string; | ||
url: string; | ||
categories: string[]; | ||
tags: string[]; | ||
images: string[]; | ||
creator?: string; | ||
hoyolab?: string; | ||
} | ||
|
||
export async function generateStaticParams() { | ||
const sheets = await getData<Record<string, GenshinImpactCalculators>>( | ||
"genshin", | ||
"sheets-tools" | ||
); | ||
const routes: { lang: string; tool: string }[] = []; | ||
|
||
for await (const lang of i18n.locales) { | ||
for (const tool of Object.keys(sheets)) { | ||
routes.push({ lang, tool }); | ||
} | ||
} | ||
return routes; | ||
} | ||
|
||
interface Props { | ||
params: { | ||
tool: string; | ||
lang: string; | ||
}; | ||
} | ||
|
||
export async function generateMetadata({ | ||
params, | ||
}: Props): Promise<Metadata | undefined> { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const { t, locale } = await useTranslations( | ||
params.lang, | ||
"genshin", | ||
"sheets_tools" | ||
); | ||
|
||
const sheets = await getData<Record<string, GenshinImpactCalculators>>( | ||
"genshin", | ||
"sheets-tools" | ||
); | ||
const sheet = sheets[params.tool]; | ||
|
||
if (!sheet) { | ||
return; | ||
} | ||
|
||
const title = t("detail_title", { | ||
name: sheet.name, | ||
category: sheet.categories[0], | ||
}); | ||
const description = sheet.purpose; | ||
|
||
return genPageMetadata({ | ||
title, | ||
description, | ||
path: `/sheets-tools/${params.tool}`, | ||
locale, | ||
}); | ||
} | ||
|
||
export default async function GenshinSheetsToolsPage({ params }: Props) { | ||
const { t } = await useTranslations(params.lang, "genshin", "sheets_tools"); | ||
const sheets = await getData<Record<string, GenshinImpactCalculators>>( | ||
"genshin", | ||
"sheets-tools" | ||
); | ||
const sheet = sheets[params.tool]; | ||
|
||
if (!sheet) { | ||
return notFound(); | ||
} | ||
|
||
return ( | ||
<div className="relative"> | ||
<h2 className="text-2xl font-semibold text-gray-200"> | ||
{t("detail_title", { | ||
name: sheet.name, | ||
category: sheet.categories[0], | ||
})} | ||
</h2> | ||
<p>{sheet.purpose}</p> | ||
<FrstAds | ||
placementName="genshinbuilds_billboard_atf" | ||
classList={["flex", "justify-center"]} | ||
/> | ||
<Ads className="mx-auto my-0" adSlot={AD_ARTICLE_SLOT} /> | ||
<div className="card"> | ||
<div> | ||
<ul className="flex flex-wrap gap-4"> | ||
{sheet.images.map((image) => ( | ||
<li key={image}> | ||
<img | ||
src={getUrl(image, 300, 480)} | ||
alt={sheet.name} | ||
className="rounded-lg" | ||
width={300} | ||
height={480} | ||
/> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
<p> | ||
{t("creator")}: {sheet.creator} | ||
</p> | ||
<p> | ||
{t("link")}:{" "} | ||
<a href={sheet.url} target="_blank" rel="noreferrer noopener"> | ||
{sheet.url} | ||
</a> | ||
</p> | ||
{sheet.hoyolab ? ( | ||
<p> | ||
{t("hoyolab_article")}:{" "} | ||
<a href={sheet.hoyolab} target="_blank" rel="noreferrer noopener"> | ||
{sheet.hoyolab} | ||
</a> | ||
</p> | ||
) : null} | ||
<div> | ||
<h4>{t("categories")}:</h4> | ||
<ul> | ||
{sheet.categories.map((category) => ( | ||
<Badge key={category}>{category}</Badge> | ||
))} | ||
</ul> | ||
</div> | ||
<div> | ||
<h4>{t("tags")}:</h4> | ||
<ul> | ||
{sheet.tags.map((tag) => ( | ||
<Badge key={tag}>{tag}</Badge> | ||
))} | ||
</ul> | ||
</div> | ||
</div> | ||
<FrstAds | ||
placementName="genshinbuilds_incontent_1" | ||
classList={["flex", "justify-center"]} | ||
/> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.