make website run

This commit is contained in:
2025-12-17 14:40:46 +01:00
parent daa4bb6576
commit a213a5cf9f
54 changed files with 196 additions and 352 deletions

View File

@@ -4,10 +4,6 @@ import React, { useState, useEffect, useRef } from 'react';
import { useRouter } from 'next/navigation';
import Link from 'next/link';
import { useEffectiveDriverId } from '@/lib/currentDriver';
import {
getNotificationRepository,
getMarkNotificationReadUseCase,
} from '@/lib/di-container';
import type { Notification } from '@core/notifications/application';
import {
Bell,
@@ -52,23 +48,24 @@ export default function NotificationCenter() {
const currentDriverId = useEffectiveDriverId();
// Polling for new notifications
useEffect(() => {
const loadNotifications = async () => {
try {
const repo = getNotificationRepository();
const allNotifications = await repo.findByRecipientId(currentDriverId);
setNotifications(allNotifications);
} catch (error) {
console.error('Failed to load notifications:', error);
}
};
// TODO
// useEffect(() => {
// const loadNotifications = async () => {
// try {
// const repo = getNotificationRepository();
// const allNotifications = await repo.findByRecipientId(currentDriverId);
// setNotifications(allNotifications);
// } catch (error) {
// console.error('Failed to load notifications:', error);
// }
// };
loadNotifications();
// loadNotifications();
// Poll every 5 seconds
const interval = setInterval(loadNotifications, 5000);
return () => clearInterval(interval);
}, [currentDriverId]);
// // Poll every 5 seconds
// const interval = setInterval(loadNotifications, 5000);
// return () => clearInterval(interval);
// }, [currentDriverId]);
// Close panel when clicking outside
useEffect(() => {