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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
import { NotificationProps } from "@mantine/notifications";
export const notification = {
info: (title: string, message: string): NotificationProps => {
return {
title,
message,
autoClose: 5 * 1000,
};
},
warn: (title: string, message: string): NotificationProps => {
return {
title,
message,
color: "yellow",
autoClose: 6 * 1000,
};
},
error: (title: string, message: string): NotificationProps => {
return {
title,
message,
color: "red",
autoClose: 7 * 1000,
};
},
PROGRESS_TIMEOUT: 10 * 1000,
progress: {
pending: (
id: string,
header: string
): NotificationProps & { id: string } => {
return {
id,
title: header,
message: "Starting Tasks...",
color: "gray",
loading: true,
};
},
update: (
id: string,
header: string,
body: string,
current: number,
total: number
): NotificationProps & { id: string } => {
return {
id,
title: header,
message: `[${current}/${total}] ${body}`,
loading: true,
autoClose: 2 * 60 * 1000,
};
},
end: (id: string, header: string): NotificationProps & { id: string } => {
return {
id,
title: header,
message: "All Tasks Completed",
color: "green",
autoClose: 2 * 1000,
};
},
},
};
|