From a10ff6d75f7428f1b04263b8f7bb2958e0acb178 Mon Sep 17 00:00:00 2001 From: Aidan Dona Date: Sat, 17 Oct 2026 00:43:59 -0500 Subject: [PATCH] Rotating words: {Next|Now} in titles and text cycles through its choices Migration 084: site defaults for the motion (slide, flip, fade, type, mirror), direction and seconds per word in Site settings, and a hero's and a block's own. The hero's headline, section and band titles, headings, paragraphs, callouts and quotes rotate; menus, tab titles, search text and emails show the first word; less motion shows it still. Co-Authored-By: Claude Opus 5.5 --- TODO.md | 10 +- docs/updating-data-in-code.md | 8 ++ server/src/admin-schema/columns.js | 4 + server/src/admin-schema/sitePages.js | 4 + server/src/admin-schema/siteSettings.js | 6 +- server/src/migrations/084_rotating_words.sql | 37 ++++++ server/src/pageMeta.js | 5 + server/src/sectionData.js | 2 + server/src/shape.js | 7 +- src/components/ContentBlocks.tsx | 8 +- src/components/InlineText.tsx | 10 +- src/components/PageShell.tsx | 10 +- src/components/RotatingWords.css | 94 ++++++++++++++ src/components/RotatingWords.tsx | 117 ++++++++++++++++++ src/lib/adminSchema/shared.ts | 40 ++++++ src/lib/adminSchema/sitePages.ts | 3 +- src/lib/adminSchema/siteSettings.ts | 10 ++ src/lib/navSections.ts | 3 +- src/lib/newsletter.ts | 6 +- src/lib/sectionTypes.ts | 2 + src/lib/site.ts | 13 +- src/lib/useContent.ts | 2 + src/lib/words.ts | 10 ++ src/pages/SitePage.tsx | 5 +- src/pages/sections/home/CalendarBand.tsx | 3 +- src/pages/sections/home/FeaturedBand.tsx | 3 +- .../sections/home/FeaturedTimelineRail.tsx | 5 +- src/pages/sections/home/HeroStage.tsx | 8 +- src/pages/sections/home/Pathfinder.tsx | 8 +- src/pages/sections/home/StatsBand.tsx | 5 +- 30 files changed, 411 insertions(+), 37 deletions(-) create mode 100644 server/src/migrations/084_rotating_words.sql create mode 100644 src/components/RotatingWords.css create mode 100644 src/components/RotatingWords.tsx create mode 100644 src/lib/words.ts diff --git a/TODO.md b/TODO.md index 8ec6990..8688420 100644 --- a/TODO.md +++ b/TODO.md @@ -42,12 +42,6 @@ - [ ] Linked from the footer next to the version, or only in the blog? Answer: ## Sections -- [ ] **Hero text that flips**: the headline's word changes (Next, Now, and other words for our generation), or mirrors. - - [ ] Which words, and are they edited in Front page (a list) or fixed? Answer: Next cycles through words with an animation, allow us to customize this and the list of words, this should be a text content component that can be used places. also direction from where the words slide in, top or bottom. - - [ ] What motion: a flip like a card, a fade, letters typing, a mirror? Answer: make all of these. - - [ ] Respect reduced motion by showing one word (the first)? [ ] yes - - [ ] "Next generation of New Thought": is that the line it plays on, or a second line under the headline? Answer: Unity should also be another one of these animated words that cycles through a list. - - Settled 2026-10-16: words are written inline, {Next|Now|Rising}, in the hero headline, section titles, headings and paragraphs; motion (slide, flip, fade, type, mirror), direction (from top or bottom) and seconds per word have site defaults in Site settings, overridden by the hero or a block. ## Page Features - [ ] **Full profiles**: people get full profile pages. Profile accounts, claiming and visibility are done (Part 2, Accounts); what's left is the page itself. @@ -123,7 +117,9 @@ # Part 2: Done -## Page management (branch `page-management`, on top of `page-features`, no PR yet; migrations 080 to 083, back up the database before deploying) +## Page management (branch `page-management`, on top of `page-features`, no PR yet; migrations 080 to 084, back up the database before deploying) +- [x] **Rotating words** (Sections, migration 084): text typed as `{Next|Now|Rising}` cycles through its choices, in the hero's headline, section titles (bands' too), headings, paragraphs, callouts and quotes, eg. `{Next|Now} Generation of {Unity|New Thought}`. Five motions (slide, flip like a card, fade, type letter by letter, mirror turning round), from the top or the bottom, a number of seconds per word: defaults in Site settings → Animated words, and a hero or a block can set its own. Each word's space is the longest's, so the line doesn't jump. Less motion (the system's setting, or reading mode) shows the first word, still, and screen readers always get the first; menus, tab titles, search descriptions and newsletters use the first word too (`src/components/RotatingWords.tsx`, `src/lib/words.ts`). + - [ ] Check in a browser: each motion and direction, a group in a section title and a paragraph, the space it keeps on a phone, reduced motion. - [x] **Section types with their own settings, and the front page as sections** (migration 083): the front page is Home in Page management, a page of sections like the others: its hero first, then its bands in their old order (hidden ones stay hidden), each a section type that can go on any page with content of its own: Hero (words, buttons, photos, video, livestream or event), Event countdown, Event calendar, Numbers, Featured cards, Connect nav, and a Timeline shown as the rail of featured moments. The Community blog's slots, pinned posts and feeds moved into its section, so it can go on any page too. Any section can be Hidden. The Front page editor is gone (its fields are each section's), and so are its tables and the Community page's. On the front page the bands look as they did and any other section is a band in the same style; on other pages a band brings its own heading. The National Retreats band became an Events section with an All retreats button. The newsletter's "featured cards" come from the front page's featured card sections. Admin engine: a child collection can have its own side tables and gated nested collections. - [ ] Check in a browser: the front page (every band, the countdown overlapping the hero, reading mode, the menu's Home dropdown), editing the hero and a band in Page management, a Hero and a Numbers section put on another page, hiding a section, the Community blog (pinned posts, feeds), a draft preview of the front page, the newsletter's featured cards. - [x] **Core pages as sections** (migrations 081, 082): Feedback, Request, QR codes, Give, Privacy and Terms are pages of sections now, edited in Page management like any other. Their forms and embeds are section types any page can use (Website feedback form, Request form, Data request form, Giving button, QR code maker); Give's words, and all of Privacy and Terms, are blocks (headings, paragraphs, lists), with "Last updated" in the section's blurb. The privacy contact email was written into the policy's text and its Site settings field is gone. These pages keep their address (the site's code links to them) and can't be deleted. The privacy notice's link now goes to #cookies-and-browser-storage. diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index 227a027..0a26bc9 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -287,6 +287,14 @@ A Numbers section's "Number Source" dropdown works the same way: ## Writing text in the editor +Rotating words: type the choices in braces, `{Next|Now|Rising}`, in a +hero headline, a section title, a heading, a paragraph, a callout or a +quote, and the word cycles through them. How it moves is Admin → +Panel → Site settings → Animated words, or the hero's or block's own +Rotating words fields. Menus, tab titles, search and emails show the +first choice. The component is `src/components/RotatingWords.tsx`; its +motions are CSS in `RotatingWords.css`. + Conventions for any label, help text or option added to the admin, so the editor reads consistently: diff --git a/server/src/admin-schema/columns.js b/server/src/admin-schema/columns.js index d524795..b39f6d5 100644 --- a/server/src/admin-schema/columns.js +++ b/server/src/admin-schema/columns.js @@ -164,6 +164,10 @@ export const blocksChild = (ownerKind) => ({ text("cite"), // Video blocks only (066): an uploaded video's WebVTT file. text("captions"), + // Its rotating words (084): blank keeps the site's. + enumeration("word_motion", ["slide", "flip", "fade", "type", "mirror"]), + enumeration("word_direction", ["top", "bottom"]), + int("word_seconds"), // People blocks only (054): whose team's tiles to show. text("team_id"), ], diff --git a/server/src/admin-schema/sitePages.js b/server/src/admin-schema/sitePages.js index 97e387a..d5be89c 100644 --- a/server/src/admin-schema/sitePages.js +++ b/server/src/admin-schema/sitePages.js @@ -84,6 +84,10 @@ const sectionsChild = { text("video_captions"), text("video_still"), text("event_id"), + // Its rotating words (084). + enumeration("word_motion", ["slide", "flip", "fade", "type", "mirror"]), + enumeration("word_direction", ["top", "bottom"]), + int("word_seconds"), ], }, { diff --git a/server/src/admin-schema/siteSettings.js b/server/src/admin-schema/siteSettings.js index d2621eb..dd6f88a 100644 --- a/server/src/admin-schema/siteSettings.js +++ b/server/src/admin-schema/siteSettings.js @@ -1,5 +1,5 @@ import { THEME_TOKENS, checkTheme } from "../theme.js"; -import { text, enumeration } from "./columns.js"; +import { text, int, enumeration } from "./columns.js"; /* ── Site settings (035_site_settings.sql) ────────────────────── A singleton of overrides for what site.json says: name, @@ -36,6 +36,10 @@ export const siteSettings = { text("access_group_admin"), enumeration("report_daily", ["on", "off"]), enumeration("report_weekly", ["on", "off"]), + // Rotating words' defaults (084). + enumeration("word_motion", ["slide", "flip", "fade", "type", "mirror"]), + enumeration("word_direction", ["top", "bottom"]), + int("word_seconds"), ], children: [ diff --git a/server/src/migrations/084_rotating_words.sql b/server/src/migrations/084_rotating_words.sql new file mode 100644 index 0000000..ee64302 --- /dev/null +++ b/server/src/migrations/084_rotating_words.sql @@ -0,0 +1,37 @@ +-- ═══════════════════════════════════════════════════════════════ +-- 084 ROTATING WORDS +-- +-- A word typed as {Next|Now|Rising} in a title or text cycles +-- through its choices (src/components/RotatingWords.tsx). How it +-- moves: +-- +-- word_motion slide, flip, fade, type or mirror +-- word_direction top or bottom: where a sliding or flipping word +-- comes from +-- word_seconds how long each word shows, 1 to 20 +-- +-- Site settings hold the defaults (null: slide, from the bottom, 3 +-- seconds); a hero and a content block can each set their own, null +-- keeping the site's. +-- ═══════════════════════════════════════════════════════════════ + +ALTER TABLE site_settings ADD COLUMN word_motion TEXT + CHECK (word_motion IN ('slide', 'flip', 'fade', 'type', 'mirror')); +ALTER TABLE site_settings ADD COLUMN word_direction TEXT + CHECK (word_direction IN ('top', 'bottom')); +ALTER TABLE site_settings ADD COLUMN word_seconds INTEGER + CHECK (word_seconds BETWEEN 1 AND 20); + +ALTER TABLE section_hero ADD COLUMN word_motion TEXT + CHECK (word_motion IN ('slide', 'flip', 'fade', 'type', 'mirror')); +ALTER TABLE section_hero ADD COLUMN word_direction TEXT + CHECK (word_direction IN ('top', 'bottom')); +ALTER TABLE section_hero ADD COLUMN word_seconds INTEGER + CHECK (word_seconds BETWEEN 1 AND 20); + +ALTER TABLE content_blocks ADD COLUMN word_motion TEXT + CHECK (word_motion IN ('slide', 'flip', 'fade', 'type', 'mirror')); +ALTER TABLE content_blocks ADD COLUMN word_direction TEXT + CHECK (word_direction IN ('top', 'bottom')); +ALTER TABLE content_blocks ADD COLUMN word_seconds INTEGER + CHECK (word_seconds BETWEEN 1 AND 20); diff --git a/server/src/pageMeta.js b/server/src/pageMeta.js index 50685d8..f6054e4 100644 --- a/server/src/pageMeta.js +++ b/server/src/pageMeta.js @@ -100,6 +100,8 @@ export function siteFor(db) { ...base.robots, index: row.indexing ? row.indexing === "on" : base.robots?.index !== false, }, + // Rotating words' defaults (084): blank is the app's own. + words: { motion: row.word_motion ?? null, direction: row.word_direction ?? null, seconds: row.word_seconds ?? null }, // The admin's colors (theme.js): only #rrggbb values and fixed // text, so safe inside