Show platform icons on link buttons

Links pick their platform from a preset dropdown (PLATFORMS in
src/lib/platforms.ts), and every link button draws that platform's
icon beside its label. The footer and event cards now share the same
PlatformIcon component instead of their own copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-27 14:45:20 -05:00
parent 99c3a87c87
commit 3c02eb8971
11 changed files with 170 additions and 65 deletions

View file

@ -16,6 +16,7 @@
═══════════════════════════════════════════════════════════════ */
import { preview } from "./text.ts";
import { PLATFORMS } from "./platforms.ts";
const PLACE_FIELDS = [
{ path: "venue", label: "Venue" },
@ -140,7 +141,14 @@ const linksChild = {
widget: "select",
options: ["action", "social", "website", "email"],
},
{ path: "platform", label: "Platform", help: "instagram, discord…" },
{
path: "platform",
label: "Platform",
widget: "select",
options: PLATFORMS.map((platform) => [platform.id, platform.label]),
blankLabel: "Default: no icon",
help: "Shows the platform's icon on the button.",
},
{ path: "label", label: "Label", required: true },
{ path: "url", label: "URL", required: true, full: true },
{ path: "is_primary", label: "Primary", widget: "checkbox" },

29
src/lib/platforms.ts Normal file
View file

@ -0,0 +1,29 @@
/* ═══════════════════════════════════════════════════════════════
LINK PLATFORMS
The preset values for links.platform. Order here is the order
the admin's Platform dropdown lists them in.
links.platform is a plain TEXT column with no CHECK: a platform
carries nothing but an icon, and an unknown value just draws a
button without one. So adding a platform is two edits, both in
code: an entry here and its icon in PlatformIcon.tsx. The type
below makes the icon list refuse to compile without it.
'instagram' is also read by splitLinks in server/src/shape.js,
which lifts the handle out for the event cards' follow button.
═══════════════════════════════════════════════════════════════ */
export const PLATFORMS = [
{ id: 'instagram', label: 'Instagram' },
{ id: 'facebook', label: 'Facebook' },
{ id: 'discord', label: 'Discord' },
{ id: 'youtube', label: 'YouTube' },
{ id: 'tiktok', label: 'TikTok' },
{ id: 'x', label: 'X (Twitter)' },
{ id: 'substack', label: 'Substack' },
{ id: 'spotify', label: 'Spotify' },
{ id: 'linkedin', label: 'LinkedIn' },
] as const
export type Platform = (typeof PLATFORMS)[number]['id']