chore(message-gateway): swagger and format

This commit is contained in:
ryan
2026-08-16 12:27:03 +08:00
parent 30acdb91e8
commit a8fcf6087a
16 changed files with 71 additions and 45 deletions
@@ -24,7 +24,10 @@ import {
SelectTrigger,
SelectValue,
} from '@/components/ui/select';
import { TelegramForm, type TelegramFormValue } from '../channels/telegram/form';
import {
TelegramForm,
type TelegramFormValue,
} from '../channels/telegram/form';
import { QQForm, type QQFormValue } from '../channels/qq/form';
import type { CreateMessageChannelRequest } from '@/lib/services/message-gateway';
@@ -66,7 +69,9 @@ export function AddChannelDialog({
const canSubmit =
name.trim() !== '' &&
((type === 'telegram' && telegram.bot_token.trim() !== '') ||
(type === 'qq' && qq.app_id.trim() !== '' && qq.app_secret.trim() !== ''));
(type === 'qq' &&
qq.app_id.trim() !== '' &&
qq.app_secret.trim() !== ''));
const handleSubmit = () => {
if (!canSubmit || !type) return;
@@ -39,8 +39,7 @@ export function ChannelCard({
}: ChannelCardProps) {
const t = useTranslations('admin.messageGateway');
const [confirmOpen, setConfirmOpen] = React.useState(false);
const typeLabel =
channel.type === 'qq' ? t('typeQQ') : t('typeTelegram');
const typeLabel = channel.type === 'qq' ? t('typeQQ') : t('typeTelegram');
return (
<div className='rounded-xl border bg-card p-4 space-y-4'>
@@ -119,7 +119,9 @@ export default function MessageGatewayAdminPage() {
key={ch.id}
channel={ch}
toggling={toggleMutation.isPending}
deleting={deleteMutation.isPending && deleteMutation.variables === ch.id}
deleting={
deleteMutation.isPending && deleteMutation.variables === ch.id
}
onToggle={(enabled) =>
toggleMutation.mutate({ id: ch.id, enabled })
}