diff --git a/frontend/app/components/updates/EarlierArchive.tsx b/frontend/app/components/updates/EarlierArchive.tsx deleted file mode 100644 index 90037b2..0000000 --- a/frontend/app/components/updates/EarlierArchive.tsx +++ /dev/null @@ -1,52 +0,0 @@ -"use client"; - -import { useState } from "react"; - -import { loadPublishedNotes } from "@/lib/patchnotes/api"; -import type { WeekNotes } from "@/lib/patchnotes/notes"; - -import { WeekArticle } from "./WeekArchiveList"; - -const PAGE_SIZE = 8; - -export default function EarlierArchive({ before }: { before: string }) { - const [weeks, setWeeks] = useState([]); - const [cursor, setCursor] = useState(before); - const [hasMore, setHasMore] = useState(true); - const [loading, setLoading] = useState(false); - const [error, setError] = useState(false); - - async function load(from: string) { - setLoading(true); - setError(false); - const notes = await loadPublishedNotes({ limit: PAGE_SIZE, before: from }); - setLoading(false); - if (!notes.ok) { - setError(true); - return; - } - setWeeks((current) => [...current, ...notes.weeks]); - setHasMore(notes.hasMore); - const oldest = notes.weeks.at(-1); - if (oldest) setCursor(oldest.week); - } - - return ( -
- {weeks.map((notes) => ( - - ))} - {loading ?

Loading…

: null} - {error ?

Older weeks are unavailable right now.

: null} - {hasMore && !loading ? ( - - ) : null} -
- ); -} diff --git a/frontend/app/components/updates/UpdatesPageView.tsx b/frontend/app/components/updates/UpdatesPageView.tsx index 283f3f4..c4ccb5f 100644 --- a/frontend/app/components/updates/UpdatesPageView.tsx +++ b/frontend/app/components/updates/UpdatesPageView.tsx @@ -1,38 +1,35 @@ import Link from "next/link"; -import EarlierArchive from "@/app/components/updates/EarlierArchive"; import StaffTestPreview from "@/app/components/updates/StaffTestPreview"; -import { WeekArticle, WeekSections } from "@/app/components/updates/WeekArchiveList"; +import { WeekSections } from "@/app/components/updates/WeekArchiveList"; import type { WeekNotes } from "@/lib/patchnotes/notes"; +const weekButtonClass = + "inline-flex w-full items-center justify-start rounded-sm border border-[color-mix(in_srgb,var(--tfmc-cream)_35%,transparent)] bg-transparent px-6 py-4 text-left text-sm font-semibold tracking-wide text-[var(--tfmc-cream)] transition-colors hover:border-[var(--tfmc-cream)] hover:bg-[color-mix(in_srgb,var(--tfmc-cream)_8%,transparent)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--tfmc-cream)]"; + export default function UpdatesPageView({ weeks, unavailable = false, - hasMore = false, }: { - weeks: readonly WeekNotes[]; + weeks: readonly { week: string; label: string }[]; unavailable?: boolean; - hasMore?: boolean; }) { - const oldest = weeks.at(-1)?.week; - return (

Updates

-

- Scroll through the weeks. Each week also has its own page. Technical notes stay folded. -

+

Each week that has notes has its own page.

{unavailable ? (

Patch notes are unavailable right now.

) : weeks.length > 0 ? ( -
+
+ ) : (

Nothing has been published yet.

)} @@ -49,14 +46,14 @@ export function WeekPageView({ }) { return (
- + All updates {unavailable ? (

Patch notes are unavailable right now.

) : notes ? ( <> -

{notes.label}

+

{notes.label}

) : null} diff --git a/frontend/app/components/updates/WeekArchiveList.tsx b/frontend/app/components/updates/WeekArchiveList.tsx index 5438c04..c119862 100644 --- a/frontend/app/components/updates/WeekArchiveList.tsx +++ b/frontend/app/components/updates/WeekArchiveList.tsx @@ -1,6 +1,4 @@ -import Link from "next/link"; - -import { arrangeNote, SECTION_LABELS, type PublicBullet, type WeekNotes } from "@/lib/patchnotes/notes"; +import { arrangeNote, SECTION_LABELS, type PublicBullet } from "@/lib/patchnotes/notes"; const detailsClass = "rounded-md border border-[color-mix(in_srgb,var(--tfmc-cream)_14%,transparent)] bg-[color-mix(in_srgb,var(--tfmc-forest-deep)_35%,transparent)]"; @@ -52,16 +50,3 @@ export function WeekSections({ bullets }: { bullets: readonly PublicBullet[] }) ); } - -export function WeekArticle({ notes }: { notes: WeekNotes }) { - return ( -
-

- - {notes.label} - -

- -
- ); -} diff --git a/frontend/app/updates/page.test.tsx b/frontend/app/updates/page.test.tsx index 818762c..8a3b7a9 100644 --- a/frontend/app/updates/page.test.tsx +++ b/frontend/app/updates/page.test.tsx @@ -6,7 +6,17 @@ import { describe, expect, it } from "vitest"; import UpdatesPageView, { WeekPageView } from "../components/updates/UpdatesPageView"; import type { WeekNotes } from "@/lib/patchnotes/notes"; -const current: WeekNotes = { +const current = { + week: "2026-W39", + label: "Week of 21 September 2026", +}; + +const earlier = { + week: "2026-W38", + label: "Week of 14 September 2026", +}; + +const notes: WeekNotes = { week: "2026-W39", label: "Week of 21 September 2026", bullets: [ @@ -18,20 +28,41 @@ const current: WeekNotes = { ], }; -const earlier: WeekNotes = { - week: "2026-W38", - label: "Week of 14 September 2026", - bullets: [{ id: "old-1", section: "fixed", body: "Fixed a chest" }], -}; - -function markup(weeks: WeekNotes[], unavailable = false): string { +function markup(weeks: { week: string; label: string }[], unavailable = false): string { return renderToStaticMarkup(); } describe("Updates page", () => { - it("shows the latest week open and folds technical notes", () => { - const html = markup([current]); + it("lists each week as a button and leaves the notes off the index", () => { + const html = markup([current, earlier]); expect(html).toContain('href="/updates/2026-W39"'); + expect(html).toContain('href="/updates/2026-W38"'); + expect(html).toContain("Week of 21 September 2026"); + expect(html).toContain("Week of 14 September 2026"); + expect(html).toContain("rounded-sm border"); + expect(html).not.toContain("Added a station"); + expect(html).not.toContain("Fixed a chest"); + expect(html).not.toContain("hover:underline"); + expect(html.indexOf("2026-W39")).toBeLessThan(html.indexOf("2026-W38")); + }); + + it("says when nothing is published", () => { + expect(markup([])).toContain("Nothing has been published yet."); + }); + + it("says when the notes cannot be loaded", () => { + const html = markup([current], true); + expect(html).toContain("Patch notes are unavailable right now."); + expect(html).not.toContain("Week of 21 September 2026"); + }); +}); + +describe("Week page", () => { + it("shows that week and folds technical notes", () => { + const html = renderToStaticMarkup(); + expect(html).toContain('href="/updates"'); + expect(html).toContain("All updates"); + expect(html).toContain("rounded-sm border"); expect(html).toContain("Week of 21 September 2026"); expect(html).toContain("Highlights"); expect(html).toContain("Crafting"); @@ -52,44 +83,8 @@ describe("Updates page", () => { }); it("renders bullet text instead of HTML", () => { - const html = markup([current]); + const html = renderToStaticMarkup(); expect(html).not.toContain("