Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/pages/RedirectPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ export function RedirectPage() {
const showsBoardsLink = view.action !== "confirm" && view.action !== "forward";

return (
<Shell links={showsBoardsLink ? <TextLink href="boards.html">Boards this browser remembers</TextLink> : null}>
<Shell
showBrandIcon={view.action !== "forward"}
links={showsBoardsLink ? <TextLink href="boards.html">Boards this browser remembers</TextLink> : null}
>
{/* One heading element for every view, so the focus the effect moves to
it survives the switch from the prerendered "forward" view. */}
<PageHeading ref={title} icon={ICONS[view.action]} description={DESCRIPTIONS[view.action]}>
Expand Down
12 changes: 10 additions & 2 deletions src/pages/Shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ import type { ReactNode, Ref } from "react";

const README_URL = "https://github.com/Fiestaboard/auth#readme";

export function Shell({ children, links }: { children: ReactNode; links?: ReactNode }) {
export function Shell({
children,
links,
showBrandIcon = true,
}: {
children: ReactNode;
links?: ReactNode;
showBrandIcon?: boolean;
}) {
return (
<main className="flex min-h-dvh flex-col items-center justify-center px-4 py-8 sm:py-12">
<Stack gap="6" align="center" className="w-full max-w-md">
<Flex align="center" gap="3">
<FiestaIcon size={36} className="shrink-0" />
{showBrandIcon && <FiestaIcon size={36} className="shrink-0" />}
<FiestaLogo className="text-2xl" />
</Flex>
<Card className="w-full shadow-modal">{children}</Card>
Expand Down
12 changes: 11 additions & 1 deletion tests/dist.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ for (const page of PAGES) {
const urls = [
...attributes(html, "script", "src"),
...attributes(html, "link", "href"),
...attributes(html, "img", "src"),
];
assert.ok(urls.length > 0);
for (const url of urls) {
Expand All @@ -65,6 +64,17 @@ for (const page of PAGES) {
}
});

test(`${page} loads images from this site or embeds the loading artwork`, () => {
for (const url of attributes(html, "img", "src")) {
if (url.startsWith("data:")) {
assert.match(url, /^data:image\/(png|webp);base64,[A-Za-z0-9+/]+={0,2}$/);
} else {
assert.doesNotMatch(url, /^([a-z][a-z0-9+.-]*:|\/)/i, "image URL must be relative");
assert.ok(existsSync(resolve(dist, dirname(page), url)), `${url} does not exist in dist`);
}
}
});

test(`${page} is prerendered`, () => {
assert.doesNotMatch(html, /<!--app-->/);
assert.match(html, /<div id="root"><main\b/);
Expand Down
Loading