56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
'use client'
|
|
|
|
// apps/admin/src/app/(admin)/subscriptions/new/client.tsx
|
|
// D3RO Voice — New Subscription Client Form
|
|
|
|
import { useState } from 'react'
|
|
import { Box, Typography, TextField } from '@mui/material'
|
|
import { C, FONT_SANS, FONT_MONO } from '@/lib/console-theme'
|
|
import { SubscriptionForm } from '@/components/subscription-form'
|
|
import { useRouter } from 'next/navigation'
|
|
|
|
interface NewSubscriptionClientProps {
|
|
initialUserId: string
|
|
}
|
|
|
|
export function NewSubscriptionClient({ initialUserId }: NewSubscriptionClientProps): React.ReactElement {
|
|
const [userId, setUserId] = useState(initialUserId)
|
|
const router = useRouter()
|
|
|
|
return (
|
|
<Box>
|
|
<Box sx={{ mb: 3 }}>
|
|
<Typography sx={{ fontFamily: FONT_SANS, fontSize: '13px', fontWeight: 600, color: C.dim, mb: 1 }}>
|
|
Target Account User ID or UID
|
|
</Typography>
|
|
<TextField
|
|
fullWidth
|
|
size="small"
|
|
value={userId}
|
|
onChange={(e) => setUserId(e.target.value)}
|
|
placeholder="Supabase user UUID"
|
|
sx={{
|
|
'& .MuiOutlinedInput-root': {
|
|
bgcolor: 'var(--d3-bg-inset-soft)',
|
|
color: C.bright,
|
|
borderRadius: '10px',
|
|
fontFamily: FONT_MONO,
|
|
fontSize: '13px',
|
|
'& fieldset': { borderColor: C.border },
|
|
'&:hover fieldset': { borderColor: C.borderHl },
|
|
'&.Mui-focused fieldset': { borderColor: C.accentLight },
|
|
},
|
|
}}
|
|
/>
|
|
</Box>
|
|
|
|
{userId && (
|
|
<SubscriptionForm
|
|
mode="create"
|
|
userId={userId}
|
|
onSuccess={() => router.push(`/subscriptions/${userId}`)}
|
|
/>
|
|
)}
|
|
</Box>
|
|
)
|
|
}
|