fix: loyalty tier crash, chat duplicate rooms, sidebar defaults
- LoyaltyPage: levelBadge() now falls back to bronze for unknown tiers (DB had loyalty_tier='standard' from old seed data) - migration 040: deduplicate general chat rooms + add unique index, normalize loyalty_tier to bronze for non-standard values - chat.ts: ON CONFLICT clause now targets the new partial unique index - Sidebar: DEFAULT_GROUPS only opens 'basics' by default; bump localStorage key to sidebarGroups_v2 to clear stale stored state Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,16 +33,16 @@ type GroupKey = 'basics' | 'prices' | 'service' | 'management' | 'settingsGroup'
|
||||
|
||||
const DEFAULT_GROUPS: Record<GroupKey, boolean> = {
|
||||
basics: true,
|
||||
prices: true,
|
||||
service: true,
|
||||
management: true,
|
||||
settingsGroup: true,
|
||||
devGroup: true,
|
||||
prices: false,
|
||||
service: false,
|
||||
management: false,
|
||||
settingsGroup: false,
|
||||
devGroup: false,
|
||||
}
|
||||
|
||||
function loadGroups(): Record<GroupKey, boolean> {
|
||||
try {
|
||||
const stored = JSON.parse(localStorage.getItem('sidebarGroups') || '{}')
|
||||
const stored = JSON.parse(localStorage.getItem('sidebarGroups_v2') || '{}')
|
||||
return { ...DEFAULT_GROUPS, ...stored }
|
||||
} catch {
|
||||
return { ...DEFAULT_GROUPS }
|
||||
@@ -50,7 +50,7 @@ function loadGroups(): Record<GroupKey, boolean> {
|
||||
}
|
||||
|
||||
function saveGroups(groups: Record<GroupKey, boolean>) {
|
||||
localStorage.setItem('sidebarGroups', JSON.stringify(groups))
|
||||
localStorage.setItem('sidebarGroups_v2', JSON.stringify(groups))
|
||||
}
|
||||
|
||||
// ── NavItem with star ──────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user