profile: drop unused title/signature/defaultAgentId fields
These were aspirational placeholders — stored to localStorage but never read by anything. Removed from the form, types, and persistence layer. Local profile is now just the avatar URL mirror, which the appbar reads before the server profile fetch resolves on mount. Preferences card renamed to "Avatar" since that's all that's left. Re-add server-backed if/when something actually consumes them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,23 +1,16 @@
|
||||
// Local user preferences — title, signature, default agent, plus a cache
|
||||
// mirror of the resolved avatar URL. Persisted in localStorage; reactive
|
||||
// across tabs. Identity (name, email) is owned by the arcadia session
|
||||
// (~/lib/session.ts); the public profile (bio, phone, location, timezone)
|
||||
// is server-backed via /api/v1/profile (~/lib/arcadia/profiles.ts).
|
||||
// Local mirror of the resolved avatar URL, so the appbar can render the
|
||||
// avatar before the profile fetch resolves on next mount. The real
|
||||
// profile (name, email, bio, phone, location, timezone, avatar) is
|
||||
// server-backed — see ~/lib/arcadia/profiles.ts.
|
||||
|
||||
import { useEffect, useSyncExternalStore } from "react"
|
||||
|
||||
export type Profile = {
|
||||
title: string
|
||||
signature: string
|
||||
avatarUrl: string
|
||||
defaultAgentId: string
|
||||
}
|
||||
|
||||
export const DEFAULT_PROFILE: Profile = {
|
||||
title: "",
|
||||
signature: "",
|
||||
avatarUrl: "",
|
||||
defaultAgentId: "",
|
||||
}
|
||||
|
||||
const STORAGE_KEY = "crema.profile"
|
||||
@@ -30,20 +23,10 @@ function readFromStorage(): Profile {
|
||||
if (!raw) return DEFAULT_PROFILE
|
||||
const parsed = JSON.parse(raw) as Partial<Profile>
|
||||
return {
|
||||
title:
|
||||
typeof parsed.title === "string" ? parsed.title : DEFAULT_PROFILE.title,
|
||||
signature:
|
||||
typeof parsed.signature === "string"
|
||||
? parsed.signature
|
||||
: DEFAULT_PROFILE.signature,
|
||||
avatarUrl:
|
||||
typeof parsed.avatarUrl === "string"
|
||||
? parsed.avatarUrl
|
||||
: DEFAULT_PROFILE.avatarUrl,
|
||||
defaultAgentId:
|
||||
typeof parsed.defaultAgentId === "string"
|
||||
? parsed.defaultAgentId
|
||||
: DEFAULT_PROFILE.defaultAgentId,
|
||||
}
|
||||
} catch {
|
||||
return DEFAULT_PROFILE
|
||||
|
||||
Reference in New Issue
Block a user