delete notifications récente
This commit is contained in:
parent
c499c452f0
commit
ed97a410e7
@ -8,7 +8,6 @@ import {
|
||||
Zap,
|
||||
ArrowRight,
|
||||
FileText,
|
||||
Bell,
|
||||
} from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
import { cn } from '@/lib/utils'
|
||||
@ -147,14 +146,6 @@ export default async function DashboardPage() {
|
||||
|
||||
const displayName = profile?.username ?? user?.email?.split('@')[0] ?? 'Formateur'
|
||||
|
||||
// 5 dernières notifications non lues pour la section du dashboard
|
||||
const { data: recentNotifications } = await db
|
||||
.from('notifications')
|
||||
.select('id, type, title, body, created_at')
|
||||
.eq('user_id', user!.id)
|
||||
.eq('read', false)
|
||||
.order('created_at', { ascending: false })
|
||||
.limit(5)
|
||||
|
||||
const mappedSessions = (sessions ?? []).map((s: any) => ({
|
||||
id: s.id,
|
||||
@ -213,49 +204,20 @@ export default async function DashboardPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-6">
|
||||
<div className="card p-6">
|
||||
<h3 className="font-semibold text-text-primary mb-4">Notifications Récentes</h3>
|
||||
{(recentNotifications ?? []).length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center py-6 text-center">
|
||||
<Bell size={24} className="text-text-muted/40 mb-2" />
|
||||
<p className="text-sm text-text-muted">Aucune nouvelle notification</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-4">
|
||||
{(recentNotifications ?? []).map((notif: any) => {
|
||||
const icon = { session_created: '🚀', student_joined: '👤', session_ended: '✅' }[notif.type as string] ?? '🔔'
|
||||
return (
|
||||
<div key={notif.id} className="flex items-start gap-3">
|
||||
<div className="w-8 h-8 bg-background-elevated rounded-lg flex items-center justify-center text-sm flex-shrink-0">
|
||||
{icon}
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-sm font-medium text-text-primary">{notif.title}</p>
|
||||
<p className="text-xs text-text-muted">{notif.body}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="card p-6 bg-gradient-to-br from-primary to-blue-700 border-0">
|
||||
<div className="w-10 h-10 bg-white/20 rounded-xl flex items-center justify-center mb-4">
|
||||
<Zap size={20} className="text-white" />
|
||||
</div>
|
||||
<h3 className="font-bold text-white text-lg mb-2">Lancer un Quiz Rapide</h3>
|
||||
<p className="text-blue-100 text-sm mb-6">
|
||||
Créez instantanément un quiz pour un feedback immédiat de votre classe.
|
||||
</p>
|
||||
<Link
|
||||
href="/dashboard/sessions/create"
|
||||
className="inline-flex items-center gap-2 bg-white text-primary font-semibold px-4 py-2 rounded-lg hover:bg-blue-50 transition-colors"
|
||||
>
|
||||
Démarrer
|
||||
</Link>
|
||||
<div className="card p-6 bg-gradient-to-br from-primary to-blue-700 border-0">
|
||||
<div className="w-10 h-10 bg-white/20 rounded-xl flex items-center justify-center mb-4">
|
||||
<Zap size={20} className="text-white" />
|
||||
</div>
|
||||
<h3 className="font-bold text-white text-lg mb-2">Lancer un Quiz Rapide</h3>
|
||||
<p className="text-blue-100 text-sm mb-6">
|
||||
Créez instantanément un quiz pour un feedback immédiat de votre classe.
|
||||
</p>
|
||||
<Link
|
||||
href="/dashboard/sessions/create"
|
||||
className="inline-flex items-center gap-2 bg-white text-primary font-semibold px-4 py-2 rounded-lg hover:bg-blue-50 transition-colors"
|
||||
>
|
||||
Démarrer
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user