"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 (
{/* Header */}
Settings

General Settings

Configure general application settings and preferences

{/* Quick Actions */}

Translation Services

Configure providers

Manage providers

Context & Glossary

Domain-specific settings

Configure context

Privacy & Security

Data protection

Coming soon
{/* Application Settings */}
Application Settings General configuration options

This language will be pre-selected when translating documents

{/* Supported Formats */}
Supported Formats Document types that can be translated
📊

Excel

.xlsx, .xls

Formulas Styles Images
📝

Word

.docx, .doc

Headers Tables Images
📽️

PowerPoint

.pptx, .ppt

Slides Notes Images
{/* System Information */}
API Information Backend server connection details
API Endpoint http://localhost:8000
Health Check /health
Translate Endpoint /translate
System Status Application health and performance
Connection Status
Connected
Last Sync Just now
Version v2.0.0
{/* Action Buttons */}

Need help with settings? Check our documentation.

); }