feat: design system overhaul — sidebar, AI chats, settings, brainstorm, color cleanup
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 12s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 12s
- Sidebar: dynamic brand-accent colors, brainstorm section restyled - AI chat general: popup panel with expand/collapse, hides when contextual AI open - AI chat contextual: tabs reordered (Actions first), X close button, height fix - Settings: all tabs restyled, 6 new color presets (sage, terracotta, iron, etc.) - Global color cleanup: emerald/orange hardcoded → brand-accent dynamic - Brainstorm page: orange → brand-accent throughout - PageEntry animation component added to key pages - Floating AI button: bg-brand-accent instead of hardcoded black - i18n: all 15 locales updated with new AI/billing keys - Billing: freemium quota tracking, BYOK, stripe subscription scaffolding - Admin: integrated into new design - AGENTS.md + CLAUDE.md project rules added
This commit is contained in:
@@ -2,8 +2,26 @@
|
||||
|
||||
import { useQueryClient, useMutation, useQuery } from '@tanstack/react-query'
|
||||
import { queryKeys } from '@/lib/query-keys'
|
||||
import {
|
||||
BrainstormQuotaError,
|
||||
type BrainstormQuotaPayload,
|
||||
} from '@/lib/brainstorm-quota-client'
|
||||
import type { BrainstormSession, BrainstormSessionListItem } from '@/types/brainstorm'
|
||||
|
||||
function parseBrainstormQuota(res: Response, data: BrainstormQuotaPayload & Record<string, unknown>) {
|
||||
if (res.status === 402 && data?.error === 'QUOTA_EXCEEDED') {
|
||||
throw new BrainstormQuotaError(data, 'QUOTA_EXCEEDED')
|
||||
}
|
||||
}
|
||||
|
||||
/** i18n key for host-pays quota toasts (Story 3.4). */
|
||||
export function brainstormQuotaMessageKey(err: unknown): string | null {
|
||||
if (err instanceof BrainstormQuotaError) {
|
||||
return err.isGuestActor ? 'brainstorm.quotaGuest' : 'brainstorm.quotaHost'
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export interface CreateBrainstormResult {
|
||||
session: BrainstormSession
|
||||
contextSummary?: {
|
||||
@@ -79,6 +97,7 @@ export function useCreateBrainstorm() {
|
||||
body: JSON.stringify(input),
|
||||
})
|
||||
const data = await res.json()
|
||||
parseBrainstormQuota(res, data)
|
||||
if (!data.success) throw new Error(data.error || 'Failed to create brainstorm')
|
||||
return { session: data.data, contextSummary: data.contextSummary }
|
||||
},
|
||||
@@ -100,6 +119,7 @@ export function useExpandIdea(sessionId: string) {
|
||||
body: JSON.stringify(input),
|
||||
})
|
||||
const data = await res.json()
|
||||
parseBrainstormQuota(res, data)
|
||||
if (!data.success) throw new Error(data.error || 'Failed to expand idea')
|
||||
return data.data
|
||||
},
|
||||
@@ -258,6 +278,7 @@ export function useAddManualIdea(sessionId: string) {
|
||||
body: JSON.stringify(input),
|
||||
})
|
||||
const data = await res.json()
|
||||
parseBrainstormQuota(res, data)
|
||||
if (!data.success) throw new Error(data.error || 'Failed to add idea')
|
||||
return data.data
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user