chore: format

This commit is contained in:
ryan
2026-08-16 21:39:25 +08:00
parent e5d2e4b6d5
commit 55c1fcd5f9
93 changed files with 544 additions and 439 deletions
@@ -44,10 +44,7 @@ export function ZoneEditorDialog({
.string()
.trim()
.min(1, t('rootRequired'))
.refine(
(value) => !/[*/?#@]|:\/\//.test(value),
t('rootInvalid'),
),
.refine((value) => !/[*/?#@]|:\/\//.test(value), t('rootInvalid')),
});
const form = useForm<Values>({
resolver: zodResolver(schema),
@@ -110,17 +110,13 @@ export function ZonePageClient() {
await queryClient.invalidateQueries({ queryKey: zoneQueryKey });
window.location.assign('/websites');
},
onError: (error) =>
toast.error(getErrorMessage(error, t('requestFailed'))),
onError: (error) => toast.error(getErrorMessage(error, t('requestFailed'))),
});
if (!mounted) {
return (
<div className='py-6 px-1'>
<LoadingStateWithBorder
icon={Globe}
description={t('loadingDetail')}
/>
<LoadingStateWithBorder icon={Globe} description={t('loadingDetail')} />
</div>
);
}
@@ -128,10 +124,7 @@ export function ZonePageClient() {
if (!Number.isInteger(zoneId) || zoneId <= 0) {
return (
<div className='py-6 px-1'>
<EmptyStateWithBorder
icon={Globe}
description={t('invalidId')}
/>
<EmptyStateWithBorder icon={Globe} description={t('invalidId')} />
</div>
);
}
@@ -139,10 +132,7 @@ export function ZonePageClient() {
if (overviewQuery.isLoading) {
return (
<div className='py-6 px-1'>
<LoadingStateWithBorder
icon={Globe}
description={t('loadingDetail')}
/>
<LoadingStateWithBorder icon={Globe} description={t('loadingDetail')} />
</div>
);
}
@@ -159,10 +149,7 @@ export function ZonePageClient() {
<ArrowLeft className='size-3.5' />
{t('back')}
</Button>
<EmptyStateWithBorder
icon={Globe}
description={t('notFound')}
/>
<EmptyStateWithBorder icon={Globe} description={t('notFound')} />
</div>
);
}
@@ -195,7 +182,9 @@ export function ZonePageClient() {
<h1 className='text-2xl font-semibold tracking-tight'>
{overview.zone.domain}
</h1>
<p className='text-sm text-muted-foreground'>{t('detailSubtitle')}</p>
<p className='text-sm text-muted-foreground'>
{t('detailSubtitle')}
</p>
</div>
</div>
</div>
@@ -257,13 +246,17 @@ export function ZonePageClient() {
</p>
<div className='mt-3 grid gap-2 text-sm sm:grid-cols-2'>
<div>
<p className='text-xs text-muted-foreground'>{t('currentRoot')}</p>
<p className='text-xs text-muted-foreground'>
{t('currentRoot')}
</p>
<p className='mt-1 font-mono text-[13px] font-medium'>
{overview.zone.domain}
</p>
</div>
<div>
<p className='text-xs text-muted-foreground'>{t('domainCount')}</p>
<p className='text-xs text-muted-foreground'>
{t('domainCount')}
</p>
<p className='mt-1 font-mono text-[13px] font-medium'>
{overview.domains.length}
</p>
@@ -281,7 +274,9 @@ export function ZonePageClient() {
</div>
<div className='rounded-lg border border-destructive/30 p-4'>
<p className='text-sm font-semibold text-destructive'>{t('dangerZone')}</p>
<p className='text-sm font-semibold text-destructive'>
{t('dangerZone')}
</p>
<p className='mt-1 text-sm text-muted-foreground'>
{t('dangerZoneDesc')}
</p>
@@ -181,7 +181,10 @@ export function CertificateApplyDialog({
<div className='grid gap-4 md:grid-cols-2'>
<div className='space-y-2'>
<Label>{t('name')}</Label>
<Input placeholder={t('namePlaceholder')} {...form.register('name')} />
<Input
placeholder={t('namePlaceholder')}
{...form.register('name')}
/>
</div>
<div className='space-y-2'>
<Label>{t('primaryDomain')}</Label>
@@ -115,7 +115,10 @@ export function CertificateEditorDialog({
<LoadingStateWithBorder description={t('loadingContent')} />
) : certificateQuery.isError ? (
<ErrorInline
message={getErrorMessage(certificateQuery.error, t('requestFailed'))}
message={getErrorMessage(
certificateQuery.error,
t('requestFailed'),
)}
className='justify-center'
/>
) : !certificateQuery.data ? (
@@ -268,15 +268,9 @@ export function QuickCreateZoneDomainDialog({
) : (
<p className='text-xs text-muted-foreground'>
{t.rich('domainExample', {
api: (chunks) => (
<code className='font-mono'>{chunks}</code>
),
fqdn: (chunks) => (
<code className='font-mono'>{chunks}</code>
),
apex: (chunks) => (
<code className='font-mono'>{chunks}</code>
),
api: (chunks) => <code className='font-mono'>{chunks}</code>,
fqdn: (chunks) => <code className='font-mono'>{chunks}</code>,
apex: (chunks) => <code className='font-mono'>{chunks}</code>,
})}
</p>
)}
@@ -39,7 +39,10 @@ export const defaultFileImportValues: FileImportFormValues = {
export function createAcmeApplySchema(t: TranslateFn) {
return z.object({
name: z.string().trim().min(1, t('validation.nameRequired')).max(255),
primary_domain: z.string().trim().min(1, t('validation.primaryDomainRequired')),
primary_domain: z
.string()
.trim()
.min(1, t('validation.primaryDomainRequired')),
other_domains: z.string(),
dns_account_id: z.number().min(1, t('validation.dnsAccountRequired')),
acme_account_id: z.number(),
+5 -8
View File
@@ -56,7 +56,9 @@ export default function WebsitesPage() {
<div className='flex items-center justify-between gap-3 pb-2'>
<div className='flex items-center gap-2'>
<Globe className='size-5 text-primary' />
<h1 className='text-2xl font-semibold tracking-tight'>{t('title')}</h1>
<h1 className='text-2xl font-semibold tracking-tight'>
{t('title')}
</h1>
</div>
<Button
variant='secondary'
@@ -81,10 +83,7 @@ export default function WebsitesPage() {
</div>
{zonesQuery.isLoading ? (
<LoadingStateWithBorder
icon={Globe}
description={t('loadingList')}
/>
<LoadingStateWithBorder icon={Globe} description={t('loadingList')} />
) : zonesQuery.isError ? (
<div className='rounded-lg border border-dashed p-8'>
<ErrorInline
@@ -96,9 +95,7 @@ export default function WebsitesPage() {
) : zones.length === 0 ? (
<EmptyStateWithBorder
icon={Globe}
description={
search ? t('emptySearch') : t('emptyList')
}
description={search ? t('emptySearch') : t('emptyList')}
/>
) : (
<div className='overflow-hidden rounded-lg border border-dashed shadow-none'>