feat: ship Wave 5-6 multi-surface hygiene, optimization, and bug fixes

This commit is contained in:
Yun Chan 2026-11-14 11:51:41 +09:00
parent 01ef3293cf
commit 66b6b45ba9
399 changed files with 17828 additions and 11330 deletions

View file

@ -7,6 +7,8 @@ import { DoubleBezelCard, TactileBadge } from '@d3ro/ui/components/ds'
import { getSupabaseAdminClient, isSupabaseAdminConfigured } from '@/lib/supabase-admin'
import { UnavailableAdminPanel } from '@/components/unavailable-admin-panel'
import { requireManager, hasMinRole } from '@/lib/admin-guard'
import { ADMIN_UUID_PATTERN } from '@/lib/request-security'
import { DetailRow } from '@/components/detail-row'
import Link from 'next/link'
import { notFound } from 'next/navigation'
import { SubscriptionDetailClient } from './client'
@ -16,6 +18,7 @@ interface PageProps {
}
export default async function SubscriptionDetailPage({ params }: PageProps): Promise<React.ReactElement> {
const admin = await requireManager()
if (!isSupabaseAdminConfigured()) {
return (
<UnavailableAdminPanel
@ -26,7 +29,7 @@ export default async function SubscriptionDetailPage({ params }: PageProps): Pro
)
}
const { id: userId } = await params
const admin = await requireManager()
if (!ADMIN_UUID_PATTERN.test(userId)) notFound()
const supabase = await getSupabaseAdminClient()
const [subRes, profileRes, auditRes] = await Promise.all([
@ -123,9 +126,9 @@ export default async function SubscriptionDetailPage({ params }: PageProps): Pro
Account Identifiers
</Typography>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1.5, fontFamily: FONT_SANS, fontSize: '13px' }}>
<Row label="Customer Name" value={(profile.name as string) ?? '-'} />
<Row label="Account UID" value={userId} isMono />
<Row label="Assigned Role" value={((profile.role as string) ?? 'user').toUpperCase()} isMono />
<DetailRow label="Customer Name" value={(profile.name as string) ?? '-'} />
<DetailRow label="Account UID" value={userId} isMono />
<DetailRow label="Assigned Role" value={((profile.role as string) ?? 'user').toUpperCase()} isMono />
</Box>
</DoubleBezelCard>
@ -135,11 +138,11 @@ export default async function SubscriptionDetailPage({ params }: PageProps): Pro
Contract Status & Pricing
</Typography>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1.5, fontFamily: FONT_SANS, fontSize: '13px' }}>
<Row label="Plan Level" value={isProPlus ? 'PRO+ VIP' : isPro ? 'PRO' : 'FREE'} />
<Row label="Current Status" value={sub?.status ? String(sub.status).toUpperCase() : 'NO SUBSCRIPTION'} />
<Row label="Payment Gateway" value={sub?.payment_provider ? String(sub.payment_provider).toUpperCase() : 'NOT ASSIGNED'} />
<Row label="Contract Expires / Renews" value={sub?.current_period_end ? new Date(sub.current_period_end as string).toLocaleDateString() : 'NOT SET'} />
<Row label="Overage Credits" value={sub ? String(sub.overage_credits) : 'NO SUBSCRIPTION'} isMono />
<DetailRow label="Plan Level" value={isProPlus ? 'PRO+ VIP' : isPro ? 'PRO' : 'FREE'} />
<DetailRow label="Current Status" value={sub?.status ? String(sub.status).toUpperCase() : 'NO SUBSCRIPTION'} />
<DetailRow label="Payment Gateway" value={sub?.payment_provider ? String(sub.payment_provider).toUpperCase() : 'NOT ASSIGNED'} />
<DetailRow label="Contract Expires / Renews" value={sub?.current_period_end ? new Date(sub.current_period_end as string).toLocaleDateString() : 'NOT SET'} />
<DetailRow label="Overage Credits" value={sub ? String(sub.overage_credits) : 'NO SUBSCRIPTION'} isMono />
</Box>
</DoubleBezelCard>
</Box>
@ -215,14 +218,3 @@ export default async function SubscriptionDetailPage({ params }: PageProps): Pro
</>
)
}
function Row({ label, value, isMono }: { label: string; value: string; isMono?: boolean }): React.ReactElement {
return (
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', py: 0.5, borderBottom: `1px solid ${C.border}` }}>
<Typography sx={{ fontFamily: FONT_SANS, fontSize: '12px', color: C.dim }}>{label}</Typography>
<Typography sx={{ fontFamily: isMono ? FONT_MONO : FONT_SANS, fontSize: '12px', fontWeight: 600, color: C.bright }}>
{value}
</Typography>
</Box>
)
}