fix: toolbar carnet nettoyé — un seul organisateur, i18n corrigé
- Ancien bouton 'Organiser' (batch.organize) supprimé — doublon - Nouvel organisateur (structuredViews.organizer) consolidé avec Planning + Résumé - Actions IA regroupées avec séparateurs visuels - Icônes plus petites (14px au lieu de 16px) pour gagner de la place - Clé i18n corrigée : structuredViews.organizer au lieu de wizard.organizer - CSV Import/Export maintenu dans la même zone - OrganizeNotebookDialog marqué unused
This commit is contained in:
@@ -20,7 +20,7 @@ import {
|
||||
|
||||
import { NotebookSuggestionToast } from '@/components/notebook-suggestion-toast'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Plus, ArrowUpDown, Search, Sparkles, FileText, FolderOpen, ChevronRight, Tag as TagIcon, X, Menu, LayoutGrid, List, Table, Columns3, CalendarDays, Wand2 } from 'lucide-react'
|
||||
import { Plus, ArrowUpDown, Search, Sparkles, FileText, FolderOpen, ChevronRight, Tag as TagIcon, X, Menu, LayoutGrid, List, Table, Columns3, CalendarDays, Wand2, Download, Upload } from 'lucide-react'
|
||||
import { emitNoteChange } from '@/lib/note-change-sync'
|
||||
import { useReminderCheck } from '@/hooks/use-reminder-check'
|
||||
import { useAutoLabelSuggestion } from '@/hooks/use-auto-label-suggestion'
|
||||
@@ -129,7 +129,7 @@ export function HomeClient({
|
||||
const [autoLabelOpen, setAutoLabelOpen] = useState(false)
|
||||
const [summaryDialogOpen, setSummaryDialogOpen] = useState(false)
|
||||
const [createSubNotebookOpen, setCreateSubNotebookOpen] = useState(false)
|
||||
const [organizeNotebookOpen, setOrganizeNotebookOpen] = useState(false)
|
||||
const [organizeNotebookOpen, setOrganizeNotebookOpen] = useState(false) // kept for compat — old dialog unused
|
||||
const [selectedTagIds, setSelectedTagIds] = useState<string[]>([])
|
||||
const [isTagsExpanded, setIsTagsExpanded] = useState(false)
|
||||
const [tagSearchQuery, setTagSearchQuery] = useState('')
|
||||
@@ -139,6 +139,35 @@ export function HomeClient({
|
||||
const [showStudyPlanner, setShowStudyPlanner] = useState(false)
|
||||
const [showOrganizer, setShowOrganizer] = useState(false)
|
||||
|
||||
const handleExportCSV = useCallback(() => {
|
||||
if (!searchParams.get('notebook')) return
|
||||
window.open(`/api/notebooks/csv?notebookId=${searchParams.get('notebook')}`, '_blank')
|
||||
}, [searchParams])
|
||||
|
||||
const handleImportCSV = useCallback(() => {
|
||||
const input = document.createElement('input')
|
||||
input.type = 'file'
|
||||
input.accept = '.csv'
|
||||
input.onchange = async (e) => {
|
||||
const file = (e.target as HTMLInputElement).files?.[0]
|
||||
if (!file) return
|
||||
const text = await file.text()
|
||||
const res = await fetch(`/api/notebooks/csv?notebookId=${searchParams.get('notebook')}`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ notebookId: searchParams.get('notebook'), csvData: text }),
|
||||
})
|
||||
const data = await res.json()
|
||||
if (res.ok) {
|
||||
toast.success(`${data.created} notes importées !`)
|
||||
window.location.reload()
|
||||
} else {
|
||||
toast.error(data.error || 'Erreur')
|
||||
}
|
||||
}
|
||||
input.click()
|
||||
}, [searchParams])
|
||||
|
||||
const notebookFilter = searchParams.get('notebook')
|
||||
const schemaHook = useNotebookSchema(notebookFilter)
|
||||
const structuredModeActive = Boolean(notebookFilter && schemaHook.schema)
|
||||
@@ -927,17 +956,6 @@ export function HomeClient({
|
||||
<span>{t('notes.reorganize')}</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
{currentNotebook && initialSettings.aiAssistantEnabled && (
|
||||
<button
|
||||
onClick={() => setOrganizeNotebookOpen(true)}
|
||||
className="flex items-center gap-2 text-[13px] text-brand-accent font-medium hover:opacity-70 transition-opacity"
|
||||
title={t('notebook.organizeNotebookWithAITooltip')}
|
||||
>
|
||||
<Sparkles size={16} />
|
||||
<span>{t('batch.organize')}</span>
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-4 flex-wrap">
|
||||
<div className="bg-foreground/[0.03] dark:bg-white/[0.04] p-0.5 rounded-full flex border border-border/30 items-center">
|
||||
@@ -1026,45 +1044,49 @@ export function HomeClient({
|
||||
</button>
|
||||
)}
|
||||
|
||||
{searchParams.get('notebook') && (
|
||||
<button
|
||||
onClick={() => setSummaryDialogOpen(true)}
|
||||
disabled={!initialSettings.aiAssistantEnabled}
|
||||
className={cn(
|
||||
"flex items-center gap-2 text-[13px] font-medium transition-opacity",
|
||||
initialSettings.aiAssistantEnabled ? "text-foreground hover:opacity-70" : "text-muted-foreground opacity-50 cursor-not-allowed"
|
||||
)}
|
||||
title={initialSettings.aiAssistantEnabled ? t('notebook.summary') : t('notebook.assistantRequiredForSummarize')}
|
||||
>
|
||||
<FileText size={16} />
|
||||
<span>{t('notebook.summary')}</span>
|
||||
{searchParams.get('notebook') && initialSettings.aiAssistantEnabled && (
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => setSummaryDialogOpen(true)}
|
||||
className="flex items-center gap-1.5 text-[12px] text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
<FileText size={14} />
|
||||
<span>{t('notebook.summary')}</span>
|
||||
</button>
|
||||
<span className="w-px h-3.5 bg-border/40" />
|
||||
<button
|
||||
onClick={() => setShowStudyPlanner(true)}
|
||||
className="flex items-center gap-1.5 text-[12px] text-muted-foreground hover:text-brand-accent transition-colors"
|
||||
>
|
||||
<CalendarDays size={14} />
|
||||
<span>{t('wizard.studyPlanner') || 'Planning'}</span>
|
||||
</button>
|
||||
<span className="w-px h-3.5 bg-border/40" />
|
||||
<button
|
||||
onClick={() => setShowOrganizer(true)}
|
||||
className="flex items-center gap-1.5 text-[12px] text-muted-foreground hover:text-brand-accent transition-colors"
|
||||
>
|
||||
<Wand2 size={14} />
|
||||
<span>{t('structuredViews.organizer') || 'Organiser'}</span>
|
||||
</button>
|
||||
)}
|
||||
{searchParams.get('notebook') && (
|
||||
<button
|
||||
onClick={() => setShowStudyPlanner(true)}
|
||||
disabled={!initialSettings.aiAssistantEnabled}
|
||||
className={cn(
|
||||
"flex items-center gap-2 text-[13px] font-medium transition-opacity",
|
||||
initialSettings.aiAssistantEnabled ? "text-brand-accent hover:opacity-70" : "text-muted-foreground opacity-50 cursor-not-allowed"
|
||||
)}
|
||||
>
|
||||
<CalendarDays size={16} />
|
||||
<span>{t('wizard.studyPlanner') || 'Planning'}</span>
|
||||
</button>
|
||||
)}
|
||||
{searchParams.get('notebook') && (
|
||||
<button
|
||||
onClick={() => setShowOrganizer(true)}
|
||||
disabled={!initialSettings.aiAssistantEnabled}
|
||||
className={cn(
|
||||
"flex items-center gap-2 text-[13px] font-medium transition-opacity",
|
||||
initialSettings.aiAssistantEnabled ? "text-brand-accent hover:opacity-70" : "text-muted-foreground opacity-50 cursor-not-allowed"
|
||||
)}
|
||||
>
|
||||
<Wand2 size={16} />
|
||||
<span>{t('wizard.organizer') || 'Organiser'}</span>
|
||||
</button>
|
||||
<div className="flex items-center gap-1">
|
||||
<button
|
||||
onClick={handleImportCSV}
|
||||
className="p-1.5 rounded-full text-muted-foreground hover:text-foreground transition-colors"
|
||||
title={t('structuredViews.importCsv') || 'Importer CSV'}
|
||||
>
|
||||
<Upload size={15} />
|
||||
</button>
|
||||
<button
|
||||
onClick={handleExportCSV}
|
||||
className="p-1.5 rounded-full text-muted-foreground hover:text-foreground transition-colors"
|
||||
title={t('structuredViews.exportCsv') || 'Exporter CSV'}
|
||||
>
|
||||
<Download size={15} />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
<button
|
||||
onClick={() => setSortOrder(s => s === 'newest' ? 'oldest' : s === 'oldest' ? 'alpha' : s === 'alpha' ? 'manual' : 'newest')}
|
||||
|
||||
Reference in New Issue
Block a user