From bb26e61fa67677c4367e20467fb896a85252be41 Mon Sep 17 00:00:00 2001 From: alma Date: Thu, 17 Apr 2025 14:05:38 +0200 Subject: [PATCH] solve mail backend 9 --- app/mail/page.tsx | 52 +++++++++++++++++++++++++++----- components/mail/mail-toolbar.tsx | 32 ++++++++++---------- 2 files changed, 60 insertions(+), 24 deletions(-) diff --git a/app/mail/page.tsx b/app/mail/page.tsx index 1fef5ed6..6f833171 100644 --- a/app/mail/page.tsx +++ b/app/mail/page.tsx @@ -527,8 +527,8 @@ export default function MailPage() { if (!response.ok) { // No credentials found, redirect to login router.push("/mail/login"); - return; - } + return; + } // We have credentials, fetch mails fetchMails(); } catch (err) { @@ -540,18 +540,54 @@ export default function MailPage() { checkCredentials(); }, [router, fetchMails]); + const handleRefresh = () => { + fetchMails(); + }; + + const handleCompose = () => { + // TODO: Implement compose functionality + console.log('Compose clicked'); + }; + + const handleSearch = (query: string) => { + // TODO: Implement search functionality + console.log('Search:', query); + }; + + const handleMailClick = (mail: any) => { + // TODO: Implement mail view functionality + console.log('Mail clicked:', mail); + }; + if (isLoading) { - return
Loading...
; + return ( +
+

Loading emails...

+
+ ); } if (error) { - return
Error: {error}
; + return ( +
+

Error: {error}

+
+ ); } return ( -
- - -
+
+ +
+ +
+
); } \ No newline at end of file diff --git a/components/mail/mail-toolbar.tsx b/components/mail/mail-toolbar.tsx index 96048531..bfc0e225 100644 --- a/components/mail/mail-toolbar.tsx +++ b/components/mail/mail-toolbar.tsx @@ -1,34 +1,34 @@ -import { Button } from '@/components/ui/button'; -import { Input } from '@/components/ui/input'; -import { Search, RefreshCw, Plus } from 'lucide-react'; +import { Search } from "lucide-react"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; interface MailToolbarProps { - onCompose?: () => void; - onRefresh?: () => void; - onSearch?: (query: string) => void; + onRefresh: () => void; + onCompose: () => void; + onSearch: (query: string) => void; } -export const MailToolbar = ({ onCompose, onRefresh, onSearch }: MailToolbarProps) => { +export function MailToolbar({ onRefresh, onCompose, onSearch }: MailToolbarProps) { return (
-
- -
-
+
- + onSearch?.(e.target.value)} + onChange={(e) => onSearch(e.target.value)} />
); -}; \ No newline at end of file +} \ No newline at end of file