solve mail backend 9
This commit is contained in:
parent
2aa1981c50
commit
bb26e61fa6
@ -527,8 +527,8 @@ export default function MailPage() {
|
|||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
// No credentials found, redirect to login
|
// No credentials found, redirect to login
|
||||||
router.push("/mail/login");
|
router.push("/mail/login");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// We have credentials, fetch mails
|
// We have credentials, fetch mails
|
||||||
fetchMails();
|
fetchMails();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -540,18 +540,54 @@ export default function MailPage() {
|
|||||||
checkCredentials();
|
checkCredentials();
|
||||||
}, [router, fetchMails]);
|
}, [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) {
|
if (isLoading) {
|
||||||
return <div>Loading...</div>;
|
return (
|
||||||
|
<div className="flex items-center justify-center h-screen">
|
||||||
|
<p>Loading emails...</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return <div>Error: {error}</div>;
|
return (
|
||||||
|
<div className="flex items-center justify-center h-screen">
|
||||||
|
<p className="text-red-500">Error: {error}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col h-full">
|
<div className="flex flex-col h-screen">
|
||||||
<MailToolbar />
|
<MailToolbar
|
||||||
<MailList mails={mails} />
|
onRefresh={handleRefresh}
|
||||||
</div>
|
onCompose={handleCompose}
|
||||||
|
onSearch={handleSearch}
|
||||||
|
/>
|
||||||
|
<div className="flex-1 overflow-hidden">
|
||||||
|
<MailList
|
||||||
|
mails={mails}
|
||||||
|
onMailClick={handleMailClick}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1,34 +1,34 @@
|
|||||||
import { Button } from '@/components/ui/button';
|
import { Search } from "lucide-react";
|
||||||
import { Input } from '@/components/ui/input';
|
import { Button } from "@/components/ui/button";
|
||||||
import { Search, RefreshCw, Plus } from 'lucide-react';
|
import { Input } from "@/components/ui/input";
|
||||||
|
|
||||||
interface MailToolbarProps {
|
interface MailToolbarProps {
|
||||||
onCompose?: () => void;
|
onRefresh: () => void;
|
||||||
onRefresh?: () => void;
|
onCompose: () => void;
|
||||||
onSearch?: (query: string) => void;
|
onSearch: (query: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MailToolbar = ({ onCompose, onRefresh, onSearch }: MailToolbarProps) => {
|
export function MailToolbar({ onRefresh, onCompose, onSearch }: MailToolbarProps) {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-between p-4 border-b">
|
<div className="flex items-center justify-between p-4 border-b">
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-4">
|
||||||
<Button variant="ghost" size="icon" onClick={onRefresh}>
|
<Button variant="outline" onClick={onRefresh}>
|
||||||
<RefreshCw className="h-4 w-4" />
|
Refresh
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" size="icon" onClick={onCompose}>
|
<Button variant="outline" onClick={onCompose}>
|
||||||
<Plus className="h-4 w-4" />
|
Compose
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 max-w-md mx-4">
|
<div className="flex-1 max-w-md">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Search className="absolute left-2 top-2.5 h-4 w-4 text-gray-500" />
|
<Search className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
|
||||||
<Input
|
<Input
|
||||||
placeholder="Search emails..."
|
placeholder="Search emails..."
|
||||||
className="pl-8"
|
className="pl-8"
|
||||||
onChange={(e) => onSearch?.(e.target.value)}
|
onChange={(e) => onSearch(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
Loading…
Reference in New Issue
Block a user