add @ mentions in chat

This commit is contained in:
JCEEE
2026-09-09 20:57:25 +01:00
parent 3f95d50d2e
commit 8a02640cdc
9 changed files with 296 additions and 40 deletions
+5 -1
View File
@@ -52,7 +52,11 @@ export async function load(event) {
const pbToken = event.cookies.get('pb_token') || '';
let famId = '';
let chat: { famId: string; actor: ChatActor } | null = null;
let chat: {
famId: string;
actor: ChatActor;
members?: { id: string; name: string; color: string; role: 'parent' | 'child' }[];
} | null = null;
let fam: any = null;
let famAccess = {
disabled: false,
+2 -1
View File
@@ -170,7 +170,8 @@
actorType: chat.actor.type,
actorName: chat.actor.name,
actorColor: chat.actor.color || '#6366f1',
pbToken: page.data.pbToken || ''
pbToken: page.data.pbToken || '',
members: chat.members || []
});
});
</script>
+3 -2
View File
@@ -34,10 +34,11 @@ export async function POST(event: RequestEvent) {
? await s.chat.typing(famId, actor, { typing: Boolean(body.typing) })
: await s.chat.send(famId, actor, {
content: body.content || '',
clientId: body.clientId || ''
clientId: body.clientId || '',
siteUrl: event.url.origin
});
return json(data);
} catch (e) {
return json({ error: e instanceof Error ? e.message : 'chat request failed' }, { status: 400 });
}
}
}