v3: added content slugs, fixed real-time updates in client, added @mentions across the app, added new file selector and drop zone

This commit is contained in:
khannurien
2026-03-22 16:06:26 +00:00
parent 39a0cc397e
commit 34e908d1bc
42 changed files with 2170 additions and 628 deletions

18
api/lib/slugify.ts Normal file
View File

@@ -0,0 +1,18 @@
export const UUID_RE =
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
export function slugify(title: string): string {
const slug = title
.toLowerCase()
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "") // strip diacritics
.replace(/[^a-z0-9]+/g, "-") // non-alphanumeric → dash
.replace(/^-+|-+$/g, "") // trim leading/trailing dashes
.substring(0, 60);
return slug || "untitled";
}
/** Stable slug tied to the record's id — unique by construction. */
export function makeSlug(title: string, id: string): string {
return `${slugify(title)}-${id.substring(0, 8)}`;
}