From 1b76f1785e65b9fa44efff7dbaa0d7ea57780579 Mon Sep 17 00:00:00 2001 From: Laurie Reynolds Date: Thu, 19 Nov 2026 12:22:52 -0800 Subject: [PATCH] update escape room panels --- astro/src/components/EscapeRoomPanels.astro | 38 ++++++++++ astro/src/components/HeaderER.astro | 4 +- astro/src/components/RoomPanel.astro | 65 +++++++++++++++++ astro/src/components/RoomPanelGrid.astro | 28 ++++++++ astro/src/content.config.ts | 7 +- .../content/escape-room/themes/corporate.mdx | 7 ++ .../content/escape-room/themes/kitchen.mdx | 7 ++ .../content/escape-room/themes/virtual.mdx | 19 +++++ astro/src/layouts/EscapeRoomLayout.astro | 4 +- astro/src/pages/escape-room/index.astro | 64 ++--------------- astro/src/pages/escape-room/themes/[id].astro | 2 +- .../src/pages/escape-room/themes/index.astro | 2 +- astro/src/pages/rooms/index.astro | 41 +++++++++++ astro/tests/e2e/escape-room-panels.spec.ts | 71 +++++++++++++++++++ 14 files changed, 295 insertions(+), 64 deletions(-) create mode 100644 astro/src/components/EscapeRoomPanels.astro create mode 100644 astro/src/components/RoomPanel.astro create mode 100644 astro/src/components/RoomPanelGrid.astro create mode 100644 astro/src/content/escape-room/themes/virtual.mdx create mode 100644 astro/src/pages/rooms/index.astro create mode 100644 astro/tests/e2e/escape-room-panels.spec.ts diff --git a/astro/src/components/EscapeRoomPanels.astro b/astro/src/components/EscapeRoomPanels.astro new file mode 100644 index 00000000..43ce39e2 --- /dev/null +++ b/astro/src/components/EscapeRoomPanels.astro @@ -0,0 +1,38 @@ +--- +import { getCollection } from "astro:content"; +import { sortBy } from "lodash-es"; +import RoomPanel from "@components/RoomPanel.astro"; +import RoomPanelGrid from "@components/RoomPanelGrid.astro"; + +interface Props { + headingLevel?: "h1" | "h2"; +} + +const { headingLevel } = Astro.props; +const panelHeadingLevel = headingLevel === "h1" ? "h2" : "h3"; +const rooms = sortBy(await getCollection("escapeRoomThemes"), (room) => room.data.title); +--- + + + {rooms.map(({ id, data }) => ( + + ))} + diff --git a/astro/src/components/HeaderER.astro b/astro/src/components/HeaderER.astro index bf89aa39..29b46055 100644 --- a/astro/src/components/HeaderER.astro +++ b/astro/src/components/HeaderER.astro @@ -16,8 +16,8 @@ const { title, brandedTitle = false, crumbs = undefined, } = Astro.props; const breadCrumbs: Breadcrumbs = crumbs ?? [{ name: "Home", href: "/escape-room/" }]; const navLinks = [{ - name: "Build-Your-Own Rooms", - href: "/escape-room/themes", + name: "Escape Rooms", + href: "/rooms/", }, { name: "How it Works", href: "/escape-room/how-it-works", diff --git a/astro/src/components/RoomPanel.astro b/astro/src/components/RoomPanel.astro new file mode 100644 index 00000000..d5aeb004 --- /dev/null +++ b/astro/src/components/RoomPanel.astro @@ -0,0 +1,65 @@ +--- +import { Image } from "astro:assets"; +import type { ImageMetadata } from "astro"; + +interface Props { + title: string; + image: ImageMetadata; + alt?: string; + description: string; + details?: string[]; + borderAfterDetails?: boolean; + availability: string; + theme: string; + href: string; + linkText: string; + linkLabel: string; + headingLevel?: "h2" | "h3"; +} + +const { + title, + image, + alt = "", + description, + details = [], + borderAfterDetails = false, + availability, + theme, + href, + linkText, + linkLabel, + headingLevel: Heading = "h3", +} = Astro.props; +--- + +
+
+ +
+ {title} +

{description}

+ {details.length > 0 && ( +
    + {details.map((detail, index) => ( +
  • + {detail} +
  • + ))} +
+ )} +

{availability}

+ + {linkText} + +
+
+
+ + diff --git a/astro/src/components/RoomPanelGrid.astro b/astro/src/components/RoomPanelGrid.astro new file mode 100644 index 00000000..f628557d --- /dev/null +++ b/astro/src/components/RoomPanelGrid.astro @@ -0,0 +1,28 @@ +--- +import Row from "@components/Row.astro"; + +interface Props { + id: string; + title: string; + description?: string; + headingLevel?: "h1" | "h2"; +} + +const { id, title, description, headingLevel: Heading = "h2" } = Astro.props; +--- + +
+
+ {title} + {description &&

{description}

} +
+ + + +
+ + diff --git a/astro/src/content.config.ts b/astro/src/content.config.ts index 3c8b2f44..96752c8c 100644 --- a/astro/src/content.config.ts +++ b/astro/src/content.config.ts @@ -121,9 +121,14 @@ const escapeRoomThemes = defineCollection({ z.object({ title: z.string(), tagline: z.string(), + format: z.enum(["kit", "virtual"]).default("kit"), + panelDetails: z.array(z.string()), + availability: z.string(), + link: z.string().url().optional(), image: image(), alt: z.string().optional(), - buttonText: z.string().optional().default("Learn more"), + buttonText: z.string(), + buttonLabel: z.string(), page: z.object({ image: image(), theme: z.string().default("dark"), diff --git a/astro/src/content/escape-room/themes/corporate.mdx b/astro/src/content/escape-room/themes/corporate.mdx index 7da455a1..3fd7a448 100644 --- a/astro/src/content/escape-room/themes/corporate.mdx +++ b/astro/src/content/escape-room/themes/corporate.mdx @@ -1,9 +1,16 @@ --- title: A Corporate Conundrum +format: kit tagline: A ground-breaking technology your company has developed is missing. You've received a tip on how to retrieve it. image: /src/images/escape-room/aleksandar-andreev-k2gRTJM9BPw-unsplash.jpg alt: A gentleman wearing dark clothes holding a briefcase buttonText: Learn more +buttonLabel: Learn more about A Corporate Conundrum +panelDetails: + - 6-8 players + - 30 minutes play time + - Set up in your own space +availability: Available as a build-your-own kit or a ready-made kit. page: image: /src/images/escape-room/aleksandar-andreev-k2gRTJM9BPw-unsplash.jpg theme: corporate diff --git a/astro/src/content/escape-room/themes/kitchen.mdx b/astro/src/content/escape-room/themes/kitchen.mdx index 56fa99f8..dedcea31 100644 --- a/astro/src/content/escape-room/themes/kitchen.mdx +++ b/astro/src/content/escape-room/themes/kitchen.mdx @@ -1,9 +1,16 @@ --- title: A Baking Bonanza +format: kit tagline: You are looking for classic recipes to submit to the local fair. Will you find them in time to win the blue ribbon? image: /src/images/escape-room/priscilla-du-preez-SU5jSHu1pK8-unsplash.jpg alt: A freshly baked pie, next to a jar of flour and a rolling pin buttonText: Learn more +buttonLabel: Learn more about A Baking Bonanza +panelDetails: + - 4-6 players + - 20 minutes play time + - Set up in your own space +availability: Available as a build-your-own kit or a ready-made kit. page: image: /src/images/escape-room/priscilla-du-preez-SU5jSHu1pK8-unsplash.jpg theme: kitchen diff --git a/astro/src/content/escape-room/themes/virtual.mdx b/astro/src/content/escape-room/themes/virtual.mdx new file mode 100644 index 00000000..440817ce --- /dev/null +++ b/astro/src/content/escape-room/themes/virtual.mdx @@ -0,0 +1,19 @@ +--- +title: Virtual Escape Room +format: virtual +tagline: A piece of ground-breaking technology your company has developed is missing. You've received a tip on how to retrieve it. +image: /src/images/escape-room/aleksandar-andreev-k2gRTJM9BPw-unsplash.jpg +buttonText: Learn more +buttonLabel: Learn more about Virtual Escape Room +panelDetails: + - 4-X players + - X minutes play time +availability: Access our virtual escape room from the .......... +link: mailto:escaperoom@accessiblecommunity.org?subject=Virtual%20Escape%20Room +page: + image: /src/images/escape-room/aleksandar-andreev-k2gRTJM9BPw-unsplash.jpg + theme: kitchen +about: + players: 4-X + length: X minutes +--- diff --git a/astro/src/layouts/EscapeRoomLayout.astro b/astro/src/layouts/EscapeRoomLayout.astro index 0abbeb19..5424bda7 100644 --- a/astro/src/layouts/EscapeRoomLayout.astro +++ b/astro/src/layouts/EscapeRoomLayout.astro @@ -13,8 +13,8 @@ import Row from "../components/Row.astro"; // Single these from the Header. const navLinks = [{ - name: "Build-Your-Own Rooms", - href: "/escape-room/themes", + name: "Escape Rooms", + href: "/rooms/", }, { name: "How it Works", href: "/escape-room/how-it-works", diff --git a/astro/src/pages/escape-room/index.astro b/astro/src/pages/escape-room/index.astro index 61c3eb8e..ca531df4 100644 --- a/astro/src/pages/escape-room/index.astro +++ b/astro/src/pages/escape-room/index.astro @@ -2,8 +2,6 @@ import type { Breadcrumbs, PageMetadata } from "@lib/types"; import { getOpenGraphImageData } from "@lib/og-image"; -import { getCollection, type CollectionEntry } from "astro:content"; -import { sortBy } from "lodash-es"; const title = "Home"; const metadata: PageMetadata = { @@ -12,12 +10,6 @@ const metadata: PageMetadata = { image: getOpenGraphImageData(Astro.site, "pages", "escape-room"), }; const crumbs: Breadcrumbs = []; -const rooms: Array> = - sortBy( - await getCollection("escapeRoomThemes"), - (room: CollectionEntry<"escapeRoomThemes">) => room.data.title - ); - import Branding from "@components/Branding.astro"; import Column from "@components/Column.astro"; @@ -27,7 +19,7 @@ import EscapeRoomLayout from "src/layouts/EscapeRoomLayout.astro"; import FlexColumn from "@components/FlexColumn.astro"; import Row from "@components/Row.astro"; import ThemedSection from "@components/ThemedSection.astro"; -import ImageCard from "@components/ImageCard.astro"; +import EscapeRoomPanels from "@components/EscapeRoomPanels.astro"; // TODO: Once the `peerDependencies are update, use the plugin. // import { YouTube } from 'astro-lazy-youtube-embed' import YouTube from "@components/YouTube.astro"; @@ -52,7 +44,7 @@ import woodenPuzzles from "src/images/escape-room/wooden-puzzles.png"; Explore our rooms @@ -91,6 +83,10 @@ import woodenPuzzles from "src/images/escape-room/wooden-puzzles.png"; + + + +

I like puzzles. I would like to play.

@@ -118,45 +114,6 @@ import woodenPuzzles from "src/images/escape-room/wooden-puzzles.png";
- -

Our build-your-own rooms.

-

- Requests for the Accessible Escape Room have gone beyond - our ability to run them. Instead, we are providing kits to build and run your - own accessible escape room! Each kit includes information on what to purchase, - how to build and run the escape room, and access to all the electronic files - for the escape room you select. -

-

- If you would like to bring one of our accessible escape rooms to your business - or venue, we now offer the following themes:

- - - { - rooms.map(room => ( - -

- - )) - } - -

- If you are interested in purchasing, please email us at escaperoom@accessiblecommunity.org. -

- diff --git a/astro/tests/e2e/escape-room-panels.spec.ts b/astro/tests/e2e/escape-room-panels.spec.ts new file mode 100644 index 00000000..9af8b34c --- /dev/null +++ b/astro/tests/e2e/escape-room-panels.spec.ts @@ -0,0 +1,71 @@ +import AxeBuilder from "@axe-core/playwright"; +import { expect, test } from "@playwright/test"; + +const layouts = [ + { name: "mobile", width: 390, columns: 1 }, + { name: "tablet", width: 768, columns: 2 }, + { name: "desktop", width: 1440, columns: 3 }, +]; + +for (const path of ["/escape-room/", "/rooms/"]) { + for (const layout of layouts) { + for (const colorScheme of ["light", "dark"] as const) { + test(`${path} room panels at ${layout.name} in ${colorScheme} mode`, async ({ page }) => { + await page.setViewportSize({ width: layout.width, height: 900 }); + await page.emulateMedia({ colorScheme }); + const response = await page.goto(path); + expect(response?.ok()).toBe(true); + + const section = page.getByRole("region", { name: "Our Rooms" }); + const cards = section.getByRole("article"); + await expect(cards).toHaveCount(3); + await expect(section.getByRole("heading", { level: path === "/rooms/" ? 2 : 3 })).toHaveText([ + "A Baking Bonanza", + "A Corporate Conundrum", + "Virtual Escape Room", + ]); + await expect(section.getByRole("link", { name: "Learn more about A Baking Bonanza" })) + .toHaveAttribute("href", "/escape-room/themes/kitchen/"); + await expect(section.getByRole("link", { name: "Learn more about A Corporate Conundrum" })) + .toHaveAttribute("href", "/escape-room/themes/corporate/"); + await expect(section.getByText("Set up in your own space", { exact: true })).toHaveCount(2); + const virtualRoom = cards.filter({ has: page.getByRole("heading", { name: "Virtual Escape Room" }) }); + await expect(virtualRoom.getByText(/^Access our virtual escape room/)).toBeVisible(); + await expect(virtualRoom.getByRole("listitem")).toHaveText(["4-X players", "X minutes play time"]); + await expect(virtualRoom.getByRole("link", { name: "Learn more about Virtual Escape Room" })) + .toHaveAttribute("href", /^mailto:escaperoom@accessiblecommunity\.org/); + + for (const card of await cards.all()) { + const gap = await card.evaluate((element) => { + const details = element.querySelector("ul")!; + const availability = details.nextElementSibling!; + return availability.getBoundingClientRect().top - details.getBoundingClientRect().bottom; + }); + expect(gap).toBeGreaterThanOrEqual(24); + } + + const bounds = await cards.evaluateAll((elements) => + elements.map((element) => { + const { top, left, right } = element.getBoundingClientRect(); + return { top, left, right }; + }), + ); + expect(bounds.filter(({ top }) => top === bounds[0].top)).toHaveLength(layout.columns); + for (const { left, right } of bounds) { + expect(left).toBeGreaterThanOrEqual(0); + expect(right).toBeLessThanOrEqual(layout.width); + } + + const results = await new AxeBuilder({ page }).include("#our-rooms").analyze(); + expect(results.violations).toEqual([]); + }); + } + } +} + +test("the escape-room homepage links to the new rooms listing", async ({ page }) => { + await page.goto("/escape-room/"); + await page.getByRole("link", { name: "Explore our rooms" }).click(); + await expect(page).toHaveURL(/\/rooms\/$/); + await expect(page.getByRole("heading", { name: "Our Rooms", level: 1 })).toBeVisible(); +});