v1.13.1-data: links/redirects, captions, partner picks, Plausible reports, migration baseline #28

Merged
ngu-git-admin merged 16 commits from data into main 2026-10-06 10:10:57 +01:00
2 changed files with 18 additions and 20 deletions
Showing only changes of commit f52a74a383 - Show all commits

View file

@ -26,8 +26,8 @@
cards and dividers (with their color, thickness and cards and dividers (with their color, thickness and
spacing); a video is its still linked to the video spacing); a video is its still linked to the video
Colors are the site's palette (STORED_PALETTE) or "none"; blank is the Colors are any hex color, picked in the builder, or "none"; blank
default. No unsubscribe link: Mailchimp adds its own to every send. is the default (EMAIL_COLOR). No unsubscribe link: Mailchimp adds its own to every send.
Email clients ignore stylesheets, CSS variables and most layout, Email clients ignore stylesheets, CSS variables and most layout,
so the HTML is tables with inline styles at 600px, images with so the HTML is tables with inline styles at 600px, images with
@ -104,7 +104,7 @@ export type Newsletter = {
} }
/* The palette as an inbox needs it. */ /* The palette as an inbox needs it. */
const COLOR = { export const EMAIL_COLOR = {
ink: '#001011', ink: '#001011',
body: '#003a45', body: '#003a45',
muted: '#3b5456', muted: '#3b5456',
@ -113,6 +113,7 @@ const COLOR = {
card: '#ffffff', card: '#ffffff',
rule: '#d6f5fa', rule: '#d6f5fa',
} }
const COLOR = EMAIL_COLOR
/* What each picks section is called and says on its buttons, unless /* What each picks section is called and says on its buttons, unless
the part says otherwise. */ the part says otherwise. */
@ -368,7 +369,7 @@ function partHtml(part: NewsletterPart, n: Newsletter): string {
case 'header': case 'header':
return headerHtml(part, n) return headerHtml(part, n)
case 'title': case 'title':
return `<tr><td style="padding:28px 24px 0;text-align:${alignOf(part)};"><h1 style="margin:0;font-family:${FONT};font-size:28px;line-height:34px;font-weight:700;color:${COLOR.ink};">${escape(part.text?.trim() || DEFAULT_TITLE(n.siteName))}</h1></td></tr>` return `<tr><td style="padding:28px 24px 0;text-align:${alignOf(part)};"><h1 style="margin:0;font-family:${FONT};font-size:28px;line-height:34px;font-weight:700;color:${colorOf(part.color, COLOR.ink) ?? COLOR.ink};">${escape(part.text?.trim() || DEFAULT_TITLE(n.siteName))}</h1></td></tr>`
case 'picks': case 'picks':
return picksHtml(part, n) return picksHtml(part, n)
case 'footer': case 'footer':

View file

@ -42,11 +42,11 @@ import { mediaUrl } from '../../lib/media.ts'
import { SITE_NAME, SITE_ORIGIN, siteUrl } from '../../lib/site.ts' import { SITE_NAME, SITE_ORIGIN, siteUrl } from '../../lib/site.ts'
import { seriesLabel } from '../../lib/eventSeries.ts' import { seriesLabel } from '../../lib/eventSeries.ts'
import { useWideAdminPage } from '../../lib/adminWidth.tsx' import { useWideAdminPage } from '../../lib/adminWidth.tsx'
import { STORED_PALETTE } from '../../lib/color.ts'
import { PLATFORMS } from '../../lib/platforms.ts' import { PLATFORMS } from '../../lib/platforms.ts'
import { SOCIAL_LINKS } from '../../data/socialLinks.ts' import { SOCIAL_LINKS } from '../../data/socialLinks.ts'
import { import {
DEFAULT_TITLE, DEFAULT_TITLE,
EMAIL_COLOR,
newsletterHtml, newsletterHtml,
newsletterText, newsletterText,
newsletterTitle, newsletterTitle,
@ -85,18 +85,14 @@ const PART_TYPES: Array<[string, string, string]> = [
] ]
const partLabel = (type: string) => PART_TYPES.find(([value]) => value === type)?.[1] ?? type const partLabel = (type: string) => PART_TYPES.find(([value]) => value === type)?.[1] ?? type
/* The site's palette as choices; an inbox needs the hex itself, and /* A color picker: any hex color, which is what an inbox needs. Blank
the one stored, not a color blind mode's swap (color.ts). */ is `fallback`; `none` (where given) is typed as the word none. */
const SHADES = ['', ', darkest', ', light', ', lightest'] const colorField = (path: string, label: string, fallback: string, none: string | null, types: string[]) => ({
const PALETTE_OPTIONS = Object.entries(STORED_PALETTE).flatMap(([family, shades]) =>
shades.map((hex, i) => [hex, `${family[0].toUpperCase()}${family.slice(1)}${SHADES[i]}`]),
)
const colorField = (path: string, label: string, fallback: string, none: string, types: string[]) => ({
path, path,
label, label,
widget: 'select', widget: 'color',
options: [['none', none], ...PALETTE_OPTIONS], placeholder: fallback,
blankLabel: `Default: ${fallback}`, help: `Default: ${fallback}${none ? `. Type none for ${none}` : ''}`,
when: { path: 'type', value: types }, when: { path: 'type', value: types },
}) })
@ -142,7 +138,7 @@ const PARTS_SPEC = {
when: { path: 'type', value: 'header' }, when: { path: 'type', value: 'header' },
help: "A PNG or JPEG: Gmail and Outlook don't show SVG. Default: none, the words alone", help: "A PNG or JPEG: Gmail and Outlook don't show SVG. Default: none, the words alone",
}, },
colorField('color', 'Band color', 'Teal, darkest', 'None: no band', ['header', 'social', 'countdown']), colorField('color', 'Band color', EMAIL_COLOR.body, 'no band', ['header', 'social', 'countdown']),
{ {
path: 'event', path: 'event',
label: 'Event', label: 'Event',
@ -154,6 +150,7 @@ const PARTS_SPEC = {
}, },
{ path: 'text', label: 'Words above', when: { path: 'type', value: 'countdown' }, help: "Default: the event's title" }, { path: 'text', label: 'Words above', when: { path: 'type', value: 'countdown' }, help: "Default: the event's title" },
{ path: 'text', label: 'Title', full: true, when: { path: 'type', value: 'title' }, help: `Default: ${DEFAULT_TITLE(SITE_NAME)}` }, { path: 'text', label: 'Title', full: true, when: { path: 'type', value: 'title' }, help: `Default: ${DEFAULT_TITLE(SITE_NAME)}` },
colorField('color', 'Title color', EMAIL_COLOR.ink, null, ['title']),
{ {
path: 'source', path: 'source',
label: 'Pick from', label: 'Pick from',
@ -174,8 +171,8 @@ const PARTS_SPEC = {
when: { path: 'type', value: 'picks' }, when: { path: 'type', value: 'picks' },
help: (row: NewsletterPart) => `On each card. Default: ${PICK_DEFAULTS[sourceOf(row)].cta}`, help: (row: NewsletterPart) => `On each card. Default: ${PICK_DEFAULTS[sourceOf(row)].cta}`,
}, },
colorField('rule', 'Heading underline', 'Teal, lightest', 'None: no line', ['picks']), colorField('rule', 'Heading underline', EMAIL_COLOR.rule, 'no line', ['picks']),
colorField('bar', 'Card bar', 'Teal', 'None: no bar', ['picks']), colorField('bar', 'Card bar', EMAIL_COLOR.teal, 'no bar', ['picks']),
{ {
path: 'text', path: 'text',
label: 'Footer', label: 'Footer',
@ -184,9 +181,9 @@ const PARTS_SPEC = {
when: { path: 'type', value: 'footer' }, when: { path: 'type', value: 'footer' },
help: `Default: ${SITE_NAME} and ${SITE_ORIGIN}`, help: `Default: ${SITE_NAME} and ${SITE_ORIGIN}`,
}, },
colorField('rule', 'Line above', 'Teal, lightest', 'None: no line', ['footer']), colorField('rule', 'Line above', EMAIL_COLOR.rule, 'no line', ['footer']),
...blockFields, ...blockFields,
colorField('color', 'Line color', 'Teal, lightest', 'None: space only', ['divider']), colorField('color', 'Line color', EMAIL_COLOR.rule, 'space only', ['divider']),
{ path: 'size', label: 'Thickness', widget: 'number', when: { path: 'type', value: 'divider' }, help: 'In pixels, 1 to 8. Default: 2' }, { path: 'size', label: 'Thickness', widget: 'number', when: { path: 'type', value: 'divider' }, help: 'In pixels, 1 to 8. Default: 2' },
{ path: 'space', label: 'Space above', widget: 'number', when: { path: 'type', value: 'divider' }, help: 'In pixels, 0 to 64. Default: 24' }, { path: 'space', label: 'Space above', widget: 'number', when: { path: 'type', value: 'divider' }, help: 'In pixels, 0 to 64. Default: 24' },
], ],