"use client"; import { useState, useEffect } from "react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Label } from "@/components/ui/label"; import { Badge } from "@/components/ui/badge"; import { useTranslationStore } from "@/lib/store"; import { languages } from "@/lib/api"; import { Save, Loader2, Settings, Globe, Trash2, ArrowRight, Shield, Zap, Database } from "lucide-react"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import Link from "next/link"; export default function GeneralSettingsPage() { const { settings, updateSettings } = useTranslationStore(); const [isSaving, setIsSaving] = useState(false); const [isClearing, setIsClearing] = useState(false); const [defaultLanguage, setDefaultLanguage] = useState(settings.defaultTargetLanguage); useEffect(() => { setDefaultLanguage(settings.defaultTargetLanguage); }, [settings.defaultTargetLanguage]); const handleSave = async () => { setIsSaving(true); try { updateSettings({ defaultTargetLanguage: defaultLanguage }); await new Promise((resolve) => setTimeout(resolve, 500)); } finally { setIsSaving(false); } }; const handleClearCache = async () => { setIsClearing(true); try { // Clear localStorage localStorage.removeItem('translation-settings'); // Clear sessionStorage sessionStorage.clear(); // Clear any cached files/blobs if ('caches' in window) { const cacheNames = await caches.keys(); await Promise.all(cacheNames.map(name => caches.delete(name))); } await new Promise((resolve) => setTimeout(resolve, 500)); // Reload to reset state window.location.reload(); } catch (error) { console.error('Error clearing cache:', error); setIsClearing(false); } }; return (
Configure general application settings and preferences
Configure providers
Domain-specific settings
Data protection
This language will be pre-selected when translating documents
.xlsx, .xls
.docx, .doc
.pptx, .ppt
http://localhost:8000
/health
/translate
Need help with settings? Check our documentation.