diff --git a/app/routes/builds.tsx b/app/routes/builds.tsx new file mode 100644 index 000000000..388fde4c3 --- /dev/null +++ b/app/routes/builds.tsx @@ -0,0 +1,61 @@ +import { type LinksFunction } from "@remix-run/node"; +import { Link, Outlet, useMatches, useParams } from "@remix-run/react"; +import type * as React from "react"; +import { useTranslation } from "react-i18next"; +import { Main } from "~/components/Main"; +import type { MainWeaponId } from "~/modules/in-game-lists"; + +import styles from "~/styles/builds.css"; +import { atOrError } from "~/utils/arrays"; +import { BUILDS_PAGE } from "~/utils/urls"; + +export const links: LinksFunction = () => { + return [{ rel: "stylesheet", href: styles }]; +}; + +export const handle = { + i18n: "weapons", +}; + +export default function BuildsLayoutPage() { + const matches = useMatches(); + const { t } = useTranslation(["weapons", "common"]); + const params = useParams(); + + const weaponId: MainWeaponId | undefined = atOrError(matches, -1).data?.[ + "weaponId" + ]; + + return ( +
+ + +
+ ); +} + +function SometimesLink({ + children, + isLink, +}: { + children: React.ReactNode; + isLink: boolean; +}) { + if (isLink) { + return {children}; + } + + return
{children}
; +} diff --git a/app/routes/builds/$slug.tsx b/app/routes/builds/$slug.tsx index 324c4b760..29f87ba8f 100644 --- a/app/routes/builds/$slug.tsx +++ b/app/routes/builds/$slug.tsx @@ -1,5 +1,4 @@ import { type LoaderArgs } from "@remix-run/node"; -import { Main } from "~/components/Main"; import { i18next } from "~/modules/i18n"; import { mainWeaponIds, weaponIdIsNotAlt } from "~/modules/in-game-lists"; import { mySlugify } from "~/utils/urls"; @@ -14,9 +13,9 @@ export const loader = async ({ request, params }: LoaderArgs) => { throw new Response(null, { status: 404 }); } - return null; + return { weaponId }; }; export default function WeaponsBuildsPage() { - return
Hellou
; + return
Hellou
; } diff --git a/app/routes/builds/index.tsx b/app/routes/builds/index.tsx index 37efabf08..a31400cdd 100644 --- a/app/routes/builds/index.tsx +++ b/app/routes/builds/index.tsx @@ -1,22 +1,16 @@ -import { type LinksFunction } from "@remix-run/node"; import { Link } from "@remix-run/react"; import { useTranslation } from "react-i18next"; import { Image } from "~/components/Image"; -import { Main } from "~/components/Main"; import type { MainWeaponId } from "~/modules/in-game-lists"; import { weaponCategories, weaponIdIsNotAlt } from "~/modules/in-game-lists"; -import styles from "~/styles/builds.css"; import { mainWeaponImageUrl, mySlugify, weaponCategoryUrl } from "~/utils/urls"; -export const links: LinksFunction = () => { - return [{ rel: "stylesheet", href: styles }]; -}; - export const handle = { i18n: "weapons", }; // xxx: 2) breadcrumbs + link to new build +// xxx: 3) titles export default function BuildsPage() { const { t } = useTranslation(["common", "weapons"]); @@ -26,7 +20,7 @@ export default function BuildsPage() { }; return ( -
+
{weaponCategories.map((category) => (
@@ -63,6 +57,6 @@ export default function BuildsPage() {
))} -
+ ); } diff --git a/app/styles/builds.css b/app/styles/builds.css index d0a5b564c..0406f80c0 100644 --- a/app/styles/builds.css +++ b/app/styles/builds.css @@ -1,3 +1,10 @@ +.builds__breadcrumbs { + display: flex; + font-size: var(--fonts-xs); + font-weight: var(--bold); + gap: var(--s-1); +} + .builds__category { display: flex; flex-direction: column; diff --git a/app/utils/urls.ts b/app/utils/urls.ts index fbc1c595d..6faf265e7 100644 --- a/app/utils/urls.ts +++ b/app/utils/urls.ts @@ -25,6 +25,7 @@ export const ADMIN_PAGE = "/admin"; export const FAQ_PAGE = "/faq"; export const CONTRIBUTIONS_PAGE = "/contributions"; export const BADGES_PAGE = "/badges"; +export const BUILDS_PAGE = "/builds"; export const ANALYZER_PAGE = "/analyzer"; export const CALENDAR_PAGE = "/calendar"; export const STOP_IMPERSONATING_URL = "/auth/impersonate/stop";