import { useState } from 'react'; import { Alert, Badge, Button, Card, FormField, Input, Spinner, useToast, } from '@cameleer/design-system'; import { useTenantSettings, useChangeOwnPassword, useResetServerAdminPassword } from '../../api/tenant-hooks'; import { tierColor } from '../../utils/tier'; import styles from '../../styles/platform.module.css'; function statusColor(status: string): 'success' | 'error' | 'warning' | 'auto' { switch (status?.toUpperCase()) { case 'ACTIVE': return 'success'; case 'SUSPENDED': return 'warning'; case 'PROVISIONING': return 'auto'; case 'ERROR': return 'error'; default: return 'auto'; } } export function SettingsPage() { const { data, isLoading, isError } = useTenantSettings(); const changePassword = useChangeOwnPassword(); const resetServerAdmin = useResetServerAdminPassword(); const { toast } = useToast(); const [newPassword, setNewPassword] = useState(''); const [confirmPassword, setConfirmPassword] = useState(''); const [serverAdminPw, setServerAdminPw] = useState(''); async function handleChangePassword(e: React.FormEvent) { e.preventDefault(); if (newPassword.length < 8) { toast({ title: 'Password must be at least 8 characters', variant: 'error' }); return; } if (newPassword !== confirmPassword) { toast({ title: 'Passwords do not match', variant: 'error' }); return; } try { await changePassword.mutateAsync(newPassword); toast({ title: 'Password changed successfully', variant: 'success' }); setNewPassword(''); setConfirmPassword(''); } catch (err) { toast({ title: 'Failed to change password', description: String(err), variant: 'error' }); } } if (isLoading) { return (
); } if (isError || !data) { return (
Could not fetch settings. Please refresh.
); } return (

Settings

Name {data.name}
Slug {data.slug}
Tier
Status
Server Endpoint {data.serverEndpoint ?? '—'}
Created {new Date(data.createdAt).toLocaleDateString()}

To change your tier or other billing-related settings, please contact support.

Update your login password. Minimum 8 characters.

setNewPassword(e.target.value)} placeholder="Enter new password" required minLength={8} /> setConfirmPassword(e.target.value)} placeholder="Confirm new password" required minLength={8} />

Reset the built-in admin password for your server dashboard (local login at /login?local).

{ e.preventDefault(); if (serverAdminPw.length < 8) { toast({ title: 'Password must be at least 8 characters', variant: 'error' }); return; } try { await resetServerAdmin.mutateAsync(serverAdminPw); toast({ title: 'Server admin password reset successfully', variant: 'success' }); setServerAdminPw(''); } catch (err) { toast({ title: 'Failed to reset server admin password', description: String(err), variant: 'error' }); } }} style={{ display: 'flex', flexDirection: 'column', gap: 16, marginTop: 12 }} > setServerAdminPw(e.target.value)} placeholder="Enter new admin password" required minLength={8} />
); }