'use client'; import Profile from './Profile'; import MaskList from './MaskList'; import VoiceActor from './VoiceActor'; import Font from './Font'; import MaxToken from './MaxToken'; import Background from './Background'; import ChatModel from './ChatModel'; import { IconButton } from '@/components/ui/button'; import React, { useState } from 'react'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog'; import { useStreamChatStore } from '../stream-chat'; import IconFont from '@/components/ui/iconFont'; import MaskCreate from './MaskCreate'; import { useTranslations } from 'next-intl'; type SettingProps = { open: boolean; onOpenChange: (open: boolean) => void; }; export type ActiveTabType = | 'profile' | 'mask_list' | 'mask_create' | 'history' | 'voice_actor' | 'font' | 'max_token' | 'background' | 'model'; export default function SettingDialog({ open, onOpenChange }: SettingProps) { const t = useTranslations('chat.drawer'); const [activeTab, setActiveTab] = useState('profile'); const updateUserChatSetting = useStreamChatStore((store) => store.updateUserChatSetting); const titleMap = { mask_list: t('maskedIdentityMode'), mask_create: t('createMask'), history: t('history'), voice_actor: t('voiceActorTitle'), font: t('fontTitle'), max_token: t('maxToken'), background: t('background'), model: t('model'), }; const handleChange = (open: boolean) => { if (!open) { updateUserChatSetting(); } onOpenChange(open); }; return ( {activeTab === 'profile' ? ( ) : ( titleMap[activeTab] )} {activeTab !== 'profile' && ( setActiveTab('profile')}> )}
{activeTab === 'profile' && } {activeTab === 'mask_list' && } {activeTab === 'mask_create' && } {activeTab === 'voice_actor' && } {activeTab === 'font' && } {activeTab === 'max_token' && } {activeTab === 'background' && } {activeTab === 'model' && }
); }