Neah version mail widget 2
This commit is contained in:
parent
e85c4d948e
commit
7fe30320e9
@ -7,6 +7,7 @@ import { RefreshCw, Mail } from "lucide-react";
|
|||||||
import { useSession, signIn } from "next-auth/react";
|
import { useSession, signIn } from "next-auth/react";
|
||||||
import { formatDistance } from 'date-fns/formatDistance';
|
import { formatDistance } from 'date-fns/formatDistance';
|
||||||
import { fr } from 'date-fns/locale/fr';
|
import { fr } from 'date-fns/locale/fr';
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
interface Email {
|
interface Email {
|
||||||
id: string;
|
id: string;
|
||||||
@ -32,6 +33,7 @@ export function Email() {
|
|||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
const { status } = useSession();
|
const { status } = useSession();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const fetchEmails = async (isRefresh = false) => {
|
const fetchEmails = async (isRefresh = false) => {
|
||||||
if (isRefresh) setRefreshing(true);
|
if (isRefresh) setRefreshing(true);
|
||||||
@ -186,7 +188,7 @@ export function Email() {
|
|||||||
<div
|
<div
|
||||||
key={email.id}
|
key={email.id}
|
||||||
className="p-2 hover:bg-gray-50/50 rounded-lg transition-colors cursor-pointer"
|
className="p-2 hover:bg-gray-50/50 rounded-lg transition-colors cursor-pointer"
|
||||||
onClick={() => mailUrl && window.open(mailUrl, '_blank')}
|
onClick={() => router.push('/mail')}
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-between mb-1">
|
<div className="flex items-center justify-between mb-1">
|
||||||
<span className="text-sm text-gray-600 truncate max-w-[60%]" title={email.fromName || email.from}>
|
<span className="text-sm text-gray-600 truncate max-w-[60%]" title={email.fromName || email.from}>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user