diff --git a/components/carnet/navigation.tsx b/components/carnet/navigation.tsx index 6c3e3f34..d07fe53a 100644 --- a/components/carnet/navigation.tsx +++ b/components/carnet/navigation.tsx @@ -1,13 +1,28 @@ "use client"; import React, { useState } from 'react'; -import { Search, FileText, Calendar, Heart, Users, ChevronRight, Folder } from 'lucide-react'; +import { Search, BookOpen, Tag, Trash2, Star, Archive, X, Folder, FileText, Calendar, Heart, Users, LucideIcon, ChevronRight } 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 } +}; + interface ContactGroup { name: string; contacts: string[]; @@ -48,82 +63,88 @@ export default function Navigation({ nextcloudFolders, onFolderSelect }: Navigat } }; + // 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 Bar */} -
+
+ {/* Search */} +
setSearchQuery(e.target.value)} - placeholder="Rechercher..." + 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 List */} -
-
    - {nextcloudFolders.map((folder) => ( -
  • - {folder === 'Contacts' ? ( - <> - - {/* Contact Groups */} -
      + {/* Folders */} +
      +
      + {sortedFolders.map((folder) => { + const Icon = getFolderIcon(folder); + return ( +
      + + {folder === 'Contacts' && ( +
      {contactGroups.map((group) => ( -
    • +
      {expandedGroups.has(group.name) && ( -
        +
        {group.contacts.map((contact) => ( -
      • - -
      • + ))} -
      +
      )} -
    • +
      ))} -
    - - ) : ( - - )} -
  • - ))} -
+
+ )} +
+ ); + })} +
);