From 06a1f87422358cc957ff99c90ae2303b5752b03f Mon Sep 17 00:00:00 2001 From: alma Date: Sun, 20 Apr 2025 18:02:20 +0200 Subject: [PATCH] carnet panel --- components/carnet/navigation.tsx | 133 ++++++++++++++++--------------- 1 file changed, 70 insertions(+), 63 deletions(-) diff --git a/components/carnet/navigation.tsx b/components/carnet/navigation.tsx index 6d2a2b9f..4d90ed42 100644 --- a/components/carnet/navigation.tsx +++ b/components/carnet/navigation.tsx @@ -1,12 +1,12 @@ "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 { Search, BookOpen, Tag, Trash2, Star, Archive, X, Folder, FileText, Calendar, Heart, Users, LucideIcon, Layout } from 'lucide-react'; import { PaneLayout } from '@/app/carnet/page'; interface NavigationProps { - layout: PaneLayout; - onLayoutChange: (layout: PaneLayout) => void; + layout: string; + onLayoutChange: (layout: string) => void; nextcloudFolders: string[]; onFolderSelect: (folder: string) => void; } @@ -26,9 +26,29 @@ const FOLDER_CONFIG: Record = { 'Contacts': { icon: Users, order: 4 } }; -export default function Navigation({ layout, onLayoutChange, nextcloudFolders, onFolderSelect }: NavigationProps) { +export const Navigation: React.FC = ({ + layout, + onLayoutChange, + nextcloudFolders, + onFolderSelect, +}) => { 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; @@ -60,67 +80,54 @@ export default function Navigation({ layout, onLayoutChange, nextcloudFolders, o - {/* Navigation Items */} -
-
-
-
onLayoutChange?.(PaneLayout.ItemSelection)} - > - - Page - 54 -
- -
onLayoutChange?.(PaneLayout.TagSelection)} - > - - Important -
- -
- - Archivé - 18 -
- -
onLayoutChange?.(PaneLayout.TableView)} - > - - Corbeille -
-
+ {/* Layout Selection */} +
+
+ + Vues
+
+ + +
+
- {/* Nextcloud Folders Section */} - {sortedFolders.length > 0 && ( -
-

Vues

-
- {sortedFolders.map((folder) => { - const Icon = FOLDER_CONFIG[folder as FolderType]?.icon || Folder; - return ( -
onFolderSelect(folder)} - > - - {folder} -
- ); - })} -
-
- )} + {/* Folders */} +
+
+ {nextcloudFolders.map((folder) => { + const Icon = getFolderIcon(folder); + return ( + + ); + })} +
); -} \ No newline at end of file +}; \ No newline at end of file