"use client"; import React, { useState } from 'react'; import { Search, BookOpen, Tag, Trash2, Star, Archive, X, Folder, FileText, Calendar, Heart, Users, LucideIcon } from 'lucide-react'; import { PaneLayout } from '@/app/carnet/page'; interface NavigationProps { layout: PaneLayout; onLayoutChange: (layout: PaneLayout) => void; nextcloudFolders: string[]; onFolderSelect: (folder: string) => void; } type FolderType = 'Notes' | 'Diary' | 'Health' | 'Contacts'; interface FolderConfig { icon: LucideIcon; order: number; } // Define folder order and icons const FOLDER_CONFIG: Record = { 'Notes': { icon: FileText, order: 1 }, 'Diary': { icon: Calendar, order: 2 }, 'Health': { icon: Heart, order: 3 }, 'Contacts': { icon: Users, order: 4 } }; export default function Navigation({ layout, onLayoutChange, nextcloudFolders, onFolderSelect }: NavigationProps) { const [searchQuery, setSearchQuery] = useState(''); // Sort folders according to the specified order const sortedFolders = [...nextcloudFolders].sort((a, b) => { const orderA = (FOLDER_CONFIG[a as FolderType]?.order) || 999; const orderB = (FOLDER_CONFIG[b as FolderType]?.order) || 999; return orderA - orderB; }); return (
{/* Search */}
setSearchQuery(e.target.value)} placeholder="Recherché..." className="w-full pl-9 pr-4 py-2 bg-white border border-carnet-border rounded-md text-sm text-carnet-text-primary placeholder-carnet-text-muted focus:outline-none focus:ring-1 focus:ring-primary" /> {searchQuery && ( )}
{/* Navigation Items */}
onLayoutChange?.(PaneLayout.ItemSelection)} > Page 54
onLayoutChange?.(PaneLayout.TagSelection)} > Important
Archivé 18
onLayoutChange?.(PaneLayout.TableView)} > Corbeille
{/* Nextcloud Folders Section */} {sortedFolders.length > 0 && (

Vues

{sortedFolders.map((folder) => { const Icon = FOLDER_CONFIG[folder as FolderType]?.icon || Folder; return (
onFolderSelect(folder)} > {folder}
); })}
)}
); }