Feature fixes: admin nav, hero event, schedule block, SEO, site settings, Google sign-in, QR tool #12
7 changed files with 187 additions and 11 deletions
|
|
@ -181,7 +181,7 @@ also in `admin-schema.js` and a CHECK):
|
|||
| Timeline → Precision (and on events/orgs) | year, month, day | no | the history page's grouping |
|
||||
| Front page → Countdown → Only this type | retreat, class, workshop, meeting, other | **yes** | `server/src/routes/home.js` (picks the countdown event). The same values as Events → Type, so adding a type widens both CHECKs. |
|
||||
| Front page → Background | brand, photos | **yes** | `HeroStage.tsx` |
|
||||
| Front page → Feature | none, livestream, video | **yes** | `HeroStage.tsx` |
|
||||
| Front page → Feature | none, livestream, video, event | **yes** | `HeroStage.tsx`; the event is picked in `server/src/routes/home.js` |
|
||||
| Front page → Sections → Section | countdown, retreats, calendar, stats, timeline, connect, featured | **yes**, `FRONT_PAGE_SECTIONS` | `SECTIONS` in `src/pages/Home.tsx`; see [below](#front-page-section-names) |
|
||||
| Front page → Stats → Number Source | manual, years_since, regions, … | **yes**, `STAT_SOURCES` | `STAT_QUERIES` in `server/src/routes/home.js`; see [below](#front-page-stat-sources) |
|
||||
| Front page → Featured cards → Card type (Community blog section → Pinned community posts offers link and video only) | record, link, video | **yes**, `FEATURED_KINDS` | `FeaturedCards.tsx` (how each kind draws), `loadFeaturedCards` in `server/src/shape.js` |
|
||||
|
|
@ -204,7 +204,7 @@ code):
|
|||
| Timeline → Record; Featured cards → Record | `record_refs` | every event, organization, award, person and team, narrowed by the type picked beside it |
|
||||
| Affiliations → Team | `teams` | teams, filtered to the chosen organization |
|
||||
| Person awards → Award | `awards` | awards, labelled "Award (Organization)" |
|
||||
| Person awards → Presented at; Front page → Count down to | `events` | events |
|
||||
| Person awards → Presented at; Front page → Count down to; Front page → Featured event | `events` | events |
|
||||
| Timeline → Record | `timeline_refs` | all five kinds, filtered by "Points at" |
|
||||
|
||||
---
|
||||
|
|
|
|||
|
|
@ -710,7 +710,8 @@ const frontPage = {
|
|||
|
||||
columns: [
|
||||
enumeration("hero_backdrop", ["brand", "photos"]),
|
||||
enumeration("hero_feature", ["none", "livestream", "video"]),
|
||||
enumeration("hero_feature", ["none", "livestream", "video", "event"]),
|
||||
text("hero_event_id"),
|
||||
text("eyebrow"),
|
||||
text("headline"),
|
||||
text("subhead"),
|
||||
|
|
|
|||
34
server/src/migrations/033_hero_event.sql
Normal file
34
server/src/migrations/033_hero_event.sql
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
-- ═══════════════════════════════════════════════════════════════
|
||||
-- 033 HERO: A FEATURED EVENT
|
||||
--
|
||||
-- A fourth hero feature, 'event': an event's card beside the
|
||||
-- headline, over whichever backdrop is chosen.
|
||||
--
|
||||
-- hero_event_id the event to feature. Null means the event the
|
||||
-- countdown shows (its pin, or the next one that
|
||||
-- hasn't ended, narrowed by its scope and type),
|
||||
-- so the hero and the countdown can't disagree.
|
||||
-- A pinned event that is over, unpublished or
|
||||
-- deleted falls back the same way; ON DELETE SET
|
||||
-- NULL does the last one.
|
||||
--
|
||||
-- hero_feature's CHECK gains 'event'. A CHECK can't be altered in
|
||||
-- place, so the column is replaced the way 025 did it: a new column
|
||||
-- with the new CHECK, the values copied across, the old one dropped
|
||||
-- and the new one renamed into its place. Nothing else names the
|
||||
-- column, so front_page itself needn't be rebuilt.
|
||||
--
|
||||
-- PRAGMA user_version; -- reads 32 before this file
|
||||
-- ═══════════════════════════════════════════════════════════════
|
||||
|
||||
ALTER TABLE front_page ADD COLUMN hero_feature_new TEXT NOT NULL DEFAULT 'none'
|
||||
CHECK (hero_feature_new IN ('none', 'livestream', 'video', 'event'));
|
||||
|
||||
UPDATE front_page SET hero_feature_new = hero_feature;
|
||||
|
||||
ALTER TABLE front_page DROP COLUMN hero_feature;
|
||||
|
||||
ALTER TABLE front_page RENAME COLUMN hero_feature_new TO hero_feature;
|
||||
|
||||
ALTER TABLE front_page ADD COLUMN hero_event_id TEXT
|
||||
REFERENCES events (id) ON DELETE SET NULL;
|
||||
|
|
@ -34,6 +34,12 @@
|
|||
means any. They don't apply to a pinned event: the admin chose
|
||||
that one by name.
|
||||
|
||||
── Hero event ──
|
||||
With the 'event' feature, the hero draws the pinned hero_event_id
|
||||
if it's still published and not over, else the countdown's event
|
||||
(above), so the two never disagree. Its action links ride along
|
||||
for the card's buttons.
|
||||
|
||||
── Featured ──
|
||||
The featured band's cards, record cards filled in from their
|
||||
records (loadFeaturedCards in shape.js, which the Community
|
||||
|
|
@ -42,7 +48,7 @@
|
|||
|
||||
import { Hono } from "hono";
|
||||
|
||||
import { asBool, loadFeaturedCards, shapeSeries } from "../shape.js";
|
||||
import { asBool, loadFeaturedCards, loadLinks, shapeSeries, splitLinks } from "../shape.js";
|
||||
|
||||
const home = new Hono();
|
||||
|
||||
|
|
@ -84,6 +90,20 @@ function statValue(db, row) {
|
|||
return sql ? String(db.prepare(sql).get().n) : null;
|
||||
}
|
||||
|
||||
/* The countdown's fields plus what the hero's event card also draws:
|
||||
its tagline, place, card background and buttons. */
|
||||
function shapeHeroEvent(db, row) {
|
||||
if (!row) return null;
|
||||
const { actions } = splitLinks(loadLinks(db, "event", [row.id]).get(row.id) ?? []);
|
||||
return {
|
||||
...shapeCountdown(row),
|
||||
tagline: row.tagline,
|
||||
card_image: row.card_image,
|
||||
org_logo: row.effective_org_logo,
|
||||
links: actions,
|
||||
};
|
||||
}
|
||||
|
||||
function shapeCountdown(row) {
|
||||
if (!row) return null;
|
||||
return {
|
||||
|
|
@ -179,6 +199,15 @@ home.get("/front-page", (c) => {
|
|||
)
|
||||
.get(...params);
|
||||
|
||||
const heroEvent =
|
||||
page.hero_feature === "event"
|
||||
? (page.hero_event_id
|
||||
? db
|
||||
.prepare(`SELECT * FROM v_events WHERE id = ? AND ${notOver}`)
|
||||
.get(page.hero_event_id)
|
||||
: null) ?? next
|
||||
: null;
|
||||
|
||||
return json(c, {
|
||||
front_page: {
|
||||
hero: {
|
||||
|
|
@ -201,6 +230,7 @@ home.get("/front-page", (c) => {
|
|||
video: page.video_url
|
||||
? { url: page.video_url, title: page.video_title }
|
||||
: null,
|
||||
event: shapeHeroEvent(db, heroEvent),
|
||||
},
|
||||
sections,
|
||||
stats,
|
||||
|
|
|
|||
|
|
@ -1218,6 +1218,7 @@ const frontPage = {
|
|||
["none", "Nothing: No additional overlay"],
|
||||
["livestream", "Livestream: the stream, with a LIVE badge"],
|
||||
["video", "Featured video: click to play"],
|
||||
["event", "Featured event: an event's card"],
|
||||
],
|
||||
blankLabel: "Default: nothing",
|
||||
help: "Switch to Livestream when you go live, and back when you're done",
|
||||
|
|
@ -1232,7 +1233,7 @@ const frontPage = {
|
|||
],
|
||||
},
|
||||
{
|
||||
legend: "Photos, livestream and video",
|
||||
legend: "Photos, livestream, video and event",
|
||||
fields: [
|
||||
{
|
||||
path: "slide_seconds",
|
||||
|
|
@ -1256,6 +1257,15 @@ const frontPage = {
|
|||
"/front-page/ or a link ending in .mp4 or .webm",
|
||||
},
|
||||
{ path: "video_title", label: "Video title", full: true, help: "Shown after \"Featured video\" above the headline" },
|
||||
{
|
||||
path: "hero_event_id",
|
||||
label: "Featured event",
|
||||
widget: "select",
|
||||
optionsFrom: "events",
|
||||
blankLabel: "Default: the countdown's event",
|
||||
full: true,
|
||||
help: "For the Featured event feature. A pinned event that's over falls back to the countdown's",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,12 +12,13 @@
|
|||
|
||||
import { useRecord, type Resource } from './useRecord.ts'
|
||||
import type { EventSeries } from './eventSeries.ts'
|
||||
import type { Link } from './useContent.ts'
|
||||
|
||||
/** What fills the hero's background. */
|
||||
export type HeroBackdrop = 'brand' | 'photos'
|
||||
|
||||
/** What sits beside the words, over the backdrop. */
|
||||
export type HeroFeature = 'none' | 'livestream' | 'video'
|
||||
export type HeroFeature = 'none' | 'livestream' | 'video' | 'event'
|
||||
|
||||
/** The CHECK list on front_page_sections.section. */
|
||||
export type FrontPageSectionKey =
|
||||
|
|
@ -51,6 +52,8 @@ export type Hero = {
|
|||
livestream: { url: string; title?: string | null } | null
|
||||
/** A link to embed or a video file; see videoSource in embeds.ts. */
|
||||
video: { url: string; title?: string | null } | null
|
||||
/** With the 'event' feature: the pinned event, else the countdown's. */
|
||||
event: HeroEvent | null
|
||||
}
|
||||
|
||||
export type FrontPageSection = {
|
||||
|
|
@ -105,6 +108,14 @@ export type FeaturedCard = {
|
|||
image: { file: string; kind: string } | null
|
||||
}
|
||||
|
||||
/** The countdown's event plus what the hero's event card draws. */
|
||||
export type HeroEvent = CountdownEvent & {
|
||||
tagline?: string | null
|
||||
card_image?: string | null
|
||||
org_logo?: string | null
|
||||
links: Link[]
|
||||
}
|
||||
|
||||
export type FrontPage = {
|
||||
hero: Hero
|
||||
sections: FrontPageSection[]
|
||||
|
|
|
|||
|
|
@ -20,9 +20,13 @@
|
|||
video a featured video under a "Featured video" badge.
|
||||
Never autoplays: an embed waits for play, a file
|
||||
shows the browser's player
|
||||
event an event's card under a "Featured event" badge:
|
||||
its photo, dates, place and buttons. The API picks
|
||||
the event (pinned, else the countdown's)
|
||||
|
||||
A choice with nothing to show falls back: photos with no photos
|
||||
to brand, a feature with no link set to none. A link that can't
|
||||
to brand, a feature with no link set (or no event to show) to
|
||||
none. A link that can't
|
||||
be framed still gets a "Watch live" or "Watch the video" button,
|
||||
so switching a feature on is never a no-op.
|
||||
|
||||
|
|
@ -33,11 +37,16 @@
|
|||
|
||||
import { useEffect, useState, type CSSProperties } from 'react'
|
||||
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import HomeLink from './HomeLink.tsx'
|
||||
import DoveMark from '../../../components/DoveMark.tsx'
|
||||
import PlatformIcon from '../../../components/PlatformIcon.tsx'
|
||||
import { livestreamEmbedUrl, videoSource, type VideoSource } from '../../../lib/embeds.ts'
|
||||
import { heroPhoto } from '../../../lib/media.ts'
|
||||
import type { Hero, HeroBackdrop, HeroFeature, HeroSlide } from '../../../lib/useFrontPage.ts'
|
||||
import { eventBackground, heroPhoto } from '../../../lib/media.ts'
|
||||
import { eventHref } from '../../../lib/hrefs.ts'
|
||||
import { seriesLabel } from '../../../lib/eventSeries.ts'
|
||||
import type { Hero, HeroBackdrop, HeroEvent, HeroFeature, HeroSlide } from '../../../lib/useFrontPage.ts'
|
||||
|
||||
const DEEP = '#04262e'
|
||||
|
||||
|
|
@ -54,9 +63,11 @@ export default function HeroStage({ hero }: { hero: Hero | null }) {
|
|||
? 'livestream'
|
||||
: hero?.feature === 'video' && hero.video
|
||||
? 'video'
|
||||
: 'none'
|
||||
: hero?.feature === 'event' && hero.event
|
||||
? 'event'
|
||||
: 'none'
|
||||
|
||||
// Both features share a layout: words left, player right.
|
||||
// Every feature shares a layout: words left, feature right.
|
||||
const beside = feature !== 'none'
|
||||
|
||||
return (
|
||||
|
|
@ -87,6 +98,12 @@ export default function HeroStage({ hero }: { hero: Hero | null }) {
|
|||
<VideoFrame source={video} url={hero.video.url} title={hero.video.title} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{feature === 'event' && hero?.event && (
|
||||
<div className="lg:col-span-7">
|
||||
<EventPanel event={hero.event} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
|
|
@ -111,6 +128,11 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
|
|||
</span>
|
||||
)}
|
||||
</p>
|
||||
) : feature === 'event' ? (
|
||||
<p className="mb-6 inline-flex items-center gap-3 rounded-full bg-white/10 px-4 py-1.5 text-sm font-semibold uppercase tracking-[0.2em] backdrop-blur">
|
||||
<span className="text-[#9fe7d0]" aria-hidden="true">★</span>
|
||||
Featured event
|
||||
</p>
|
||||
) : feature === 'video' ? (
|
||||
<p className="mb-6 inline-flex items-center gap-3 rounded-full bg-white/10 px-4 py-1.5 text-sm font-semibold uppercase tracking-[0.2em] backdrop-blur">
|
||||
<span className="text-[#9fe7d0]" aria-hidden="true">▶</span>
|
||||
|
|
@ -413,3 +435,71 @@ function VideoFrame({
|
|||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/* ── Featured event ──────────────────────────────────────────── */
|
||||
|
||||
/* The event's own card for the hero: its background photo (or its
|
||||
colour), then what, when and where, then its buttons and a way
|
||||
to its page. The first action link is the filled button, since
|
||||
it's usually Register. */
|
||||
function EventPanel({ event }: { event: HeroEvent }) {
|
||||
const color = event.color || '#138ba0'
|
||||
const photo = eventBackground(event.card_image)
|
||||
const when = seriesLabel(event.series, event.starts_on) ?? event.date_label
|
||||
const where = event.is_online && !event.location_label ? 'Online' : event.location_label
|
||||
|
||||
return (
|
||||
<div
|
||||
className="overflow-hidden rounded-3xl border border-white/15 bg-white/10 text-white shadow-2xl backdrop-blur"
|
||||
style={{ boxShadow: `0 30px 80px -20px ${color}66` }}
|
||||
>
|
||||
{photo ? (
|
||||
<img src={photo} alt="" className="aspect-[16/7] w-full object-cover" />
|
||||
) : (
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="aspect-[16/7] w-full"
|
||||
style={{ background: `linear-gradient(135deg, ${color}, #04262e)` }}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="space-y-4 p-8">
|
||||
<div>
|
||||
<h2 className="font-display text-3xl font-extrabold leading-tight md:text-4xl">
|
||||
<Link to={eventHref(event.id)} className="hover:underline">
|
||||
{event.title}
|
||||
</Link>
|
||||
</h2>
|
||||
{event.theme && <p className="mt-1 text-lg font-semibold text-[#9fe7d0]">"{event.theme}"</p>}
|
||||
</div>
|
||||
|
||||
{(when || where) && (
|
||||
<p className="text-lg text-white/85">{[when, where].filter(Boolean).join(' · ')}</p>
|
||||
)}
|
||||
{event.tagline && <p className="text-white/70">{event.tagline}</p>}
|
||||
|
||||
<div className="flex flex-wrap gap-3 pt-2">
|
||||
{event.links.map((link, index) => (
|
||||
<HomeLink
|
||||
key={link.url}
|
||||
url={link.url}
|
||||
className={`inline-flex items-center gap-2 rounded-full px-6 py-3 font-semibold transition-transform hover:scale-105 ${
|
||||
index === 0 ? 'text-[#04262e]' : 'border border-white/35 text-white hover:bg-white/10'
|
||||
}`}
|
||||
style={index === 0 ? { background: 'linear-gradient(120deg, #9fe7d0, #5ce7ff)' } : undefined}
|
||||
>
|
||||
<PlatformIcon platform={link.platform} />
|
||||
{link.label}
|
||||
</HomeLink>
|
||||
))}
|
||||
<Link
|
||||
to={eventHref(event.id)}
|
||||
className="rounded-full border border-white/35 px-6 py-3 font-semibold text-white transition-colors hover:bg-white/10"
|
||||
>
|
||||
Event details →
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue