'use client';
import { useState } from 'react';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import {
Settings, Trash2, Loader2, FileSpreadsheet, FileText, Presentation,
} from 'lucide-react';
import { useI18n } from '@/lib/i18n';
export default function GeneralSettingsPage() {
const { t } = useI18n();
const [isClearing, setIsClearing] = useState(false);
const handleClearCache = async () => {
setIsClearing(true);
try {
localStorage.removeItem('translation-settings');
sessionStorage.clear();
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));
window.location.reload();
} catch (error) {
console.error('Error clearing cache:', error);
setIsClearing(false);
}
};
const formats = [
{ icon:
{t('settings.subtitle')}
{f.name}
{f.ext}
{t('settings.cache.desc')}