v1.13.1-data: links/redirects, captions, partner picks, Plausible reports, migration baseline #28
2 changed files with 18 additions and 20 deletions
|
|
@ -26,8 +26,8 @@
|
|||
cards and dividers (with their color, thickness and
|
||||
spacing); a video is its still linked to the video
|
||||
|
||||
Colors are the site's palette (STORED_PALETTE) or "none"; blank is the
|
||||
default. No unsubscribe link: Mailchimp adds its own to every send.
|
||||
Colors are any hex color, picked in the builder, or "none"; blank
|
||||
is the default (EMAIL_COLOR). No unsubscribe link: Mailchimp adds its own to every send.
|
||||
|
||||
Email clients ignore stylesheets, CSS variables and most layout,
|
||||
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. */
|
||||
const COLOR = {
|
||||
export const EMAIL_COLOR = {
|
||||
ink: '#001011',
|
||||
body: '#003a45',
|
||||
muted: '#3b5456',
|
||||
|
|
@ -113,6 +113,7 @@ const COLOR = {
|
|||
card: '#ffffff',
|
||||
rule: '#d6f5fa',
|
||||
}
|
||||
const COLOR = EMAIL_COLOR
|
||||
|
||||
/* What each picks section is called and says on its buttons, unless
|
||||
the part says otherwise. */
|
||||
|
|
@ -368,7 +369,7 @@ function partHtml(part: NewsletterPart, n: Newsletter): string {
|
|||
case 'header':
|
||||
return headerHtml(part, n)
|
||||
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':
|
||||
return picksHtml(part, n)
|
||||
case 'footer':
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ import { mediaUrl } from '../../lib/media.ts'
|
|||
import { SITE_NAME, SITE_ORIGIN, siteUrl } from '../../lib/site.ts'
|
||||
import { seriesLabel } from '../../lib/eventSeries.ts'
|
||||
import { useWideAdminPage } from '../../lib/adminWidth.tsx'
|
||||
import { STORED_PALETTE } from '../../lib/color.ts'
|
||||
import { PLATFORMS } from '../../lib/platforms.ts'
|
||||
import { SOCIAL_LINKS } from '../../data/socialLinks.ts'
|
||||
import {
|
||||
DEFAULT_TITLE,
|
||||
EMAIL_COLOR,
|
||||
newsletterHtml,
|
||||
newsletterText,
|
||||
newsletterTitle,
|
||||
|
|
@ -85,18 +85,14 @@ const PART_TYPES: Array<[string, string, string]> = [
|
|||
]
|
||||
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
|
||||
the one stored, not a color blind mode's swap (color.ts). */
|
||||
const SHADES = ['', ', darkest', ', light', ', lightest']
|
||||
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[]) => ({
|
||||
/* A color picker: any hex color, which is what an inbox needs. Blank
|
||||
is `fallback`; `none` (where given) is typed as the word none. */
|
||||
const colorField = (path: string, label: string, fallback: string, none: string | null, types: string[]) => ({
|
||||
path,
|
||||
label,
|
||||
widget: 'select',
|
||||
options: [['none', none], ...PALETTE_OPTIONS],
|
||||
blankLabel: `Default: ${fallback}`,
|
||||
widget: 'color',
|
||||
placeholder: fallback,
|
||||
help: `Default: ${fallback}${none ? `. Type none for ${none}` : ''}`,
|
||||
when: { path: 'type', value: types },
|
||||
})
|
||||
|
||||
|
|
@ -142,7 +138,7 @@ const PARTS_SPEC = {
|
|||
when: { path: 'type', value: 'header' },
|
||||
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',
|
||||
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: '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',
|
||||
label: 'Pick from',
|
||||
|
|
@ -174,8 +171,8 @@ const PARTS_SPEC = {
|
|||
when: { path: 'type', value: 'picks' },
|
||||
help: (row: NewsletterPart) => `On each card. Default: ${PICK_DEFAULTS[sourceOf(row)].cta}`,
|
||||
},
|
||||
colorField('rule', 'Heading underline', 'Teal, lightest', 'None: no line', ['picks']),
|
||||
colorField('bar', 'Card bar', 'Teal', 'None: no bar', ['picks']),
|
||||
colorField('rule', 'Heading underline', EMAIL_COLOR.rule, 'no line', ['picks']),
|
||||
colorField('bar', 'Card bar', EMAIL_COLOR.teal, 'no bar', ['picks']),
|
||||
{
|
||||
path: 'text',
|
||||
label: 'Footer',
|
||||
|
|
@ -184,9 +181,9 @@ const PARTS_SPEC = {
|
|||
when: { path: 'type', value: 'footer' },
|
||||
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,
|
||||
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: 'space', label: 'Space above', widget: 'number', when: { path: 'type', value: 'divider' }, help: 'In pixels, 0 to 64. Default: 24' },
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue