v1.14.0-profiles: profile accounts, drafts, page management, Planning Center #32

Merged
ngu-git-admin merged 15 commits from page-management into main 2026-10-28 07:00:10 +00:00
8 changed files with 143 additions and 16 deletions
Showing only changes of commit 56acedf926 - Show all commits

View file

@ -128,8 +128,10 @@
- [x] **Image converter** (Tools → Image converter): pictures to JPG, PNG or WebP in the browser (nothing uploaded): pick or drop several, a quality slider for JPG and WebP, download each or all. JPG fills transparency white. Media's images each have a Download as… (JPG, PNG, WebP) doing the same (`src/lib/convertImage.ts`).
- [x] **Directory tabs** (migration 078): the People directory preset takes several People tags, a tab each in the order picked (Directory: tags under the section); one tag shows without tabs, reading mode lists every tag. Each section's old single tag became its first.
- [x] **Blog post tabs** (migration 079): a Tab block in a post (its text the tab's title) starts a tab holding the blocks after it; blocks before the first Tab are the intro above the tabs. The contents list follows the open tab, a link to a heading in another tab opens it, and Download PDF and reading mode show every tab under its title. Outside a post a Tab block reads as a heading.
- [x] **Featured event card height** (Sections): from lg up the event's photo sits beside its words instead of above them, with tighter type and buttons, so the card is about as tall as the hero's text beside it; stacked as before on a phone. The photo stays whole (16:9).
- [x] **Word import, more of it** (Page Features): a line starting `Tab:` (any style) starts a tab; the Quote style becomes a Quote (a dash and a name at the end is who said it), Intense Quote a Callout, a line of `---` a Divider, a YouTube, Vimeo or Facebook link alone on its line a Video, and `Button: Register` with Register linked a Button. Blog posts → What becomes what (beside Import from Word) shows the whole mapping; `docs/importing.md` too. The note after an import counts tabs and the rest.
- [x] **Side nav sun into the footer** (Navigation): the sun is far bigger than the sticky layer that carries it, so once the last section went up past the list it hung over the footer. It now fades out as the list leaves with the last section, and back in on the way up.
- [ ] Check in a browser: the side nav sun fading at the end of a long page (2xl screen) and with a tall footer; the featured event hero at phone and desktop width, the footers' version line, converting a PNG with transparency to JPG and a JPG to WebP (and Download as in Media), a Directories section with two tags and with one, a post with an intro and three tabs (contents, keyboard arrows, PDF, reading mode).
- [ ] Check in a browser: the featured event card beside a two-line headline at 1024, 1280 and 1536px; What becomes what and a real Word document with Tab: lines, a quote and a video link; the side nav sun fading at the end of a long page (2xl screen) and with a tall footer; the featured event hero at phone and desktop width, the footers' version line, converting a PNG with transparency to JPG and a JPG to WebP (and Download as in Media), a Directories section with two tags and with one, a post with an intro and three tabs (contents, keyboard arrows, PDF, reading mode).
## Page Editing (branch `nav-access`, no PR yet; migration 077)
- [x] **Drafts of every record** (migration 077, `docs/drafts.md`): an existing record of any kind (events, people, organizations, blog posts, the front page, the site pages, Navigation, Site settings...) can be saved as a draft instead of going live. One draft per record; anyone who can edit it can save, preview, publish or discard it. Opening a record with a draft opens the draft, saying who saved it and when, and warning when the live record was saved since. Lists mark records with a draft.

View file

@ -18,6 +18,19 @@ authors and a cover, then tick Published.
| Tables | Table blocks: a row per line, cells split by `\|`, the first row the header |
| Bold, italic, links (http, https, mailto) | `**bold**`, `*italic*`, `[text](url)`, in paragraphs, list items and table cells |
And lines written a certain way, in any style:
| In the document | In the post |
| --- | --- |
| A line starting `Tab:`, eg. `Tab: Overview` | A Tab block: the post is split into tabs from there (the blocks before the first are the intro above the tabs) |
| The Quote style | A Quote block; a dash and a name at the end (`... - Jane Doe`) is who said it |
| The Intense Quote style | A Callout block |
| A line of `---` alone | A Divider |
| A YouTube, Vimeo or Facebook link alone on its line (the link text can be anything) | A Video block |
| `Button: Register`, with "Register" linked | A Button block, its label and link |
The same table is on Blog posts, beside Import from Word (What becomes what).
A post with three headings or more gets **Show contents** turned on. The
URL ID is the title as a slug, with `-2`, `-3` when it's taken.

View file

@ -14,6 +14,17 @@
cells split by |)
bold, italic, links **bold**, *italic*, [text](url)
And a few lines written a certain way (docs/importing.md), any
style:
"Tab: Overview" a tab block (079): the post
is split into tabs there
the Quote style a quote block
the Intense Quote style a callout block
"---" alone a divider
a YouTube, Vimeo or Facebook link a video block
alone on its line
"Button: [Register](https://…)" a button block
Images, text boxes, footnotes and comments aren't carried over;
the result counts what was skipped so the editor can say so.
@ -216,7 +227,7 @@ export function readDocx(buf) {
if (!text) continue;
const level = style === "title" ? 0 : Number(/^heading (\d)/.exec(style)?.[1] ?? NaN);
if (!title && (level === 0 || level === 1)) {
if (!title && (level === 0 || level === 1) && !lineBlock(text, style)) {
close();
title = text.replace(/\*/g, "");
continue;
@ -231,6 +242,12 @@ export function readDocx(buf) {
continue;
}
}
const special = lineBlock(text, style);
if (special) {
close();
blocks.push(special);
continue;
}
if (level >= 1) {
close();
blocks.push({ type: level <= 2 ? "heading" : "subheading", text: text.replace(/\*/g, "") });
@ -248,3 +265,37 @@ export function readDocx(buf) {
return { title, date, blocks, skipped: counts };
}
/* ── Lines written a certain way ──────────────────────────────── */
const VIDEO_HOST = /^https?:\/\/(www\.)?(youtube\.com|youtu\.be|m\.youtube\.com|vimeo\.com|player\.vimeo\.com|facebook\.com|fb\.watch)\//i;
/* The one link a line is made of, "[text](url)" or a bare url, or null. */
function loneLink(text) {
const md = /^\[[^\]]*\]\(([^)\s]+)\)$/.exec(text);
if (md) return md[1];
return /^https?:\/\/\S+$/.test(text) ? text : null;
}
/* A block a paragraph stands for by how it's written, or null for an
ordinary one (docs/importing.md). */
function lineBlock(text, style) {
const plain = text.replace(/\*/g, "").trim();
const tab = /^tab:\s*(.+)$/i.exec(plain);
if (tab) return { type: "tab", text: tab[1].trim().slice(0, 80) };
if (/^(-{3,}|_{3,})$/.test(plain)) return { type: "divider" };
const button = /^button:\s*\[([^\]]+)\]\(([^)\s]+)\)$/i.exec(text.trim());
if (button) return { type: "button", text: button[1].replace(/\*/g, ""), href: button[2] };
const link = loneLink(text.trim());
if (link && VIDEO_HOST.test(link)) return { type: "video", href: link };
if (style === "intense quote") return { type: "callout", text };
if (style === "quote") {
// A dash and a name at the end ("… - Jane Doe", any dash) is who said it.
const said = /^(.*\S)\s+[—–-]\s*([^—–-]{2,80})$/.exec(text);
return said ? { type: "quote", text: said[1], cite: said[2].trim() } : { type: "quote", text };
}
return null;
}

