"use client"; import React, { useState } from 'react'; import { Search, BookOpen, Tag, Trash2, Star, Archive, X, Folder, FileText, Calendar, Heart, Users, LucideIcon } from 'lucide-react'; interface NavigationProps { 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({ nextcloudFolders, onFolderSelect }: NavigationProps) { const [searchQuery, setSearchQuery] = useState(''); const getFolderIcon = (folder: string) => { switch (folder) { case 'Notes': return FileText; case 'Diary': return Calendar; case 'Health': return Heart; case 'Contacts': return Users; default: return FileText; } }; // 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 && ( )}
{/* Folders */}
{sortedFolders.map((folder) => { const Icon = getFolderIcon(folder); return ( ); })}
); }