Truncate MPD URLs in live-lists channel overview.

This commit is contained in:
Jos Vooges | STH 2026-09-18 20:08:42 +02:00
parent 94bf98ded7
commit b49a9144b2

View file

@ -74,6 +74,21 @@ function formFromChannel(c: LiveChannelRow): ChannelForm {
};
}
/** Korte preview in zender-overzicht (volledige URL via title/tooltip). */
function shortUrl(url: string, max = 42): string {
const s = url.trim();
if (s.length <= max) return s;
try {
const u = new URL(s);
const path = u.pathname.split("/").filter(Boolean).pop() ?? "";
const host = u.host.replace(/^www\./, "");
const tip = path ? `${host}/…/${path}` : host;
return tip.length <= max ? tip : `${tip.slice(0, max - 1)}…`;
} catch {
return `${s.slice(0, max - 1)}…`;
}
}
export default function LiveListsPage() {
useAuth();
const [lists, setLists] = useState<LiveListSummary[]>([]);