--- import Button from "@gk/ui/components/Button.astro"; import GiltCorners from "@gk/ui/components/GiltCorners.astro"; import PageShell from "@gk/ui/components/PageShell.astro"; import Seal from "@gk/ui/components/Seal.astro"; import Star from "@gk/ui/components/Star.astro"; import StarChartArt from "@gk/ui/components/StarChartArt.astro"; import StatusPill from "@gk/ui/components/StatusPill.astro"; import TickRing from "@gk/ui/components/TickRing.astro"; import PageHero from "../../components/PageHero.astro"; import CtaBand from "../../components/world/CtaBand.astro"; import NowStrip, { type NowItem } from "../../components/world/NowStrip.astro"; import WorldSection from "../../components/world/WorldSection.astro"; import type { Note } from "../../lib/content.ts"; import { plural, site } from "../../lib/page.ts"; import { buildLogs, byDateDesc, byOrder, craftPill, craftSeal, isSword, makePhotos, makesOf, statusesFor, toolsAt, toolsOf } from "../../lib/world.ts"; const s = await site(); const text = s.pageText("/workshop"); const intro = s.render(text?.body); const crafts = byOrder(s.all("craft")).map((craft) => { const makes = byDateDesc(makesOf(s, craft)); const photos = makes.flatMap((m) => makePhotos(m).slice(0, 1)).slice(0, 3); return { craft, makes, photos, logs: buildLogs(s, craft).length, tools: toolsOf(s, craft).map((t) => t.title) }; }); const stations = byOrder(s.all("station")).map((station) => ({ station, tools: toolsAt(s, station) })); const loose = s.all("tool").filter((t) => !s.byName(t.data.station)); const allMakes = s.all("make"); const swords = allMakes.filter(isSword); const recent = byDateDesc(allMakes.filter((m) => !isSword(m))) .sort((a, b) => Number(!!b.data.date) - Number(!!a.data.date) || Number(makePhotos(b).length > 0) - Number(makePhotos(a).length > 0)) .slice(0, 4); const nowItems: NowItem[] = statusesFor(s, "/workshop").map((st) => { const subject = st.data.subject ? s.link(st.data.subject) : null; const img = subject?.note?.type === "make" ? makePhotos(subject.note as Note<"make">)[0] : undefined; return { id: st.slug, label: st.data.kind === "Making" ? "On the bench" : st.data.kind, title: subject?.title ?? st.title, note: st.data.note, href: subject?.href, img, }; }); --- {intro && } {nowItems.length > 0 && } { stations.length > 0 && ( {stations.map(({ station, tools }) => ( {station.data.order} {station.title} {station.data.where} {tools.length > 0 && ( {tools.map((t) => ( {t.title} ))} )} {station.data.goodFor && {station.data.goodFor}} ))} {loose.length > 0 && ( Around the shop {loose.map((t) => ( {t.title} ))} )} ) } { crafts.map(({ craft, makes, photos, logs, tools }) => ( {craft.title} {craft.data.status} {[0, 1, 2].map((i) => photos[i] ? ( ) : ( ), )} {craft.data.blurb && {craft.data.blurb}} {tools.length > 0 && {tools.join(" · ")}} {plural(makes.length, "make")} {logs > 0 && ` · ${plural(logs, "build log")}`} Open the craft )) } { recent.length > 0 && ( See all {allMakes.length} makes {recent.map((m) => { const found = s.byName(m.data.craft); const craft = found?.type === "craft" ? (found as Note<"craft">) : undefined; const log = s.backlinks(m, { type: "post" })[0]; return ( {m.title} {craft && {craft.title}} {m.title} {m.data.blurb && {m.data.blurb}} {log && ( Blog: {log.title} )} ); })} ) } { swords.length > 0 && ( The sword rack Blades from the stories I love I always pick the sword class, and the spellsword when I can. {swords.map((m) => ( {m.title} ))} ) } Visit the Store Start an inquiry