11import { Project } from '@/types/project' ;
2+ import type { Notification } from "react-notification-core"
3+
24
35export const mockProjects : Project [ ] = [
46 {
@@ -108,3 +110,72 @@ export const mockCampaignDetails = {
108110 ] ,
109111 status : 'validated' ,
110112} ;
113+
114+
115+
116+ const mockNotifications : Notification [ ] = [
117+
118+ {
119+ id : "1" ,
120+ title : "New feature available" ,
121+ message : "Check out our new dashboard features." ,
122+ timestamp : new Date ( Date . now ( ) - 60 * 60 * 1000 ) ,
123+ read : true ,
124+ type : "info" ,
125+ } ,
126+ {
127+ id : "2" ,
128+ title : "Action required" ,
129+ message : "Please verify your email address." ,
130+ timestamp : new Date ( Date . now ( ) - 2 * 60 * 60 * 1000 ) ,
131+ read : false ,
132+ type : "warning" ,
133+ } ,
134+ {
135+ id : "3" ,
136+ title : "Payment successful" ,
137+ message : "Your subscription has been renewed." ,
138+ timestamp : new Date ( Date . now ( ) - 1 * 24 * 60 * 60 * 1000 ) ,
139+ read : true ,
140+ type : "success" ,
141+ } ,
142+ {
143+ id : "4" ,
144+ title : "Login attempt" ,
145+ message : "A new login was detected from an unknown device." ,
146+ timestamp : new Date ( Date . now ( ) - 2 * 24 * 60 * 60 * 1000 ) ,
147+ read : false ,
148+ type : "error" ,
149+ } ,
150+ ]
151+
152+ let notifications = [ ...mockNotifications ]
153+
154+ // Mock API functions
155+ export async function mockFetchNotifications ( ) : Promise < Notification [ ] > {
156+ await new Promise ( ( resolve ) => setTimeout ( resolve , 500 ) )
157+
158+ // Simulate occasional errors (1 in 10 chance)
159+ if ( Math . random ( ) < 0.1 ) {
160+ throw new Error ( "Failed to fetch notifications" )
161+ }
162+
163+ return [ ...notifications ]
164+ }
165+
166+ export async function mockMarkAsRead ( id : string ) : Promise < void > {
167+ await new Promise ( ( resolve ) => setTimeout ( resolve , 300 ) )
168+ notifications = notifications . map ( ( notification ) =>
169+ notification . id === id ? { ...notification , read : true } : notification ,
170+ )
171+ }
172+
173+ export async function mockMarkAllAsRead ( ) : Promise < void > {
174+ await new Promise ( ( resolve ) => setTimeout ( resolve , 300 ) )
175+ notifications = notifications . map ( ( notification ) => ( { ...notification , read : true } ) )
176+ }
177+
178+ export async function mockDeleteNotification ( id : string ) : Promise < void > {
179+ await new Promise ( ( resolve ) => setTimeout ( resolve , 300 ) )
180+ notifications = notifications . filter ( ( notification ) => notification . id !== id )
181+ }
0 commit comments