feat(message-gateway): add admin channel cards and per-type forms

This commit is contained in:
ryan
2026-08-16 12:22:28 +08:00
parent 635c1760ad
commit 124ce9bebb
12 changed files with 707 additions and 0 deletions
@@ -0,0 +1,57 @@
// Copyright 2026 Arctel.net
// SPDX-License-Identifier: Apache-2.0
'use client';
import { useTranslations } from 'next-intl';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
export interface QQFormValue {
app_id: string;
app_secret: string;
portal_host: string;
}
interface QQFormProps {
value: QQFormValue;
onChange: (value: QQFormValue) => void;
keepSecretHint?: boolean;
}
export function QQForm({ value, onChange, keepSecretHint }: QQFormProps) {
const t = useTranslations('admin.messageGateway');
return (
<div className='space-y-4'>
<div className='space-y-2'>
<Label htmlFor='mg-app-id'>{t('appId')}</Label>
<Input
id='mg-app-id'
value={value.app_id}
onChange={(e) => onChange({ ...value, app_id: e.target.value })}
/>
</div>
<div className='space-y-2'>
<Label htmlFor='mg-app-secret'>{t('appSecret')}</Label>
<Input
id='mg-app-secret'
type='password'
autoComplete='off'
value={value.app_secret}
placeholder={keepSecretHint ? t('keepSecretHint') : undefined}
onChange={(e) => onChange({ ...value, app_secret: e.target.value })}
/>
</div>
<div className='space-y-2'>
<Label htmlFor='mg-portal-host'>{t('portalHost')}</Label>
<Input
id='mg-portal-host'
value={value.portal_host}
placeholder={t('portalHostPlaceholder')}
onChange={(e) => onChange({ ...value, portal_host: e.target.value })}
/>
</div>
</div>
);
}
@@ -0,0 +1,54 @@
// Copyright 2026 Arctel.net
// SPDX-License-Identifier: Apache-2.0
'use client';
import { useTranslations } from 'next-intl';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
export interface TelegramFormValue {
bot_token: string;
base_url: string;
}
interface TelegramFormProps {
value: TelegramFormValue;
onChange: (value: TelegramFormValue) => void;
keepSecretHint?: boolean;
}
export function TelegramForm({
value,
onChange,
keepSecretHint,
}: TelegramFormProps) {
const t = useTranslations('admin.messageGateway');
return (
<div className='space-y-4'>
<div className='space-y-2'>
<Label htmlFor='mg-bot-token'>{t('botToken')}</Label>
<Input
id='mg-bot-token'
type='password'
autoComplete='off'
value={value.bot_token}
placeholder={
keepSecretHint ? t('keepSecretHint') : t('botTokenPlaceholder')
}
onChange={(e) => onChange({ ...value, bot_token: e.target.value })}
/>
</div>
<div className='space-y-2'>
<Label htmlFor='mg-base-url'>{t('baseUrl')}</Label>
<Input
id='mg-base-url'
value={value.base_url}
placeholder={t('baseUrlPlaceholder')}
onChange={(e) => onChange({ ...value, base_url: e.target.value })}
/>
</div>
</div>
);
}