251210:1709 Frontend: reeactor organization and run build
Some checks failed
Spec Validation / validate-markdown (push) Has been cancelled
Spec Validation / validate-diagrams (push) Has been cancelled
Spec Validation / check-todos (push) Has been cancelled

This commit is contained in:
admin
2025-12-10 17:09:11 +07:00
parent aa96cd90e3
commit c8a0f281ef
140 changed files with 3780 additions and 1473 deletions

View File

@@ -3,30 +3,30 @@ import { NotificationResponse } from "@/types/notification";
// Mock Data
let mockNotifications = [
{
notification_id: 1,
notificationId: 1,
title: "RFA Approved",
message: "RFA-001 has been approved by the Project Manager.",
type: "SUCCESS" as const,
is_read: false,
created_at: new Date(Date.now() - 1000 * 60 * 15).toISOString(), // 15 mins ago
isRead: false,
createdAt: new Date(Date.now() - 1000 * 60 * 15).toISOString(), // 15 mins ago
link: "/rfas/1",
},
{
notification_id: 2,
notificationId: 2,
title: "New Correspondence",
message: "You have received a new correspondence from Contractor A.",
type: "INFO" as const,
is_read: false,
created_at: new Date(Date.now() - 1000 * 60 * 60).toISOString(), // 1 hour ago
isRead: false,
createdAt: new Date(Date.now() - 1000 * 60 * 60).toISOString(), // 1 hour ago
link: "/correspondences/3",
},
{
notification_id: 3,
notificationId: 3,
title: "Drawing Revision Required",
message: "Drawing S-201 requires revision based on recent comments.",
type: "WARNING" as const,
is_read: true,
created_at: new Date(Date.now() - 1000 * 60 * 60 * 24).toISOString(), // 1 day ago
isRead: true,
createdAt: new Date(Date.now() - 1000 * 60 * 60 * 24).toISOString(), // 1 day ago
link: "/drawings/2",
},
];
@@ -34,7 +34,7 @@ let mockNotifications = [
export const notificationApi = {
getUnread: async (): Promise<NotificationResponse> => {
await new Promise((resolve) => setTimeout(resolve, 300));
const unread = mockNotifications.filter((n) => !n.is_read);
const unread = mockNotifications.filter((n) => !n.isRead);
return {
items: mockNotifications, // Return all for the list, but count unread
unreadCount: unread.length,
@@ -44,7 +44,7 @@ export const notificationApi = {
markAsRead: async (id: number) => {
await new Promise((resolve) => setTimeout(resolve, 200));
mockNotifications = mockNotifications.map((n) =>
n.notification_id === id ? { ...n, is_read: true } : n
n.notificationId === id ? { ...n, isRead: true } : n
);
},
};