diff --git a/client/src/widgets/sidebar/interfaces/index.ts b/client/src/widgets/sidebar/interfaces/index.ts new file mode 100644 index 00000000..d9b217ce --- /dev/null +++ b/client/src/widgets/sidebar/interfaces/index.ts @@ -0,0 +1 @@ +export * from './notification'; diff --git a/client/src/widgets/sidebar/interfaces/notification.ts b/client/src/widgets/sidebar/interfaces/notification.ts new file mode 100644 index 00000000..a42e1bf6 --- /dev/null +++ b/client/src/widgets/sidebar/interfaces/notification.ts @@ -0,0 +1,17 @@ +import { IUserResponse, Identifiable, Timestamps } from '@teameights/types'; + +interface INotificationBase extends Identifiable, Timestamps { + receiver: IUserResponse; + type: 'system' | 'friend_request'; + read: boolean; + createdAt: Date; + updatedAt: Date; +} + +export interface IFriendNotification extends INotificationBase { + type: 'friend_request'; + data: { + status: string; + creator: IUserResponse; + }; +} diff --git a/client/src/widgets/sidebar/ui/notification-item/notification-item.tsx b/client/src/widgets/sidebar/ui/notification-item/notification-item.tsx index deb7f666..f9694289 100644 --- a/client/src/widgets/sidebar/ui/notification-item/notification-item.tsx +++ b/client/src/widgets/sidebar/ui/notification-item/notification-item.tsx @@ -3,14 +3,15 @@ import React from 'react'; import { SidebarSystemNotification } from './system-notification'; import styles from './notification-item.module.scss'; -import { NotificationType } from '@teameights/types'; import { SidebarFriendNotification } from './friend-notification'; +import { ISystemNotification } from '@teameights/types'; +import { IFriendNotification } from '../../interfaces'; export interface NotificationProps { /** * The notification object. */ - notification: NotificationType; + notification: ISystemNotification | IFriendNotification; /** * A function to close the notifications modal. */