-
Notifications
You must be signed in to change notification settings - Fork 120
/
notification.tsx
50 lines (45 loc) · 1.4 KB
/
notification.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { UniqueId } from 'mo/common/types';
import { IActionBarItemProps } from 'mo/components/actionBar';
import React from 'react';
import type { IStatusBarItem } from './workbench/statusBar';
export enum NotificationStatus {
Read = 1,
WaitRead = 2,
}
export interface INotificationItem<T = any> {
id: UniqueId;
value: T;
render?(item: INotificationItem): React.ReactNode;
status?: NotificationStatus;
}
export interface INotification<T = any>
extends IStatusBarItem<INotificationItem<T>[]> {
showNotifications?: boolean;
actionBar?: IActionBarItemProps[];
}
export class NotificationModel<T> implements INotification<T> {
public id: UniqueId;
public name: string;
public data: INotificationItem<T>[];
public sortIndex: number;
public render: () => React.ReactNode;
public showNotifications: boolean;
public actionBar: IActionBarItemProps[];
constructor(
id: UniqueId = '',
name: string = '',
data: INotificationItem<T>[] = [],
sortIndex: number = 1,
showNotifications: boolean = false,
actionBar: IActionBarItemProps[] = [],
render: () => React.ReactNode
) {
this.id = id;
this.name = name;
this.sortIndex = sortIndex;
this.render = render;
this.showNotifications = showNotifications;
this.data = data;
this.actionBar = actionBar;
}
}