Wrap list chips, add list sharing and public/unlisted/private visibility

- Home page list chips wrap to new rows instead of scrolling off the edge
- Lists are public, unlisted or private (migrated from the visible flag)
- Unlisted lists are reachable only at /s/<token>; slug URLs are public-only
- Share button on list pages and in the editor/dashboard; owners can reset an unlisted link

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cdnutterandClaude Opus 5.5 committed 2026-11-19 09:51:16 -08:00
1 parent 268af7b9ed
commit 87e3d1fb30
16 files changed
+292 -28

No files matched your search

+3 -4
View File
@@ -156,9 +156,7 @@ code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; bac
.avatar--lg { width: 92px; height: 92px; font-size: 36px; }
}
.jump { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.jump::-webkit-scrollbar { display: none; }
@media (max-width: 640px) { .jump { justify-content: flex-start; } }
.jump { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 6px; margin-bottom: 8px; }
.shelf { margin-top: 44px; }
.shelf-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
@@ -441,7 +439,7 @@ code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; bac
.list-title { font-size: clamp(30px, 5vw, 52px); font-weight: 800; margin-top: 8px; }
.list-desc { color: var(--muted); font-size: 16px; margin-top: 10px; max-width: 70ch; }
.list-meta { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; font-weight: 550; }
.list-actions { display: flex; align-items: center; gap: 10px; }
.list-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.list-body { padding-top: 30px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: calc(var(--radius) + 2px); background: var(--surface); border: 1px solid var(--border); }
@@ -857,6 +855,7 @@ input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px;
.radio-cards label { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 14px; }
.radio-cards label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-cards input { accent-color: var(--accent); margin: 0; }
.radio-cards label .icon { width: 15px; height: 15px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
+7 -1
View File
@@ -3,6 +3,7 @@ import { h, icon, api, readBoot, toast, confirmDialog, chooseDialog, openDialog,
import { sortable } from "./sortable.js";
import { Places } from "./places.js";
import { openListForm } from "./list-form.js";
import { shareDialog, VISIBILITY, visibilityOf } from "./share.js";
import { previewButton } from "./player.js";
import { openImport } from "./import.js";
@@ -40,7 +41,8 @@ function renderHeader() {
document.querySelector("[data-bind=title]").textContent = list.title;
document.querySelector("[data-bind=count]").textContent = fmt.format(list.itemCount);
document.querySelector("[data-bind=max]").textContent = fmt.format(list.maxItems);
document.querySelector("[data-bind=hidden]").textContent = list.visible ? "" : " · Hidden";
const vis = visibilityOf(list);
document.querySelector("[data-bind=hidden]").textContent = vis === "public" ? "" : ` · ${VISIBILITY[vis].label}`;
document.querySelector("[data-bind=public]").href = `/l/${list.slug}`;
document.querySelector("[data-bind=export-csv]").href = `/l/${list.slug}/export?format=csv`;
document.querySelector("[data-bind=export-txt]").href = `/l/${list.slug}/export?format=txt`;
@@ -51,6 +53,10 @@ function renderHeader() {
const isFull = () => list.itemCount >= list.maxItems;
document.querySelector("[data-action=share]").addEventListener("click", () => {
shareDialog(list, { onChange: (saved) => { list = saved; renderHeader(); } });
});
document.querySelector("[data-action=edit-list]").addEventListener("click", () => {
openListForm({
categories, limits, styles: boot.styles, list,
+5 -2
View File
@@ -1,5 +1,6 @@
// Admin dashboard: all lists, their order, create/edit/delete.
import { h, icon, api, readBoot, toast, confirmDialog, fmt } from "./common.js";
import { shareDialog, VISIBILITY, visibilityOf } from "./share.js";
import { sortable } from "./sortable.js";
import { openListForm } from "./list-form.js";
@@ -67,12 +68,14 @@ function card(list) {
h("span", { "aria-hidden": "true" }, "·"),
h("span", {}, `${fmt.format(list.itemCount)} / ${fmt.format(list.maxItems)}`),
h("span", { class: "list-card-bar", "aria-hidden": "true" }, h("span", { style: { width: pct + "%" } })),
!list.visible && h("span", { class: "badge badge--muted" }, icon("eye-off"), "Hidden"),
visibilityOf(list) !== "public" && h("span", { class: "badge badge--muted" }, icon(VISIBILITY[visibilityOf(list)].icon), VISIBILITY[visibilityOf(list)].label),
),
),
),
h("div", { class: "list-card-actions" },
h("a", { class: "icon-btn", href: `/l/${list.slug}`, title: "View public page", "aria-label": "View public page" }, icon("external")),
h("a", { class: "icon-btn", href: `/l/${list.slug}`, title: "View page", "aria-label": "View page" }, icon("external")),
h("button", { type: "button", class: "icon-btn", title: "Share", "aria-label": `Share ${list.title}`,
onclick: () => shareDialog(list, { onChange: (saved) => { lists = lists.map((l) => (l.id === saved.id ? saved : l)); render(); } }) }, icon("link")),
h("button", { type: "button", class: "icon-btn", title: "List settings", "aria-label": "List settings", onclick: () => editList(list) }, icon("settings")),
h("button", { type: "button", class: "icon-btn icon-btn--danger", title: "Delete", "aria-label": "Delete list", onclick: () => deleteList(list) }, icon("trash")),
),
+13 -3
View File
@@ -1,5 +1,6 @@
// Create / edit list dialog, shared by the dashboard and the list editor.
import { h, icon, api, openDialog, dialogHead, busy, fmt } from "./common.js";
import { VISIBILITY, visibilityOf } from "./share.js";
const SIZE_PRESETS = [5, 10, 25, 50, 100];
@@ -91,7 +92,16 @@ export function openListForm({ categories, limits, styles, list, category, onSav
h("label", {}, h("input", { type: "radio", name: "art", value: "square", checked: art === "square" }), "Square (logos, covers)"),
h("label", {}, h("input", { type: "radio", name: "art", value: "poster", checked: art === "poster" }), "Tall (posters, photos)"),
));
const visible = h("input", { type: "checkbox", name: "visible", checked: list ? list.visible : true });
const vis = list ? visibilityOf(list) : "public";
const visHint = h("span", { class: "field-hint" }, VISIBILITY[vis].hint);
const visField = h("div", { class: "field" },
h("span", { class: "field-label" }, "Who can see it"),
h("div", { class: "radio-cards", role: "radiogroup", "aria-label": "Who can see it" },
Object.entries(VISIBILITY).map(([key, o]) => h("label", {},
h("input", { type: "radio", name: "visibility", value: key, checked: vis === key,
onchange: () => { visHint.textContent = o.hint; } }),
icon(o.icon), o.label))),
visHint);
const error = h("p", { class: "alert alert--error", role: "alert", hidden: true });
const save = h("button", { type: "submit", class: "btn btn--primary" }, editing ? "Save changes" : "Create list");
@@ -110,7 +120,7 @@ export function openListForm({ categories, limits, styles, list, category, onSav
h("div", { class: "field" }, h("span", { class: "field-label" }, "Style"), layoutGroup,
h("span", { class: "field-hint" }, "How the list looks on your page. Visitors can switch styles on the list's own page.")),
artField,
h("label", { class: "check" }, visible, "Show this list on my public page"),
visField,
error,
),
h("div", { class: "dialog-foot" },
@@ -140,7 +150,7 @@ export function openListForm({ categories, limits, styles, list, category, onSav
maxItems: n,
description: desc.value,
layout: form.querySelector("input[name=layout]:checked").value,
visible: visible.checked,
visibility: form.querySelector("input[name=visibility]:checked").value,
art: isCustom() ? form.querySelector("input[name=art]:checked").value : "",
};
if (editing) body.slug = slug.value;
+7
View File
@@ -1,6 +1,7 @@
// Public pages: item detail dialog and grid/list toggle.
import { h, icon, openDialog } from "./common.js";
import { previewButton } from "./player.js";
import { quickShare } from "./share.js";
// Each ranked list on the page ships its items as JSON next to the markup.
const lists = [...document.querySelectorAll("[data-items]")].map((el) => ({
@@ -79,3 +80,9 @@ document.addEventListener("click", (e) => {
const found = findItem(Number(btn.dataset.item));
if (found) show(found.list, found.idx);
});
// Share button on a list page.
document.querySelector("[data-share]")?.addEventListener("click", (e) => {
const btn = e.currentTarget;
quickShare(new URL(btn.dataset.share, location.origin).href, btn.dataset.shareTitle);
});
+96
View File
@@ -0,0 +1,96 @@
// Sharing a list: copy its link, or hand it to the system share sheet.
import { h, icon, api, toast, openDialog, dialogHead, confirmDialog, busy } from "./common.js";
export const VISIBILITY = {
public: { label: "Public", icon: "external", hint: "On your page, and anyone with the link can see it." },
unlisted: { label: "Unlisted", icon: "link", hint: "Hidden from your page. Only people you send the link to can see it." },
private: { label: "Private", icon: "lock", hint: "Only you can see it." },
};
export function visibilityOf(list) {
return list.visibility || (list.visible ? "public" : "private");
}
export function shareURL(list) {
const v = visibilityOf(list);
if (v === "public") return new URL(`/l/${list.slug}`, location.origin).href;
if (v === "unlisted" && list.shareToken) return new URL(`/s/${list.shareToken}`, location.origin).href;
return "";
}
async function copy(url, input) {
try {
await navigator.clipboard.writeText(url);
toast("Link copied");
} catch {
// Clipboard needs HTTPS; fall back to selecting the text.
input?.select();
toast("Press Ctrl+C to copy the link");
}
}
const canNativeShare = () => typeof navigator.share === "function" && matchMedia("(pointer: coarse)").matches;
/** Visitor share: native sheet on phones, copy elsewhere. */
export async function quickShare(url, title) {
if (canNativeShare()) {
try { await navigator.share({ title, url }); return; } catch (e) { if (e.name === "AbortError") return; }
}
await copy(url);
}
/** Owner share dialog. onChange gets the updated list after a link reset. */
export function shareDialog(list, { onChange } = {}) {
let dlg;
const v = visibilityOf(list);
const body = h("div", { class: "dialog-body stack" });
const draw = () => {
const url = shareURL(list);
if (!url) {
body.replaceChildren(h("p", {}, "This list is private, so there's nothing to send yet. Set it to public or unlisted in List settings first."));
return;
}
const input = h("input", { type: "text", readonly: true, value: url, onfocus: (e) => e.target.select() });
const copyBtn = h("button", { type: "button", class: "btn btn--primary", onclick: () => copy(url, input) }, icon("link"), "Copy");
const parts = [
h("p", { class: "muted" }, VISIBILITY[v].hint),
h("div", { class: "input-group" }, input, copyBtn),
];
if (typeof navigator.share === "function") {
parts.push(h("button", { type: "button", class: "btn", onclick: () => quickShare(url, list.title) }, icon("external"), "Share…"));
}
if (v === "unlisted") {
const reset = h("button", { type: "button", class: "btn btn--ghost" }, icon("refresh"), "Make a new link");
reset.addEventListener("click", async () => {
const ok = await confirmDialog({
title: "Make a new link?",
message: "The current link will stop working for anyone you've sent it to.",
confirm: "Make new link",
danger: true,
});
if (!ok) return;
busy(reset, true);
try {
list = await api("POST", `/api/lists/${list.id}/share-link`);
onChange?.(list);
draw();
toast("New link made");
} catch (err) {
toast(err.message, { error: true });
} finally {
busy(reset, false);
}
});
parts.push(h("div", {}, reset, h("p", { class: "field-hint" }, "Use this if the link got passed around further than you wanted.")));
}
body.replaceChildren(...parts);
};
draw();
const content = h("div", {},
dialogHead(`Share “${list.title}”`, () => dlg),
body,
h("div", { class: "dialog-foot" }, h("button", { type: "button", class: "btn", onclick: () => dlg.close() }, "Done")),
);
dlg = openDialog(content);
return dlg;
}
+2 -1
View File
@@ -8,11 +8,12 @@
<span class="shelf-icon">{{icon $c.Icon}}</span>
<div>
<h1 data-bind="title">{{.Data.List.Title}}</h1>
<p class="muted"><span data-bind="count">{{.Data.List.ItemCount}}</span> of <span data-bind="max">{{.Data.List.MaxItems}}</span> · {{$c.Label}}<span data-bind="hidden">{{if not .Data.List.Visible}} · Hidden{{end}}</span></p>
<p class="muted"><span data-bind="count">{{.Data.List.ItemCount}}</span> of <span data-bind="max">{{.Data.List.MaxItems}}</span> · {{$c.Label}}<span data-bind="hidden">{{if eq .Data.List.Visibility "unlisted"}} · Unlisted{{else if eq .Data.List.Visibility "private"}} · Private{{end}}</span></p>
</div>
</div>
<div class="admin-head-actions">
<a class="btn btn--ghost" data-bind="public" href="/l/{{.Data.List.Slug}}">{{icon "external"}}View</a>
<button class="btn btn--ghost" type="button" data-action="share">{{icon "link"}}Share</button>
<button class="btn btn--ghost" type="button" data-action="import" title="Add entries from a CSV or text file">{{icon "upload"}}Import</button>
{{template "export" .Data.List.Slug}}
{{if ne $c.Key "custom"}}<button class="btn btn--ghost" type="button" data-action="refresh-all" title="Pull the latest details and artwork from each entry's source">{{icon "refresh"}}Refresh all</button>{{end}}
+2 -1
View File
@@ -12,10 +12,11 @@
{{with .List.Description}}<p class="list-desc">{{.}}</p>{{end}}
<p class="list-meta">
{{num .List.ItemCount}} {{plural .List.ItemCount "entry" "entries"}}{{if lt .List.ItemCount .List.MaxItems}} <span class="muted">of {{num .List.MaxItems}}</span>{{end}}
{{if not .List.Visible}}<span class="badge badge--warn">{{icon "eye-off"}}Hidden</span>{{end}}
{{if eq .List.Visibility "unlisted"}}<span class="badge badge--muted">{{icon "link"}}Unlisted</span>{{else if eq .List.Visibility "private"}}<span class="badge badge--warn">{{icon "lock"}}Private</span>{{end}}
</p>
</div>
<div class="list-actions">
{{with .List.SharePath}}<button class="btn btn--ghost" type="button" data-share="{{.}}" data-share-title="{{$.Data.List.Title}}">{{icon "link"}}Share</button>{{end}}
{{if $.LoggedIn}}<a class="btn btn--ghost" href="/admin/lists/{{.List.ID}}">{{icon "pencil"}}Edit</a>{{if .Items}}{{template "export" .List.Slug}}{{end}}{{end}}
{{if .Items}}
<nav class="segmented" aria-label="Style">