Notification Settings Loading

This commit is contained in:
headlesdev 2025-05-25 01:10:21 +02:00
parent cfc9bc5951
commit 2203daa2c3
2 changed files with 38 additions and 33 deletions

View File

@ -5,9 +5,10 @@ import AddNotification from '@/components/dialogues/AddNotification';
import DeleteNotification from '@/components/dialogues/DeleteNotification'; import DeleteNotification from '@/components/dialogues/DeleteNotification';
import useNotifications from '@/hooks/useNotifications'; import useNotifications from '@/hooks/useNotifications';
import { Plus, Trash2, Play, Bell } from 'lucide-react'; import { Plus, Trash2, Play, Bell } from 'lucide-react';
import Loading from '@/components/Loading';
export const NotificationSettings = ({ onError, onSuccess }: { onError: (message: string) => void, onSuccess: (message: string) => void }) => { export const NotificationSettings = ({ onError, onSuccess }: { onError: (message: string) => void, onSuccess: (message: string) => void }) => {
const { loadNotifications, notifications } = useNotifications(); const { loadNotifications, notifications, loading } = useNotifications();
const [deleteNotificationId, setDeleteNotificationId] = useState<number | null>(null); const [deleteNotificationId, setDeleteNotificationId] = useState<number | null>(null);
return ( return (
@ -23,7 +24,11 @@ export const NotificationSettings = ({ onError, onSuccess }: { onError: (message
Add Provider Add Provider
</button> </button>
</div> </div>
{ notifications && notifications.length > 0 ? ( {loading ? (
<div className="flex justify-center items-center h-64 w-full">
<Loading />
</div>
) : notifications && notifications.length > 0 ? (
<div className="rounded-xl overflow-hidden border border-base-200 mt-4"> <div className="rounded-xl overflow-hidden border border-base-200 mt-4">
<div className='overflow-x-auto'> <div className='overflow-x-auto'>
<table className='table table-zebra table-pin-cols'> <table className='table table-zebra table-pin-cols'>