Files
bookhoard/templates/icons.templ
T
John O'Keefe 2235b00c59 feat(podcasts): web UI — /podcasts page, feed detail, download lifecycle (task 1.9)
Rendering ownership holds throughout: every piece of server data is
templ-rendered; htmx swaps partials; the only TS is the Add-Feed modal
toggle + error surfacing (pure client-local state, bundled via
web/src/podcasts.ts with automatic bundle-hash stamping).

Sidebar: /podcasts nav entry (D13, between Series and Collections),
gated by a ShowPodcastsNav flag resolved centrally in
getTemplateUserWithTheme (one indexed COUNT — same class of
per-request lookup as the live-user guard). New 'podcast' icon.

/podcasts: header + Add Feed modal (htmx post → HX-Redirect to the
feed page; inline error surfacing on failure), subscription-scoped
search + facet bar (host/tag/language — server-side GET filters, no
JS), grid cards with download counts / new-episodes / complete /
explicit badges. Empty states for no-library (admin creates it first)
and no-subscriptions.

Feed detail: hero (artwork, host/publisher, tags, fetch state), action
row — Download All, Refresh, ORDER SELECTOR (D5 override), serial
one-click oldest-first suggestion (never silent), auto-download policy
select (D6), Unsubscribe (files retained), admin Remove Feed — gap
banner (D8 count), and the EPISODE LIST with the full lifecycle inline
(D8/D19): pending greyed + Download button (every non-downloaded
episode has one), queued/downloading pulse, failed RED + reason text +
Retry (same endpoint). The list is a self-refreshing partial: re-fetch
on the podcast:changed HX-Trigger and polls every 4s ONLY while the
server says downloads are active (it renders the polling variant).

API endpoints grew HX awareness: 204 + HX-Trigger podcast:changed (or
HX-Redirect for add/unsubscribe/remove) — the sanctioned Go-handler
response channels; JSON callers keep JSON. AddFeed result exposes the
fetch-error text for the redirect.

Dates render in the requesting user's timezone (D17) via
utils.FormatTimeInTimezone; episodes play through the existing
/readers/{id} audio reader (episodes ARE audiobook items — no new
player code day one). CSP tripwire (templates/csp_source_test.go)
passes: no inline scripts, no on*= handlers, no hx-on/js: vals.
2026-10-29 16:17:55 -04:00

197 lines
8.1 KiB
Templ

