style: 14px text floor and one shared status wording

- app.css: add --hope-text-small (14px) and --hope-text-fine (13px, footer
  fine print). Every font size below 14px now uses them. The help-tip circle,
  event badge and date stamp grow to fit the larger text.
- schedule.ts: shared filledCount(), spotsSentence() and fillLabel().
  Public pages say "4 of 6 spots filled"; coordinator pills say
  "Full · 6 of 6" or "2 open · 4 of 6" (needs tone when under half full).
- admin-pages.tsx: drop needCopy(); dashboard, event page and shift lines
  all use fillLabel().
- tests: update wording expectations; add design-rules.test.ts to guard the
  14px floor and the wording.
- README: update example wording.
This commit is contained in:
Cosmically Creative committed 2026-11-20 13:24:23 -06:00
1 parent 085f2dc668
commit 1230030e39
9 files changed
+112 -67

No files matched your search

+2 -2
View File
@@ -266,7 +266,7 @@ describe('coordinator screens', () => {
expect(html).toContain('Today, 4:00 PM');
expect(html).toContain('2 open · 4 of 6');
expect(html).toContain('Tue, Oct 27, 4:00 PM');
expect(html).toContain('Needs 4 · 2 of 6');
expect(html).toContain('4 open · 2 of 6');
expect(html).toContain('Sat, Oct 24 Sorting crew is full.');
expect(html).toContain('Wed, Oct 28, 9:00 AM');
expect(html).not.toContain('Later shift');
@@ -589,7 +589,7 @@ describe('coordinator screens', () => {
expect(roster).not.toContain('No-show');
const sourceRoster = await (await app.request(`/admin/shifts/${sourceId}`, { headers: { cookie } })).text();
expect(sourceRoster).not.toContain(`/admin/signups/${signupId}/move`);
expect(sourceRoster).toContain('0/2 spots filled');
expect(sourceRoster).toContain('0 of 2 spots filled');
expect(sourceRoster).toContain('event-pill is-open');
const home = await (await app.request('/e/pantry?view=calendar')).text();
const shiftPage = await (await app.request(`/s/${destinationId}`)).text();
+8 -8
View File
@@ -48,7 +48,7 @@ describe('manage-link cancellation', () => {
expect(before.created_at).toBe(before.updated_at);
const full = await app.request(`/s/${shiftId}`);
expect(await full.text()).toContain('1/1 spots filled');
expect(await full.text()).toContain('1 of 1 spots filled');
const cancelled = await postCancel(app, managePath, token);
expect(cancelled.status).toBe(303);
@@ -73,7 +73,7 @@ describe('manage-link cancellation', () => {
const open = await app.request(`/s/${shiftId}`);
const openHtml = await open.text();
expect(openHtml).toContain('0/1 spots filled');
expect(openHtml).toContain('0 of 1 spots filled');
expect(openHtml).not.toContain('pat.cancel@example.invalid');
const again = await postCancel(app, managePath, token, { ip: '203.0.113.71' });
@@ -87,7 +87,7 @@ describe('manage-link cancellation', () => {
{ status: 'cancelled' },
{ status: 'confirmed' },
]);
expect((await (await app.request(`/s/${shiftId}`)).text())).toContain('1/1 spots filled');
expect((await (await app.request(`/s/${shiftId}`)).text())).toContain('1 of 1 spots filled');
const listed = await (await app.request('/?view=calendar')).text();
expect(listed).toContain('Pat Cancel');
expect(listed).not.toContain('pat.cancel@example.invalid');
@@ -215,8 +215,8 @@ describe('manage-link switch', () => {
const home = await (await app.request('/?view=calendar')).text();
expect(home).not.toContain('pat.switch@example.invalid');
expect(home).toContain('Pat Cancel');
expect(home).toContain('0/2 spots filled');
expect(home).toContain('1/2 spots filled');
expect(home).toContain('0 of 2 spots filled');
expect(home).toContain('1 of 2 spots filled');
const again = await postSwitch(app, managePath, html, String(destinationId));
expect(again.status).toBe(200);
@@ -376,7 +376,7 @@ describe('manage-link party size', () => {
}]);
expect(db.prepare('SELECT COUNT(*) AS n FROM contacts').get()).toEqual({ n: 1 });
expect(db.prepare("SELECT kind, status FROM outbox").all()).toEqual([{ kind: 'confirmation', status: 'pending' }]);
expect(await (await app.request(`/s/${shiftId}`)).text()).toContain('1/6 spots filled');
expect(await (await app.request(`/s/${shiftId}`)).text()).toContain('1 of 6 spots filled');
const board = await (await app.request('/?view=calendar')).text();
expect(board).toContain('Pat Party');
expect(board).not.toContain('Pat Party (4 people)');
@@ -404,7 +404,7 @@ describe('manage-link party size', () => {
{ name: 'Pat Party', group_size: 3 },
{ name: 'Sam Other', group_size: 1 },
]);
expect(await (await tight.app.request(`/s/${tight.shiftId}`)).text()).toContain('4/4 spots filled');
expect(await (await tight.app.request(`/s/${tight.shiftId}`)).text()).toContain('4 of 4 spots filled');
const wide = await buildApp({ capacity: 25 });
const opened = await postSignup(wide.app, wide.shiftId, { name: 'Pat Party', email: 'pat.wide@example.invalid', partySize: '1' }, '203.0.113.122');
@@ -426,7 +426,7 @@ describe('manage-link party size', () => {
group_size: 20,
status: 'confirmed',
}]);
expect(await (await wide.app.request(`/s/${wide.shiftId}`)).text()).toContain('20/25 spots filled');
expect(await (await wide.app.request(`/s/${wide.shiftId}`)).text()).toContain('20 of 25 spots filled');
});
it('refuses a party update that did not come from this signup page', async () => {
+36
View File
@@ -0,0 +1,36 @@
import fs from 'node:fs';
import path from 'node:path';
import { describe, expect, it } from 'vitest';
import { fillLabel, spotsSentence } from '../src/schedule.js';
const css = fs.readFileSync(path.join(import.meta.dirname, '..', 'public', 'css', 'app.css'), 'utf8');
/** Smallest text in the app is 14px. Footer fine print may use 13px. */
function pixels(value: string): number | null {
const match = /^([0-9.]+)(rem|px)$/.exec(value.trim());
if (!match) return null;
return match[2] === 'rem' ? Number(match[1]) * 16 : Number(match[1]);
}
describe('design rules', () => {
it('keeps text at 14px or larger', () => {
const small = [...css.matchAll(/font-size:\s*([^;]+);/g)]
.map((match) => match[1] ?? '')
.filter((value) => {
const px = pixels(value);
return px !== null && px < 14;
});
expect(small).toEqual([]);
expect(css).toContain('--hope-text-small: 0.875rem;');
expect(css).toContain('--hope-text-fine: 13px;');
});
it('counts filled spots the same way everywhere', () => {
expect(spotsSentence({ occupied: 4, capacity: 6 })).toBe('4 of 6 spots filled');
expect(spotsSentence({ occupied: 9, capacity: 6 })).toBe('6 of 6 spots filled');
expect(fillLabel({ occupied: 6, capacity: 6 })).toEqual({ tone: 'full', text: 'Full · 6 of 6' });
expect(fillLabel({ occupied: 4, capacity: 6 })).toEqual({ tone: 'open', text: '2 open · 4 of 6' });
expect(fillLabel({ occupied: 3, capacity: 6 })).toEqual({ tone: 'open', text: '3 open · 3 of 6' });
expect(fillLabel({ occupied: 2, capacity: 6 })).toEqual({ tone: 'needs', text: '4 open · 2 of 6' });
});
});
+7 -7
View File
@@ -40,8 +40,8 @@ describe('public pages', () => {
expect(home.headers.get('x-robots-tag')).toBe('noindex');
expect(html).toContain('class="roster-mark" src="/img/sunburst.png?v=');
expect(html).toContain('Live Greeting');
expect(html).toContain('0/2 spots filled');
expect(html).toContain('1/4 spots filled');
expect(html).toContain('0 of 2 spots filled');
expect(html).toContain('1 of 4 spots filled');
expect(html).toContain('9:00 AM');
expect(html).toContain('CDT');
expect(html).toContain('October 14');
@@ -131,8 +131,8 @@ describe('public pages', () => {
expect(calendar).toContain('October 2026');
expect(calendar).toContain('Open Sorting');
expect(calendar).toContain('Full Intake');
expect(calendar).toContain('1/3 spots filled');
expect(calendar).toContain('1/1 spots filled');
expect(calendar).toContain('1 of 3 spots filled');
expect(calendar).toContain('1 of 1 spots filled');
expect(calendar).toContain('class="cal-line"');
expect(calendar).toContain('Past Setup');
expect(calendar).toContain('class="cal-shift is-ended"');
@@ -161,7 +161,7 @@ describe('public pages', () => {
const shiftMain = shiftHtml.slice(shiftHtml.indexOf('<main'), shiftHtml.indexOf('class="footer"'));
expect(shiftMain).not.toContain('Weekly pantry');
expect(shiftMain).not.toContain('sunburst');
expect(shiftHtml).toContain('1/3 spots filled');
expect(shiftHtml).toContain('1 of 3 spots filled');
expect(shiftHtml).toContain('spots is-open');
expect(shiftHtml).toContain('<form');
expect(shiftHtml).toContain('name="first_name"');
@@ -199,7 +199,7 @@ describe('public pages', () => {
const full = await app.request(`/s/${ids.full}`);
const fullHtml = await full.text();
expect(fullHtml).toContain('1/1 spots filled');
expect(fullHtml).toContain('1 of 1 spots filled');
expect(fullHtml).toContain('spots is-full');
expect(fullHtml).not.toContain('<form');
@@ -476,7 +476,7 @@ describe('public pages', () => {
const html = await (await app.request('/')).text();
const start = html.indexOf('Full Wednesday');
const pane = html.slice(html.lastIndexOf('<section class="shift-pane"', start), html.indexOf('</section>', start));
expect(pane).toContain('1/1 spots filled');
expect(pane).toContain('1 of 1 spots filled');
expect(pane).toContain('class="btn-card is-static"');
expect(pane).toContain('>Full</span>');
expect(pane).toContain('Not accepting more signups');
+1 -1
View File
@@ -319,7 +319,7 @@ describe('capacity-safe signup', () => {
expect(manageHtml).toContain('People');
expect(manageHtml).toContain('>3<');
const shiftHtml = await (await app.request(`/s/${shiftId}`)).text();
expect(shiftHtml).toContain('3/4 spots filled');
expect(shiftHtml).toContain('3 of 4 spots filled');
const board = await (await app.request('/?view=calendar')).text();
expect(board).toContain('Pat Review (3 people)');
expect(board).not.toContain('Pat Review (3 people), Pat Review');