feat: enhance signup form with new styling and noindex functionality

Added new CSS styles for the signup form, including a grid layout and improved note visibility. Updated the application logic to include a noindex option for specific pages, ensuring search engines do not index sensitive content. Modified tests to verify the presence of new elements and the correct application of noindex headers.
This commit is contained in:
blake committed 2026-11-02 11:46:46 -06:00
1 parent 019f61bc4a
commit ffec79cbec
5 files changed
+52 -5

No files matched your search

+7 -1
View File
@@ -71,6 +71,8 @@ export function createApp(
at,
`${only.title} · Hope Volunteer`,
<EventPage config={config} event={only} now={at} month={c.req.query('month')} view={c.req.query('view')} path="/" />,
200,
{ noindex: true },
);
}
return page(
@@ -99,6 +101,8 @@ export function createApp(
at,
`${event.title} · Hope Volunteer`,
<EventPage config={config} event={event} now={at} month={c.req.query('month')} view={c.req.query('view')} />,
200,
{ noindex: true },
);
});
@@ -142,11 +146,13 @@ function page(
title: string,
body: Child,
status: 200 | 404 | 500 = 200,
options?: { noindex?: boolean },
) {
c.header('Cache-Control', 'no-store');
if (options?.noindex) c.header('X-Robots-Tag', 'noindex');
const account = readSession(db, c.req.header('cookie'), now);
return c.html(
<Layout config={config} title={title} path={c.req.path} account={account ? { csrf: account.csrf } : null}>
<Layout config={config} title={title} path={c.req.path} noindex={options?.noindex} account={account ? { csrf: account.csrf } : null}>
{body}
</Layout>,
status,
+7 -2
View File
@@ -26,6 +26,7 @@ export function Layout(props: {
title: string;
path?: string;
turnstile?: boolean;
noindex?: boolean;
account?: { csrf: string } | null;
children?: Child;
}) {
@@ -44,6 +45,7 @@ export function Layout(props: {
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
{props.noindex ? <meta name="robots" content="noindex" /> : null}
<title>{props.title}</title>
<link rel="icon" href={asset(props.config, '/img/favicons/favicon.png')} />
<link rel="apple-touch-icon" href={asset(props.config, '/img/favicons/favicon-apple.png')} />
@@ -1041,7 +1043,10 @@ function SignupForm(props: { config: AppConfig; shiftId: number; remaining: numb
return (
<form class="signup-form" method="post" action={appPath(props.config, `/s/${props.shiftId}`)}>
<h2>Sign up</h2>
<p>Choose how many people are coming, including you. This signup holds that many spots under your name. Another person can use the same email address.</p>
<div class="signup-lead">
<p>Choose how many people are coming, including you. This signup holds that many spots under your name. Another person can use the same email address.</p>
<p class="signup-note">Your full name is listed on the public sign-up page. Email, phone, and notes stay off that page.</p>
</div>
<noscript>
<p class="error">Signing up needs JavaScript for the abuse check. The pantry has not published a contact method for help with signup.</p>
</noscript>
@@ -1110,7 +1115,7 @@ function SignupForm(props: { config: AppConfig; shiftId: number; remaining: numb
) : null}
</label>
<div class="cf-turnstile" data-sitekey={form.siteKey} data-action="signup" />
<p id="signup-turnstile-hint">This check confirms the signup came from a browser.</p>
<p class="signup-note" id="signup-turnstile-hint">This check confirms the signup came from a browser.</p>
<button type="submit">Sign up</button>
</form>
);