Add user profile customization with name, role, email, and phone

- Add UserProfileSchema to ClientSettings with name, role, email, phone fields
- Update database layer to persist profile data in client_settings table
- Rewrite ProfileOverlay component as editable form with save/cancel actions
- Update Topbar to display user's initials from profile name
- Profile data loaded on app mount and saved via settings.update RPC

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-15 00:26:57 -04:00
parent 0624026af3
commit c8a39e6416
4 changed files with 126 additions and 6 deletions

View File

@@ -25,7 +25,7 @@ import type {
ClientSettings,
ServerSettings,
} from "@mosaiciq/contracts/rpc";
import { ClientSettingsSchema, ServerSettingsSchema } from "@mosaiciq/contracts/rpcSchemas";
import { ClientSettingsSchema, ServerSettingsSchema, UserProfileSchema } from "@mosaiciq/contracts/rpcSchemas";
export function parseJsonWithSchema<T>(
value: string,
@@ -982,6 +982,7 @@ const DEFAULT_CLIENT_SETTINGS: ClientSettings = {
"navigation.agents": "Cmd+4",
"navigation.home": "Cmd+0",
},
profile: {},
};
export function getClientSettings(db: Db): ClientSettings {
@@ -999,6 +1000,9 @@ export function getClientSettings(db: Db): ClientSettings {
} else if (row.key === "navCollapsed") {
const navCollapsed = z.record(z.boolean()).safeParse(parsed);
if (navCollapsed.success) settings.navCollapsed = { ...settings.navCollapsed, ...navCollapsed.data };
} else if (row.key === "profile") {
const profile = UserProfileSchema.partial().safeParse(parsed);
if (profile.success) settings.profile = { ...settings.profile, ...profile.data };
} else {
const candidate = { ...settings, [row.key]: parsed };
const validated = ClientSettingsSchema.safeParse(candidate);
@@ -1041,6 +1045,9 @@ export function updateClientSettings(db: Db, settings: Partial<ClientSettings>):
if (settings.keybindings !== undefined) {
updateClientSetting(db, "keybindings", settings.keybindings);
}
if (settings.profile !== undefined) {
updateClientSetting(db, "profile", settings.profile);
}
}
export function getServerSettings(db: Db): ServerSettings {