add theme patterns

This commit is contained in:
JCEEE
2026-09-10 13:23:55 +01:00
parent 27492b1558
commit a270d965fe
13 changed files with 1429 additions and 27 deletions
+12
View File
@@ -146,6 +146,18 @@ async function ensureUsers(ids: Record<string, string>): Promise<void> {
usersCol.fields.push({ name: 'color', type: 'text', required: false });
changed = true;
}
if (!has('pattern')) {
usersCol.fields.push({ name: 'pattern', type: 'text', required: false });
changed = true;
}
if (!has('themeSize')) {
usersCol.fields.push({ name: 'themeSize', type: 'text', required: false });
changed = true;
}
if (!has('themeOpacity')) {
usersCol.fields.push({ name: 'themeOpacity', type: 'text', required: false });
changed = true;
}
if (!has('passwordResetToken')) {
usersCol.fields.push({ name: 'passwordResetToken', type: 'text', required: false });
changed = true;
+22 -3
View File
@@ -69,7 +69,15 @@ export async function patchFam(pb: any, famId: string, body: Record<string, unkn
export async function getProfile(pb: any, famId: string, userId: string) {
const rec = await pb.collection('users').getOne(userId);
return { id: rec.id, name: rec.name || '', color: rec.color || '#6366f1', email: rec.email || '' };
return {
id: rec.id,
name: rec.name || '',
color: rec.color || '#6366f1',
pattern: rec.pattern || '',
themeSize: rec.themeSize || '',
themeOpacity: rec.themeOpacity || '',
email: rec.email || ''
};
}
export async function updateProfile(
@@ -81,9 +89,20 @@ export async function updateProfile(
const patch: Record<string, unknown> = {};
if (data.name) patch.name = data.name;
if (data.color) patch.color = data.color;
if (data.pattern !== undefined) patch.pattern = data.pattern;
if (data.themeSize !== undefined) patch.themeSize = data.themeSize;
if (data.themeOpacity !== undefined) patch.themeOpacity = data.themeOpacity;
if (data.email !== undefined) patch.email = data.email;
const rec = await pb.collection('users').update(userId, patch);
return { id: rec.id, name: rec.name || '', color: rec.color || '#6366f1', email: rec.email || '' };
return {
id: rec.id,
name: rec.name || '',
color: rec.color || '#6366f1',
pattern: rec.pattern || '',
themeSize: rec.themeSize || '',
themeOpacity: rec.themeOpacity || '',
email: rec.email || ''
};
}
export async function weeklySummary(pb: any, famId: string) {
@@ -309,4 +328,4 @@ export async function completeWeek(pb: any, famId: string) {
historyRecords,
memberCount: members.length
};
}
}
+4 -1
View File
@@ -5,4 +5,7 @@ export interface SessionUser {
role: 'parent' | 'child';
famId: string;
color?: string;
}
pattern?: string;
themeSize?: string;
themeOpacity?: string;
}