View file

@ -74,6 +74,8 @@ export function importDocx(db, buffer, fileName, byEmail) {
slot: "body",
type: block.type,
text: block.text ?? null,
href: block.href ?? null,
cite: block.cite ?? null,
items: block.items ?? [],
})),
});
@ -87,6 +89,9 @@ export function importDocx(db, buffer, fileName, byEmail) {
paragraphs: count("paragraph"),
lists: count("list"),
tables: count("table"),
tabs: count("tab"),
// Quotes, callouts, dividers, videos and buttons.
others: doc.blocks.filter((b) => ["quote", "callout", "divider", "video", "button"].includes(b.type)).length,
skipped: doc.skipped,
},
};

View file

@ -46,7 +46,32 @@ export const blogPosts = {
idLabel: "URL ID",
slugFrom: "title",
// Blog posts → Import from Word (server/src/routes/import.js).
importer: { label: "Import from Word", endpoint: "/admin/import/docx", accept: ".docx" },
// `guide` is what becomes what (server/src/docx.js, docs/importing.md),
// shown beside the button.
importer: {
label: "Import from Word",
endpoint: "/admin/import/docx",
accept: ".docx",
guide: {
intro: "A .docx becomes a new, unpublished post. In the document:",
rows: [
["The Title style, or the first Heading 1", "The post's title"],
["A date line under it, eg. Sep 28, 2026", "The post's date"],
["Heading 1 and Heading 2", "Heading blocks"],
["Heading 3 and smaller", "Subheading blocks"],
["A line starting Tab:, eg. Tab: Overview (any style)", "A Tab: the post is split into tabs from there"],
["The Quote style", "A Quote (a dash and a name at the end is who said it)"],
["The Intense Quote style", "A Callout"],
["Bulleted or numbered paragraphs", "One List block"],
["Tables", "Table blocks"],
["A line of --- alone", "A Divider"],
["A YouTube, Vimeo or Facebook link alone on its line", "A Video"],
["Button: Register, with Register linked", "A Button, its label and link"],
["Other paragraphs", "Paragraphs, keeping bold, italic and links"],
],
outro: "Images, text boxes, footnotes, comments, colors and fonts aren't carried over: add images as Image blocks after. PDFs: save as .docx first.",
},
},
list: {
columns: [

View file

@ -691,6 +691,8 @@ function ImportedNote() {
`${summary.paragraphs} paragraphs`,
`${summary.lists} lists`,
`${summary.tables} tables`,
...(summary.tabs ? [`${summary.tabs} tabs`] : []),
...(summary.others ? [`${summary.others} quotes, callouts, dividers, videos and buttons`] : []),
];
return (
<p role="status" className="mt-4 border border-brand/20 bg-tint px-4 py-3 text-sm text-body">

View file

@ -282,13 +282,40 @@ function ImportButton({ manifest }: { manifest: any }) {
}
}
const guide = manifest.importer.guide;
return (
<div className="ml-auto flex items-center gap-3">
<div className="ml-auto flex flex-wrap items-center gap-3">
{error && (
<span role="alert" className="text-sm text-danger">
{error}
</span>
)}
{guide && (
<details className="relative">
<summary className="cursor-pointer text-sm text-link hover:underline">What becomes what</summary>
<div className="absolute right-0 z-20 mt-2 w-[min(36rem,90vw)] bg-raised p-4 text-sm shadow-xl">
<p className="text-body">{guide.intro}</p>
<table className="mt-3 w-full text-left">
<thead className="text-xs uppercase tracking-wider text-muted">
<tr>
<th className="py-1 pr-4 font-medium">In Word</th>
<th className="py-1 font-medium">In the post</th>
</tr>
</thead>
<tbody>
{guide.rows.map(([from, to]) => (
<tr key={from} className="border-t border-muted/10 align-top">
<td className="py-1.5 pr-4 text-body">{from}</td>
<td className="py-1.5 text-muted">{to}</td>
</tr>
))}
</tbody>
</table>
{guide.outro && <p className="mt-3 text-xs text-muted">{guide.outro}</p>}
</div>
</details>
)}
<label
className={`cursor-pointer btn border border-link px-4 py-2 text-sm text-link transition-colors hover:bg-tint ${
busy ? "pointer-events-none opacity-60" : ""

View file

@ -556,10 +556,12 @@ function VideoFrame({
/* ── Featured event ──────────────────────────────────────────── */
/* The event's own card for the hero: its background photo (or its
color), 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. */
/* The event's own card for the hero: its photo (or its color), 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. Stacked on a phone; from lg up the photo sits beside the
words, so the card stays about as tall as the hero's own text
instead of towering over it. The photo stays whole (16:9). */
function EventPanel({ event }: { event: HeroEvent }) {
const color = event.color || 'var(--color-action)'
const photo = mediaUrl(event.photo)
@ -568,7 +570,7 @@ function EventPanel({ event }: { event: HeroEvent }) {
return (
<div
className="overflow-hidden border border-white/15 bg-white/10 text-white shadow-2xl backdrop-blur"
className="overflow-hidden border border-white/15 bg-white/10 text-white shadow-2xl backdrop-blur lg:grid lg:grid-cols-[minmax(0,1.1fr)_minmax(0,1fr)] lg:items-center"
style={{ boxShadow: '0 24px 48px -24px rgba(0, 16, 17, 0.6)' }}
>
{photo ? (
@ -581,9 +583,9 @@ function EventPanel({ event }: { event: HeroEvent }) {
/>
)}
<div className="space-y-4 p-8">
<div className="space-y-4 p-8 lg:space-y-3 lg:p-6">
<div>
<h2 className="font-display text-3xl font-bold leading-tight md:text-4xl">
<h2 className="font-display text-3xl font-bold leading-tight md:text-4xl lg:text-2xl xl:text-3xl">
<Link to={eventHref(event.id)} className="hover:underline">
{event.title}
</Link>
@ -592,16 +594,16 @@ function EventPanel({ event }: { event: HeroEvent }) {
</div>
{(when || where) && (
<p className="text-lg text-white/85">{[when, where].filter(Boolean).join(' · ')}</p>
<p className="text-lg text-white/85 lg:text-base">{[when, where].filter(Boolean).join(' · ')}</p>
)}
{event.tagline && <p className="text-white/70">{event.tagline}</p>}
{event.tagline && <p className="text-white/70 lg:line-clamp-3 lg:text-sm">{event.tagline}</p>}
<div className="flex flex-wrap gap-3 pt-2">
<div className="flex flex-wrap gap-3 pt-2 lg:gap-2 lg:pt-1">
{event.links.map((link, index) => (
<HomeLink
key={link.url}
url={link.url}
className={`inline-flex items-center gap-2 btn px-6 py-3 transition-transform hover:scale-105 ${
className={`inline-flex items-center gap-2 btn px-6 py-3 transition-transform hover:scale-105 lg:px-4 lg:py-2 lg:text-sm ${
index === 0 ? 'text-[#001011]' : 'border border-white/35 text-white hover:bg-white/10'
}`}
style={index === 0 ? { background: 'var(--pal-amber-2)' } : undefined}
@ -612,7 +614,7 @@ function EventPanel({ event }: { event: HeroEvent }) {
))}
<Link
to={eventHref(event.id)}
className="btn border border-white/35 px-6 py-3 text-white transition-colors hover:bg-white/10"
className="btn border border-white/35 px-6 py-3 text-white transition-colors hover:bg-white/10 lg:px-4 lg:py-2 lg:text-sm"
>
Event details <ArrowRight size="1em" weight="bold" className="inline align-[-0.125em]" aria-hidden="true" />
</Link>