'use client' import { useTransition } from 'react' import { LayoutGrid, PanelsTopLeft } from 'lucide-react' import { cn } from '@/lib/utils' import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' import { updateAISettings } from '@/app/actions/ai-settings' import { useLanguage } from '@/lib/i18n' import type { NotesViewMode } from '@/components/notes-main-section' interface NotesViewToggleProps { mode: NotesViewMode onModeChange: (mode: NotesViewMode) => void className?: string } export function NotesViewToggle({ mode, onModeChange, className }: NotesViewToggleProps) { const { t, language } = useLanguage() const [pending, startTransition] = useTransition() const setMode = (next: NotesViewMode) => { if (next === mode) return const previous = mode onModeChange(next) startTransition(async () => { try { await updateAISettings({ notesViewMode: next }) } catch { onModeChange(previous) } }) } return (
{t('notes.viewCardsTooltip')} {t('notes.viewTabsTooltip')}
) }