/* A profile account's own page (server/src/routes/account.js): the account, the People record it has (as its owner edits it), its claim, and Discord. Not cached: it changes as they edit it. */ import { useRecord, type Resource } from './useRecord.ts' /* What an owner can take off the site (people.hide_*), in the order the profile page lists them. */ export const HIDE_FIELDS = [ ['photo', 'Photo'], ['pronouns', 'Pronouns'], ['tagline', 'Tagline'], ['bio', 'Bio'], ['email', 'Public email'], ['phone', 'Public phone'], ['location', 'Location'], ['links', 'Links'], ] as const export type HideField = (typeof HIDE_FIELDS)[number][0] export type MyPerson = { id: string display_name: string is_published: boolean photo: string | null pronouns: string | null tagline: string | null bio: string | null public_email: string | null public_phone: string | null location_label: string | null hidden: Record } export type MyAccount = { user: { id: number; email: string; name: string | null; role: string } person: MyPerson | null claim: { id: number; person_id: string; display_name: string; status: 'pending' | 'approved' | 'declined' } | null discord: { enabled: boolean; id: string | null; name: string | null } } export const useMyAccount = (enabled: boolean): Resource => useRecord(enabled ? '/account' : null, 'account')