package templates
// Icon renders an inline SVG from the built-in icon set. All icons share the
// same 24x24 viewBox, 1.75 stroke width, and round line caps so the UI has one
// consistent visual language (replacing the mixed emoji/SVG iconography).
// `extra` is appended to the class list (e.g. "h-5 w-5").
templ Icon(name string, extra string) {
<svg class={ "reader-icon " + extra } width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
switch name {
case "search":
<circle cx="11" cy="11" r="7"></circle>
<path d="m20 20-3.5-3.5"></path>
case "user":
<circle cx="12" cy="8" r="4"></circle>
<path d="M4 20c0-4 4-6 8-6s8 2 8 6"></path>
case "users":
<circle cx="9" cy="8" r="3.5"></circle>
<path d="M2 20c0-3.5 3-5 7-5s7 1.5 7 5"></path>
<path d="M16 4.5a3.5 3.5 0 0 1 0 7"></path>
<path d="M22 20c0-3-2-4.5-5-4.5"></path>
case "palette":
<circle cx="12" cy="12" r="9"></circle>
<circle cx="8" cy="10" r="1"></circle>
<circle cx="12" cy="7.5" r="1"></circle>
<circle cx="15.5" cy="10" r="1"></circle>
<path d="M12 21a3 3 0 0 0 0-6 2 2 0 0 1 0-4h1"></path>
case "menu":
<path d="M3 6h18M3 12h18M3 18h18"></path>
case "chevron-down":
<path d="m6 9 6 6 6-6"></path>
case "chevron-up":
<path d="m6 15 6-6 6 6"></path>
case "chevron-left":
<path d="m15 6-6 6 6 6"></path>
case "chevron-right":
<path d="m9 6 6 6-6 6"></path>
case "chevrons-left":
<path d="m11 6-6 6 6 6M19 6l-6 6 6 6"></path>
case "chevrons-right":
<path d="m13 6 6 6-6 6M5 6l6 6-6 6"></path>
case "close":
<path d="M6 6l12 12M18 6 6 18"></path>
case "grip":
<circle cx="9" cy="6" r="1"></circle>
<circle cx="15" cy="6" r="1"></circle>
<circle cx="9" cy="12" r="1"></circle>
<circle cx="15" cy="12" r="1"></circle>
<circle cx="9" cy="18" r="1"></circle>
<circle cx="15" cy="18" r="1"></circle>
case "moon":
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"></path>
case "sun":
<circle cx="12" cy="12" r="4"></circle>
<path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"></path>
case "settings":
<circle cx="12" cy="12" r="3"></circle>
<path d="M12 2v3M12 19v3M2 12h3M19 12h3M5 5l2 2M17 17l2 2M19 5l-2 2M7 17l-2 2"></path>
case "gear":
<circle cx="12" cy="12" r="3"></circle>
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
case "refresh":
<path d="M3 12a9 9 0 0 1 15-6.7L21 8"></path>
<path d="M21 3v5h-5"></path>
<path d="M21 12a9 9 0 0 1-15 6.7L3 16"></path>
<path d="M3 21v-5h5"></path>
case "book":
<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path>
<path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path>
case "book-open":
<path d="M12 7v14"></path>
<path d="M3 4h6a3 3 0 0 1 3 3v14a2 2 0 0 0-2-2H3z"></path>
<path d="M21 4h-6a3 3 0 0 0-3 3v14a2 2 0 0 1 2-2h7z"></path>
case "library":
<path d="M3 21h18"></path>
<path d="M5 21V7l7-4 7 4v14"></path>
case "podcast":
<path d="M12 9a3 3 0 0 0-3 3v1a3 3 0 0 0 6 0v-1a3 3 0 0 0-3-3z"></path>
<path d="M6.3 6.3a8 8 0 0 0 0 11.4"></path>
<path d="M17.7 6.3a8 8 0 0 1 0 11.4"></path>
<path d="M3.5 3.5a12 12 0 0 0 0 17"></path>
<path d="M20.5 3.5a12 12 0 0 1 0 17"></path>
case "layers":
<path d="m12 3 9 5-9 5-9-5 9-5z"></path>
<path d="m3 13 9 5 9-5"></path>
case "folder":
<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
case "chart":
<path d="M3 3v18h18"></path>
<path d="M7 15v3M12 11v7M17 7v11"></path>
case "device":
<rect x="7" y="2" width="10" height="20" rx="2"></rect>
<path d="M11 18h2"></path>
case "trash":
<path d="M4 7h16M9 7V4h6v3M6 7l1 13a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-13"></path>
case "save":
<path d="M5 3h11l3 3v15H5z"></path>
<path d="M8 3v6h7V3"></path>
<path d="M8 14h8v7H8z"></path>
case "filter":
<path d="M3 4h18l-7 8v6l-4 2v-8z"></path>
case "check":
<path d="m4 12 5 5 11-11"></path>
case "check-circle":
<circle cx="12" cy="12" r="9"></circle>
<path d="m8 12 3 3 5-6"></path>
case "x-circle":
<circle cx="12" cy="12" r="9"></circle>
<path d="m9 9 6 6M15 9l-6 6"></path>
case "circle":
<circle cx="12" cy="12" r="8"></circle>
case "bookmark":
<path d="M7 3h10a1 1 0 0 1 1 1v17l-6-4-6 4V4a1 1 0 0 1 1-1z"></path>
case "star":
<path d="m12 3 2.7 5.5 6 .9-4.3 4.2 1 6L12 17l-5.4 2.6 1-6L3.3 9.4l6-.9z"></path>
case "arrow-right":
<path d="M5 12h14M13 6l6 6-6 6"></path>
case "arrow-left":
<path d="M19 12H5M11 6l-6 6 6 6"></path>
case "home":
<path d="M3 11 12 3l9 8"></path>
<path d="M5 10v10h14V10"></path>
case "logout":
<path d="M15 4h3a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-3"></path>
<path d="M10 17l5-5-5-5"></path>
<path d="M15 12H3"></path>
case "plus":
<path d="M12 5v14M5 12h14"></path>
case "edit":
<path d="M4 20h4L18 10l-4-4L4 16z"></path>
<path d="m14 6 4 4"></path>
case "info":
<circle cx="12" cy="12" r="9"></circle>
<path d="M12 11v5M12 8h.01"></path>
case "alert":
<path d="M12 3 2 20h20z"></path>
<path d="M12 10v4M12 17h.01"></path>
case "clock":
<circle cx="12" cy="12" r="9"></circle>
<path d="M12 7v5l3 2"></path>
case "sync":
<path d="M3 8a9 9 0 0 1 15-3l3 3"></path>
<path d="M21 16a9 9 0 0 1-15 3l-3-3"></path>
case "download":
<path d="M12 3v12M7 10l5 5 5-5"></path>
<path d="M5 21h14"></path>
case "upload":
<path d="M12 21V9M7 14l5-5 5 5"></path>
<path d="M5 3h14"></path>
case "copy":
<rect x="9" y="9" width="12" height="12" rx="2"></rect>
<path d="M5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1"></path>
case "external":
<path d="M14 4h6v6"></path>
<path d="M20 4 10 14"></path>
<path d="M19 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h5"></path>
case "list":
<path d="M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"></path>
case "grid":
<rect x="3" y="3" width="7" height="7" rx="1"></rect>
<rect x="14" y="3" width="7" height="7" rx="1"></rect>
<rect x="3" y="14" width="7" height="7" rx="1"></rect>
<rect x="14" y="14" width="7" height="7" rx="1"></rect>
case "play":
<path d="M6 4l14 8-14 8z"></path>
case "heart":
<path d="M12 21s-7-4.5-9.5-9A5 5 0 0 1 12 6a5 5 0 0 1 9.5 6c-2.5 4.5-9.5 9-9.5 9z"></path>
case "calendar":
<rect x="3" y="4" width="18" height="18" rx="2"></rect>
<path d="M3 9h18M8 2v4M16 2v4"></path>
case "tag":
<path d="M3 11V5a2 2 0 0 1 2-2h6l9 9-8 8-9-9z"></path>
<circle cx="7.5" cy="7.5" r="1"></circle>
case "globe":
<circle cx="12" cy="12" r="9"></circle>
<path d="M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"></path>
case "shield":
<path d="M12 3 5 6v6c0 4 3 7 7 9 4-2 7-5 7-9V6z"></path>
case "database":
<ellipse cx="12" cy="5" rx="8" ry="3"></ellipse>
<path d="M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"></path>
<path d="M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"></path>
case "headphones":
<path d="M4 14v-2a8 8 0 0 1 16 0v2"></path>
<rect x="3" y="14" width="4" height="7" rx="1.5"></rect>
<rect x="17" y="14" width="4" height="7" rx="1.5"></rect>
case "comic":
<path d="M4 4h16v12l-3 4H7l-3-4z"></path>
<path d="M4 9h16M9 9v11"></path>
case "manga":
<path d="M4 4h16v13a3 3 0 0 1-3 3H4z"></path>
<path d="M4 4v16M10 4h10v8"></path>
default:
<circle cx="12" cy="12" r="9"></circle>
}
</svg>
}