From a30198cb2bb55f0129ed7e1c8ed49127750abbcf Mon Sep 17 00:00:00 2001 From: alma Date: Sat, 26 Apr 2025 23:18:51 +0200 Subject: [PATCH] courrier refactor --- app/courrier/page.tsx | 106 +++++++++++++++--------- components/email/BulkActionsToolbar.tsx | 4 +- components/email/EmailContent.tsx | 63 +++++++++----- components/email/EmailHeader.tsx | 8 +- 4 files changed, 114 insertions(+), 67 deletions(-) diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index 4ab5d5a4..e6947392 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -2,10 +2,14 @@ import React, { useState, useEffect } from 'react'; import { useRouter } from 'next/navigation'; -import { Loader2, AlertCircle, Mail } from 'lucide-react'; +import { + Mail, Loader2, AlertCircle, + ChevronLeft, ChevronRight, Reply, ReplyAll, Forward, + Star, FolderOpen +} from 'lucide-react'; import { Dialog, DialogContent } from '@/components/ui/dialog'; import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'; -import { +import { AlertDialog, AlertDialogAction, AlertDialogCancel, @@ -15,6 +19,9 @@ import { AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog"; +import { ScrollArea } from '@/components/ui/scroll-area'; +import { Avatar, AvatarFallback } from '@/components/ui/avatar'; +import { Button } from '@/components/ui/button'; // Import components import EmailSidebar from '@/components/email/EmailSidebar'; @@ -214,6 +221,18 @@ export default function CourrierPage() { }; }; + // Format date for display + const formatDate = (dateString: string) => { + const date = new Date(dateString); + const now = new Date(); + + if (date.toDateString() === now.toDateString()) { + return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); + } else { + return date.toLocaleDateString([], { month: 'short', day: 'numeric' }); + } + }; + return (
@@ -275,37 +294,41 @@ export default function CourrierPage() { onSearch={searchEmails} /> - {/* Main content area */} + {/* Main content area - fixed-width sidebar and list panel layout */}
- {/* Sidebar */} - loadEmails(false)} - onCompose={handleComposeNew} - isLoading={isLoading} - /> + {/* Sidebar - fixed width 64px */} +
+ loadEmails(false)} + onCompose={handleComposeNew} + isLoading={isLoading} + /> +
- {/* Email list */} - + {/* Email list - fixed width 320px */} +
+ +
- {/* Email content */} + {/* Email content - takes remaining space */}
{selectedEmail ? ( <> @@ -321,33 +344,36 @@ export default function CourrierPage() {
- - - +
- - {/* Email content area */} -
+ + {/* Email content with avatar and proper scroll area */} + -
+ ) : (
diff --git a/components/email/BulkActionsToolbar.tsx b/components/email/BulkActionsToolbar.tsx index fee07e56..cd445d7b 100644 --- a/components/email/BulkActionsToolbar.tsx +++ b/components/email/BulkActionsToolbar.tsx @@ -1,7 +1,7 @@ 'use client'; import React from 'react'; -import { Trash2, EyeOff, Archive } from 'lucide-react'; +import { Trash2, Archive, EyeOff } from 'lucide-react'; import { Button } from '@/components/ui/button'; interface BulkActionsToolbarProps { @@ -28,7 +28,7 @@ export default function BulkActionsToolbar({ onClick={() => onBulkAction('mark-read')} > - Mark Read + Mark as read )}