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:
@@ -1,5 +1,41 @@
|
||||
import prisma from '@/lib/prisma'
|
||||
|
||||
export type BillingOwnerContext = {
|
||||
billingOwnerId: string
|
||||
isGuestActor: boolean
|
||||
}
|
||||
|
||||
/** Resolve quota billing owner from an already-loaded session row (no extra query). */
|
||||
export function billingOwnerFromSession(
|
||||
sessionUserId: string,
|
||||
requestingUserId: string,
|
||||
): BillingOwnerContext {
|
||||
if (!sessionUserId) {
|
||||
throw new Error('Session has no owner — cannot resolve billing owner')
|
||||
}
|
||||
return {
|
||||
billingOwnerId: sessionUserId,
|
||||
isGuestActor: sessionUserId !== requestingUserId,
|
||||
}
|
||||
}
|
||||
|
||||
/** Host-pays: all collaborative AI usage is billed to BrainstormSession.userId (Story 3.4). */
|
||||
export async function getBillingOwner(
|
||||
sessionId: string,
|
||||
requestingUserId: string,
|
||||
): Promise<BillingOwnerContext> {
|
||||
const session = await prisma.brainstormSession.findUnique({
|
||||
where: { id: sessionId },
|
||||
select: { userId: true },
|
||||
})
|
||||
|
||||
if (!session) {
|
||||
throw new Error('Session not found')
|
||||
}
|
||||
|
||||
return billingOwnerFromSession(session.userId, requestingUserId)
|
||||
}
|
||||
|
||||
export async function verifyParticipant(
|
||||
sessionId: string,
|
||||
userId: string,
|
||||
|
||||
Reference in New Issue
Block a user