@homefile/components-v2 2.2.4 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/images/index.d.ts +2 -1
- package/dist/assets/images/index.js +2 -1
- package/dist/assets/images/index.ts +2 -0
- package/dist/assets/images/speaker.svg +17 -0
- package/dist/assets/locales/en/index.json +35 -7
- package/dist/components/appBar/ContactList.d.ts +2 -2
- package/dist/components/appBar/NotificationsReminder.d.ts +2 -0
- package/dist/components/appBar/NotificationsReminder.js +24 -0
- package/dist/components/appBar/PeopleConnected.d.ts +2 -2
- package/dist/components/appBar/Trash.d.ts +2 -2
- package/dist/components/appBar/index.d.ts +1 -0
- package/dist/components/appBar/index.js +1 -0
- package/dist/components/badge/NumberBadge.d.ts +1 -1
- package/dist/components/badge/NumberBadge.js +14 -2
- package/dist/components/forms/dynamicForm/DynamicForm.d.ts +1 -1
- package/dist/components/forms/dynamicForm/DynamicForm.js +2 -2
- package/dist/components/forms/dynamicForm/fields/FileField.d.ts +1 -1
- package/dist/components/forms/dynamicForm/fields/FileField.js +9 -5
- package/dist/components/forms/readOnly/ReadOnlyDynamicForm.d.ts +2 -2
- package/dist/components/forms/readOnly/ReadOnlyDynamicForm.js +5 -2
- package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyAppliances.d.ts +2 -0
- package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyAppliances.js +23 -0
- package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyAppliances.tsx +74 -0
- package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemImages.d.ts +2 -0
- package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemImages.js +10 -0
- package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemImages.tsx +28 -0
- package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemRating.d.ts +2 -0
- package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemRating.js +14 -0
- package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemRating.tsx +22 -0
- package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemText.d.ts +2 -0
- package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemText.js +10 -0
- package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemText.tsx +22 -0
- package/dist/components/forms/readOnly/fields/homeItem/index.d.ts +4 -0
- package/dist/components/forms/readOnly/fields/homeItem/index.js +4 -0
- package/dist/components/forms/readOnly/fields/homeItem/index.ts +4 -0
- package/dist/components/forms/readOnly/fields/index.d.ts +1 -0
- package/dist/components/forms/readOnly/fields/index.js +1 -0
- package/dist/components/headers/TabsHeader.d.ts +1 -1
- package/dist/components/headers/TabsHeader.js +9 -6
- package/dist/components/homeAssistant/HomeAssistant.d.ts +1 -1
- package/dist/components/homeAssistant/HomeAssistant.js +3 -2
- package/dist/components/homeAssistant/HomeAssistantWrapper.d.ts +2 -1
- package/dist/components/homeAssistant/HomeAssistantWrapper.js +4 -4
- package/dist/components/homeAssistant/HomeMonitor.d.ts +3 -1
- package/dist/components/homeAssistant/HomeMonitor.js +2 -2
- package/dist/components/homeAssistant/monitorAlerts/Notifications.js +2 -2
- package/dist/components/homeBoard/HomeBoard.d.ts +2 -1
- package/dist/components/homeBoard/HomeBoard.js +8 -7
- package/dist/components/homeItems/ViewingHomeItemPanel.d.ts +2 -0
- package/dist/components/homeItems/ViewingHomeItemPanel.js +24 -0
- package/dist/components/homeItems/index.d.ts +1 -0
- package/dist/components/homeItems/index.js +1 -0
- package/dist/components/inboxTile/InboxCard.d.ts +2 -0
- package/dist/components/inboxTile/InboxCard.js +10 -0
- package/dist/components/inboxTile/InboxForwardBanner.d.ts +1 -0
- package/dist/components/inboxTile/InboxForwardBanner.js +7 -0
- package/dist/components/inboxTile/InboxTile.d.ts +2 -0
- package/dist/components/inboxTile/InboxTile.js +9 -0
- package/dist/components/{partner/adminTiles/inboxTile → inboxTile}/index.d.ts +1 -0
- package/dist/components/{partner/adminTiles/inboxTile → inboxTile}/index.js +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/notifications/NotificationCard.d.ts +2 -0
- package/dist/components/notifications/NotificationCard.js +64 -0
- package/dist/components/notifications/NotificationsPanel.d.ts +2 -0
- package/dist/components/notifications/NotificationsPanel.js +14 -0
- package/dist/components/notifications/index.d.ts +2 -0
- package/dist/components/notifications/index.js +2 -0
- package/dist/components/partner/adminTiles/index.d.ts +0 -1
- package/dist/components/partner/adminTiles/index.js +0 -1
- package/dist/components/tour/Bubble.js +1 -1
- package/dist/components/tour/HomeBoardTour.js +16 -16
- package/dist/components/valueMonitor/ValueCard.js +1 -1
- package/dist/hooks/display/useMediaPreview.js +4 -7
- package/dist/hooks/folderPanel/useFilesUploader.d.ts +3 -1
- package/dist/hooks/folderPanel/useFilesUploader.js +12 -2
- package/dist/hooks/homeBoard/useHomeBoard.d.ts +1 -0
- package/dist/hooks/homeBoard/useHomeBoard.js +5 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/notifications/index.d.ts +1 -0
- package/dist/hooks/notifications/index.js +1 -0
- package/dist/hooks/notifications/useNotificationsPanel.d.ts +7 -0
- package/dist/hooks/notifications/useNotificationsPanel.js +32 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/interfaces/appBar/AppBar.interface.d.ts +6 -2
- package/dist/interfaces/appBar/index.d.ts +0 -1
- package/dist/interfaces/appBar/index.js +0 -1
- package/dist/interfaces/badge/NumberBadge.interface.d.ts +2 -3
- package/dist/interfaces/forms/dynamicForm/DynamicForm.interface.d.ts +7 -1
- package/dist/interfaces/forms/dynamicForm/fields/FileField.interface.d.ts +2 -0
- package/dist/interfaces/forms/readOnly/homeItem/ReadOnlyAppliances.interface.d.ts +4 -0
- package/dist/interfaces/forms/readOnly/homeItem/index.d.ts +1 -0
- package/dist/interfaces/forms/readOnly/homeItem/index.js +1 -0
- package/dist/interfaces/forms/readOnly/index.d.ts +1 -0
- package/dist/interfaces/forms/readOnly/index.js +1 -0
- package/dist/interfaces/headers/TabsHeader.interface.d.ts +1 -0
- package/dist/interfaces/homeAssistant/HomeAssistantSteps.interface.d.ts +1 -0
- package/dist/interfaces/homeItems/ViewingHomeItemPanel.interface.d.ts +6 -0
- package/dist/interfaces/homeItems/index.d.ts +1 -0
- package/dist/interfaces/homeItems/index.js +1 -0
- package/dist/interfaces/inboxTile/InboxCard.interface.d.ts +10 -0
- package/dist/interfaces/inboxTile/InboxTile.interface.d.ts +8 -0
- package/dist/interfaces/inboxTile/InboxTile.interface.js +1 -0
- package/dist/interfaces/index.d.ts +3 -0
- package/dist/interfaces/index.js +3 -0
- package/dist/interfaces/notifications/NotificationsPanel.interface.d.ts +16 -0
- package/dist/interfaces/notifications/NotificationsPanel.interface.js +1 -0
- package/dist/interfaces/notifications/index.d.ts +1 -0
- package/dist/interfaces/notifications/index.js +1 -0
- package/dist/interfaces/partner/adminTiles/index.d.ts +0 -1
- package/dist/interfaces/partner/adminTiles/index.js +0 -1
- package/dist/interfaces/tour/Step.interface.d.ts +2 -0
- package/dist/interfaces/valueMonitor/ValueCard.interface.d.ts +1 -1
- package/dist/mocks/forms/dynamicForm.mock.d.ts +1 -0
- package/dist/mocks/forms/dynamicForm.mock.js +72 -12
- package/dist/mocks/index.d.ts +1 -0
- package/dist/mocks/index.js +1 -0
- package/dist/mocks/notifications/index.d.ts +1 -0
- package/dist/mocks/notifications/index.js +1 -0
- package/dist/mocks/notifications/notifications.mock.d.ts +2 -0
- package/dist/mocks/notifications/notifications.mock.js +35 -0
- package/dist/stories/appBar/ContactList.stories.d.ts +3 -3
- package/dist/stories/appBar/PeopleConnected.stories.d.ts +3 -3
- package/dist/stories/appBar/Trash.stories.d.ts +3 -3
- package/dist/stories/assets/Illustrations.stories.js +2 -2
- package/dist/stories/forms/dynamicForm/DynamicForm.stories.js +13 -0
- package/dist/stories/homeItems/ViewingHomeItem.stories.d.ts +5 -0
- package/dist/stories/homeItems/ViewingHomeItem.stories.js +16 -0
- package/dist/stories/{partner/adminTiles/InboxTile.stories.d.ts → inboxTile/inboxTile.stories.d.ts} +1 -1
- package/dist/stories/inboxTile/inboxTile.stories.js +29 -0
- package/dist/stories/notifications/NotificationsPanel.stories.d.ts +5 -0
- package/dist/stories/notifications/NotificationsPanel.stories.js +17 -0
- package/dist/stories/valueMonitor/ValueMonitor.stories.d.ts +0 -1
- package/dist/stories/valueMonitor/ValueMonitor.stories.js +1 -1
- package/dist/theme/colors.d.ts +1 -0
- package/dist/theme/colors.js +1 -0
- package/package.json +1 -1
- package/src/assets/images/index.ts +2 -0
- package/src/assets/images/speaker.svg +17 -0
- package/src/assets/locales/en/index.json +35 -7
- package/src/components/appBar/ContactList.tsx +2 -2
- package/src/components/appBar/NotificationsReminder.tsx +49 -0
- package/src/components/appBar/PeopleConnected.tsx +2 -2
- package/src/components/appBar/Trash.tsx +2 -2
- package/src/components/appBar/index.ts +2 -1
- package/src/components/badge/NumberBadge.tsx +2 -0
- package/src/components/customToast/CustomToast.tsx +1 -1
- package/src/components/forms/dynamicForm/DynamicForm.tsx +4 -0
- package/src/components/forms/dynamicForm/fields/FileField.tsx +52 -6
- package/src/components/forms/readOnly/ReadOnlyDynamicForm.tsx +7 -3
- package/src/components/forms/readOnly/fields/homeItem/ReadOnlyAppliances.tsx +74 -0
- package/src/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemImages.tsx +28 -0
- package/src/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemRating.tsx +22 -0
- package/src/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemText.tsx +22 -0
- package/src/components/forms/readOnly/fields/homeItem/index.ts +4 -0
- package/src/components/forms/readOnly/fields/index.ts +1 -0
- package/src/components/headers/TabsHeader.tsx +36 -23
- package/src/components/homeAssistant/HomeAssistant.tsx +12 -7
- package/src/components/homeAssistant/HomeAssistantWrapper.tsx +5 -3
- package/src/components/homeAssistant/HomeMonitor.tsx +2 -2
- package/src/components/homeAssistant/monitorAlerts/Notifications.tsx +3 -3
- package/src/components/homeBoard/HomeBoard.tsx +30 -3
- package/src/components/homeItems/ViewingHomeItemPanel.tsx +44 -0
- package/src/components/homeItems/index.ts +1 -0
- package/src/components/inboxTile/InboxCard.tsx +38 -0
- package/src/components/inboxTile/InboxForwardBanner.tsx +26 -0
- package/src/components/inboxTile/InboxTile.tsx +36 -0
- package/src/components/{partner/adminTiles/inboxTile → inboxTile}/index.ts +1 -0
- package/src/components/index.ts +3 -0
- package/src/components/notifications/NotificationCard.tsx +162 -0
- package/src/components/notifications/NotificationsPanel.tsx +52 -0
- package/src/components/notifications/index.ts +2 -0
- package/src/components/partner/adminTiles/index.ts +0 -1
- package/src/components/tour/Bubble.tsx +2 -0
- package/src/components/tour/HomeBoardTour.tsx +4 -7
- package/src/components/valueMonitor/ValueCard.tsx +17 -13
- package/src/hooks/display/useMediaPreview.ts +3 -5
- package/src/hooks/folderPanel/useFilesUploader.ts +16 -3
- package/src/hooks/homeBoard/useHomeBoard.ts +6 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/notifications/index.ts +1 -0
- package/src/hooks/notifications/useNotificationsPanel.ts +46 -0
- package/src/index.ts +4 -0
- package/src/interfaces/appBar/AppBar.interface.ts +7 -2
- package/src/interfaces/appBar/index.ts +1 -2
- package/src/interfaces/badge/NumberBadge.interface.ts +3 -3
- package/src/interfaces/forms/dynamicForm/DynamicForm.interface.ts +9 -0
- package/src/interfaces/forms/dynamicForm/fields/FileField.interface.ts +2 -0
- package/src/interfaces/forms/readOnly/homeItem/ReadOnlyAppliances.interface.ts +5 -0
- package/src/interfaces/forms/readOnly/homeItem/index.ts +1 -0
- package/src/interfaces/forms/readOnly/index.ts +1 -0
- package/src/interfaces/headers/TabsHeader.interface.ts +4 -3
- package/src/interfaces/homeAssistant/HomeAssistantSteps.interface.ts +1 -0
- package/src/interfaces/homeItems/ViewingHomeItemPanel.interface.ts +7 -0
- package/src/interfaces/homeItems/index.ts +1 -0
- package/src/interfaces/inboxTile/InboxCard.interface.ts +11 -0
- package/src/interfaces/inboxTile/InboxTile.interface.ts +9 -0
- package/src/interfaces/index.ts +3 -0
- package/src/interfaces/notifications/NotificationsPanel.interface.ts +24 -0
- package/src/interfaces/notifications/index.ts +1 -0
- package/src/interfaces/partner/adminTiles/index.ts +0 -1
- package/src/interfaces/tour/Step.interface.ts +2 -0
- package/src/interfaces/valueMonitor/ValueCard.interface.ts +1 -1
- package/src/mocks/forms/dynamicForm.mock.ts +74 -12
- package/src/mocks/index.ts +1 -0
- package/src/mocks/notifications/index.ts +1 -0
- package/src/mocks/notifications/notifications.mock.ts +37 -0
- package/src/stories/appBar/AppBar.stories.tsx +0 -1
- package/src/stories/appBar/ContactList.stories.tsx +4 -5
- package/src/stories/appBar/PeopleConnected.stories.tsx +4 -5
- package/src/stories/appBar/Trash.stories.tsx +4 -6
- package/src/stories/assets/Illustrations.stories.tsx +2 -0
- package/src/stories/forms/dynamicForm/DynamicForm.stories.tsx +13 -0
- package/src/stories/homeItems/ViewingHomeItem.stories.tsx +25 -0
- package/src/stories/inboxTile/inboxTile.stories.tsx +36 -0
- package/src/stories/notifications/NotificationsPanel.stories.tsx +26 -0
- package/src/stories/valueMonitor/ValueMonitor.stories.tsx +1 -1
- package/src/theme/colors.ts +1 -0
- package/dist/components/partner/adminTiles/inboxTile/InboxCard.d.ts +0 -2
- package/dist/components/partner/adminTiles/inboxTile/InboxCard.js +0 -8
- package/dist/components/partner/adminTiles/inboxTile/InboxTile.d.ts +0 -2
- package/dist/components/partner/adminTiles/inboxTile/InboxTile.js +0 -8
- package/dist/interfaces/appBar/PeopleConnected.interface.d.ts +0 -4
- package/dist/interfaces/partner/adminTiles/inboxTile/InboxCard.interface.d.ts +0 -6
- package/dist/interfaces/partner/adminTiles/inboxTile/InboxTile.interface.d.ts +0 -5
- package/dist/stories/partner/adminTiles/InboxTile.stories.js +0 -35
- package/src/components/partner/adminTiles/inboxTile/InboxCard.tsx +0 -35
- package/src/components/partner/adminTiles/inboxTile/InboxTile.tsx +0 -21
- package/src/interfaces/appBar/PeopleConnected.interface.ts +0 -4
- package/src/interfaces/partner/adminTiles/inboxTile/InboxCard.interface.ts +0 -6
- package/src/interfaces/partner/adminTiles/inboxTile/InboxTile.interface.ts +0 -6
- package/src/stories/partner/adminTiles/InboxTile.stories.tsx +0 -42
- /package/dist/interfaces/{appBar/PeopleConnected.interface.js → forms/readOnly/homeItem/ReadOnlyAppliances.interface.js} +0 -0
- /package/dist/interfaces/{partner/adminTiles/inboxTile/InboxCard.interface.js → homeItems/ViewingHomeItemPanel.interface.js} +0 -0
- /package/dist/interfaces/{partner/adminTiles/inboxTile/InboxTile.interface.js → inboxTile/InboxCard.interface.js} +0 -0
- /package/dist/interfaces/{partner/adminTiles/inboxTile → inboxTile}/index.d.ts +0 -0
- /package/dist/interfaces/{partner/adminTiles/inboxTile → inboxTile}/index.js +0 -0
- /package/src/interfaces/{partner/adminTiles/inboxTile → inboxTile}/index.ts +0 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { t } from 'i18next'
|
|
2
|
+
import { Container, Flex, IconButton, Stack, Text } from '@chakra-ui/react'
|
|
3
|
+
import { NotificationCardI, NotificationsPanelI } from '@/interfaces'
|
|
4
|
+
import { Close } from '@/components'
|
|
5
|
+
import { formatDateWithAt } from '@/utils'
|
|
6
|
+
|
|
7
|
+
export const NotificationCard = ({
|
|
8
|
+
_id,
|
|
9
|
+
createdAt,
|
|
10
|
+
message,
|
|
11
|
+
onDismiss,
|
|
12
|
+
status,
|
|
13
|
+
type,
|
|
14
|
+
}: NotificationCardI & Pick<NotificationsPanelI, 'onDismiss'>) => {
|
|
15
|
+
const actionLabels: Record<
|
|
16
|
+
NotificationCardI['type'],
|
|
17
|
+
Record<NotificationCardI['status'], string>
|
|
18
|
+
> = {
|
|
19
|
+
contact: {
|
|
20
|
+
added: `${t('notifications.types.contact')} ${t(
|
|
21
|
+
'notifications.status.added'
|
|
22
|
+
)}`,
|
|
23
|
+
removed: `${t('notifications.types.contact')} ${t(
|
|
24
|
+
'notifications.status.removed'
|
|
25
|
+
)}`,
|
|
26
|
+
shared: `${t('notifications.status.shared')} ${t(
|
|
27
|
+
'notifications.types.contact'
|
|
28
|
+
)}`,
|
|
29
|
+
updated: `${t('notifications.types.contact')} ${t(
|
|
30
|
+
'notifications.status.updated'
|
|
31
|
+
)}`,
|
|
32
|
+
},
|
|
33
|
+
file: {
|
|
34
|
+
added: `${t('notifications.types.file')} ${t(
|
|
35
|
+
'notifications.status.added'
|
|
36
|
+
)}`,
|
|
37
|
+
removed: `${t('notifications.types.file')} ${t(
|
|
38
|
+
'notifications.status.removed'
|
|
39
|
+
)}`,
|
|
40
|
+
shared: `${t('notifications.status.shared')} ${t(
|
|
41
|
+
'notifications.types.file'
|
|
42
|
+
)}`,
|
|
43
|
+
updated: `${t('notifications.types.file')} ${t(
|
|
44
|
+
'notifications.status.updated'
|
|
45
|
+
)}`,
|
|
46
|
+
},
|
|
47
|
+
folder: {
|
|
48
|
+
added: `${t('notifications.types.folder')} ${t(
|
|
49
|
+
'notifications.status.added'
|
|
50
|
+
)}`,
|
|
51
|
+
removed: `${t('notifications.types.folder')} ${t(
|
|
52
|
+
'notifications.status.removed'
|
|
53
|
+
)}`,
|
|
54
|
+
shared: `${t('notifications.status.shared')} ${t(
|
|
55
|
+
'notifications.types.folder'
|
|
56
|
+
)}`,
|
|
57
|
+
updated: `${t('notifications.types.folder')} ${t(
|
|
58
|
+
'notifications.status.updated'
|
|
59
|
+
)}`,
|
|
60
|
+
},
|
|
61
|
+
payment: {
|
|
62
|
+
added: `${t('notifications.types.payment')} ${t(
|
|
63
|
+
'notifications.status.added'
|
|
64
|
+
)}`,
|
|
65
|
+
removed: `${t('notifications.types.payment')} ${t(
|
|
66
|
+
'notifications.status.removed'
|
|
67
|
+
)}`,
|
|
68
|
+
shared: `${t('notifications.status.shared')} ${t(
|
|
69
|
+
'notifications.types.payment'
|
|
70
|
+
)}`,
|
|
71
|
+
updated: `${t('notifications.types.payment')} ${t(
|
|
72
|
+
'notifications.status.updated'
|
|
73
|
+
)}`,
|
|
74
|
+
},
|
|
75
|
+
receipt: {
|
|
76
|
+
added: `${t('notifications.types.receipt')} ${t(
|
|
77
|
+
'notifications.status.added'
|
|
78
|
+
)}`,
|
|
79
|
+
removed: `${t('notifications.types.receipt')} ${t(
|
|
80
|
+
'notifications.status.removed'
|
|
81
|
+
)}`,
|
|
82
|
+
shared: `${t('notifications.status.shared')} ${t(
|
|
83
|
+
'notifications.types.receipt'
|
|
84
|
+
)}`,
|
|
85
|
+
updated: `${t('notifications.types.receipt')} ${t(
|
|
86
|
+
'notifications.status.updated'
|
|
87
|
+
)}`,
|
|
88
|
+
},
|
|
89
|
+
tile: {
|
|
90
|
+
added: `${t('notifications.types.tile')} ${t(
|
|
91
|
+
'notifications.status.added'
|
|
92
|
+
)}`,
|
|
93
|
+
removed: `${t('notifications.types.tile')} ${t(
|
|
94
|
+
'notifications.status.removed'
|
|
95
|
+
)}`,
|
|
96
|
+
shared: `${t('notifications.status.shared')} ${t(
|
|
97
|
+
'notifications.types.tile'
|
|
98
|
+
)}`,
|
|
99
|
+
updated: `${t('notifications.types.tile')} ${t(
|
|
100
|
+
'notifications.status.updated'
|
|
101
|
+
)}`,
|
|
102
|
+
},
|
|
103
|
+
user: {
|
|
104
|
+
added: `${t('notifications.types.user')} ${t(
|
|
105
|
+
'notifications.status.added'
|
|
106
|
+
)}`,
|
|
107
|
+
removed: `${t('notifications.types.user')} ${t(
|
|
108
|
+
'notifications.status.removed'
|
|
109
|
+
)}`,
|
|
110
|
+
shared: `${t('notifications.status.shared')} ${t(
|
|
111
|
+
'notifications.types.user'
|
|
112
|
+
)}`,
|
|
113
|
+
updated: `${t('notifications.types.user')} ${t(
|
|
114
|
+
'notifications.status.updated'
|
|
115
|
+
)}`,
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const bgColors: Record<NotificationCardI['status'], string> = {
|
|
120
|
+
added: 'lightGreen.3',
|
|
121
|
+
removed: 'error.1',
|
|
122
|
+
shared: 'yellow.6',
|
|
123
|
+
updated: 'lightBlue.10',
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const colors: Record<NotificationCardI['status'], string> = {
|
|
127
|
+
added: 'green.8',
|
|
128
|
+
removed: 'error.2',
|
|
129
|
+
shared: 'yellow.1',
|
|
130
|
+
updated: 'lightBlue.9',
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<Container p="2" bg={bgColors[status]}>
|
|
135
|
+
<Stack spacing="3">
|
|
136
|
+
<Flex justify="space-between" align="center">
|
|
137
|
+
<Text
|
|
138
|
+
fontSize="10px"
|
|
139
|
+
fontWeight="semibold"
|
|
140
|
+
textTransform="uppercase"
|
|
141
|
+
color={colors[status]}
|
|
142
|
+
>
|
|
143
|
+
{actionLabels[type][status]}
|
|
144
|
+
</Text>
|
|
145
|
+
<Flex gap="1" align="center">
|
|
146
|
+
<Text variant="date">{formatDateWithAt({ date: createdAt })}</Text>
|
|
147
|
+
<IconButton
|
|
148
|
+
variant="ghost"
|
|
149
|
+
aria-label="close"
|
|
150
|
+
maxW="fit-content"
|
|
151
|
+
onClick={() => onDismiss(_id)}
|
|
152
|
+
icon={<Close size={11} />}
|
|
153
|
+
/>
|
|
154
|
+
</Flex>
|
|
155
|
+
</Flex>
|
|
156
|
+
<Text fontSize="sm" fontFamily="secondary">
|
|
157
|
+
{message}
|
|
158
|
+
</Text>
|
|
159
|
+
</Stack>
|
|
160
|
+
</Container>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { t } from 'i18next'
|
|
2
|
+
import {
|
|
3
|
+
DrawerBody,
|
|
4
|
+
DrawerContent,
|
|
5
|
+
DrawerHeader,
|
|
6
|
+
Stack,
|
|
7
|
+
} from '@chakra-ui/react'
|
|
8
|
+
import { PanelHeader, NotificationCard, SelectInput } from '@/components'
|
|
9
|
+
import { Speaker } from '@/assets/images'
|
|
10
|
+
import { NotificationsPanelI } from '@/interfaces'
|
|
11
|
+
import { useNotificationsPanel } from '@/hooks'
|
|
12
|
+
|
|
13
|
+
export const NotificationsPanel = ({
|
|
14
|
+
notifications = [],
|
|
15
|
+
onClose,
|
|
16
|
+
onDismiss,
|
|
17
|
+
}: NotificationsPanelI) => {
|
|
18
|
+
const count = notifications.length
|
|
19
|
+
const { currentSort, items, handleSelectItem, sortedNotifications } =
|
|
20
|
+
useNotificationsPanel({
|
|
21
|
+
notifications,
|
|
22
|
+
})
|
|
23
|
+
return (
|
|
24
|
+
<DrawerContent bg="lightBlue.1">
|
|
25
|
+
<DrawerHeader p="0">
|
|
26
|
+
<PanelHeader
|
|
27
|
+
handleCloseButton={onClose}
|
|
28
|
+
title={`${t('notifications.title')} ${count && `(${count})`}`}
|
|
29
|
+
icon={Speaker}
|
|
30
|
+
/>
|
|
31
|
+
</DrawerHeader>
|
|
32
|
+
<DrawerBody p="base">
|
|
33
|
+
<Stack spacing="base">
|
|
34
|
+
<SelectInput
|
|
35
|
+
handleClick={handleSelectItem}
|
|
36
|
+
initialValue={currentSort}
|
|
37
|
+
items={items}
|
|
38
|
+
/>
|
|
39
|
+
<Stack spacing="1">
|
|
40
|
+
{sortedNotifications.map((notification) => (
|
|
41
|
+
<NotificationCard
|
|
42
|
+
{...notification}
|
|
43
|
+
key={notification._id}
|
|
44
|
+
onDismiss={onDismiss}
|
|
45
|
+
/>
|
|
46
|
+
))}
|
|
47
|
+
</Stack>
|
|
48
|
+
</Stack>
|
|
49
|
+
</DrawerBody>
|
|
50
|
+
</DrawerContent>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
@@ -29,6 +29,8 @@ export const Bubble = ({
|
|
|
29
29
|
position={position}
|
|
30
30
|
top={handlePosition(steps[currentStep].topRef)}
|
|
31
31
|
left={handlePosition(steps[currentStep].leftRef)}
|
|
32
|
+
bottom={handlePosition(steps[currentStep].bottomRef)}
|
|
33
|
+
right={handlePosition(steps[currentStep].rightRef)}
|
|
32
34
|
zIndex="popover"
|
|
33
35
|
boxShadow="lg"
|
|
34
36
|
borderRadius="md"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import { t
|
|
2
|
+
import { t } from 'i18next'
|
|
3
3
|
import { Bubble, BubbleText, MeetStep } from '@/components'
|
|
4
4
|
import { StepI, TourI } from '@/interfaces'
|
|
5
5
|
import {
|
|
@@ -55,7 +55,7 @@ export const HomeBoardTour = ({
|
|
|
55
55
|
const parsedBubbleWidth = Number(bubbleWidth.replace('px', ''))
|
|
56
56
|
const panelBubbleArrowSize = 500 + parsedBubbleWidth + arrowSize
|
|
57
57
|
const halfBubbleWidth = parsedBubbleWidth / 2
|
|
58
|
-
const bubbleArrowWidth = parsedBubbleWidth + arrowSize +
|
|
58
|
+
const bubbleArrowWidth = parsedBubbleWidth + arrowSize + 10
|
|
59
59
|
|
|
60
60
|
const steps: StepI = {
|
|
61
61
|
homeboard: {
|
|
@@ -110,12 +110,9 @@ export const HomeBoardTour = ({
|
|
|
110
110
|
},
|
|
111
111
|
// Reference component id -> FolderSharing/FolderSharing
|
|
112
112
|
addFolders: {
|
|
113
|
-
arrowRight: 'right-
|
|
113
|
+
arrowRight: 'right-bottom',
|
|
114
114
|
leftRef: coordinates.addFolders?.x - bubbleArrowWidth,
|
|
115
|
-
|
|
116
|
-
coordinates.addFolders?.y,
|
|
117
|
-
distanceFromEdgeArrowToBorder
|
|
118
|
-
),
|
|
115
|
+
bottomRef: 3,
|
|
119
116
|
component: (
|
|
120
117
|
<BubbleText
|
|
121
118
|
title={t('tour.steps.addFolders.title')}
|
|
@@ -41,19 +41,23 @@ export const ValueCard = ({
|
|
|
41
41
|
)}
|
|
42
42
|
</Flex>
|
|
43
43
|
</Flex>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
{
|
|
45
|
+
year && (
|
|
46
|
+
<Flex
|
|
47
|
+
gap="base"
|
|
48
|
+
align="center"
|
|
49
|
+
p="base"
|
|
50
|
+
borderTop="1px dashed"
|
|
51
|
+
borderColor="lightBlue.6"
|
|
52
|
+
>
|
|
53
|
+
<Text fontSize="sm" color="gray.4" textTransform="uppercase">
|
|
54
|
+
{`${t('valueMonitor.label')} ${year}`}
|
|
55
|
+
</Text>
|
|
56
|
+
<Progress flex="1" size="md" value={percentage || 0} height="13px" />
|
|
57
|
+
<Text fontSize="sm">{formattedYearValue}.</Text>
|
|
58
|
+
</Flex>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
57
61
|
</Box>
|
|
58
62
|
)
|
|
59
63
|
}
|
|
@@ -7,7 +7,6 @@ interface MediaPreviewHookI {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export const useMediaPreview = ({ images }: MediaPreviewHookI) => {
|
|
10
|
-
const [dbImages, setDbImages] = useState<ImagesI[]>([])
|
|
11
10
|
const [totalFiles, setTotalFiles] = useState<ImagesI[]>([])
|
|
12
11
|
const [index, setIndex] = useState(0)
|
|
13
12
|
const storageUrl = import.meta.env.VITE_STORAGE_URL
|
|
@@ -50,10 +49,9 @@ export const useMediaPreview = ({ images }: MediaPreviewHookI) => {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, [images.length])
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
setTotalFiles([...images])
|
|
54
|
+
}, [JSON.stringify(images.map((image) => image._id))])
|
|
57
55
|
|
|
58
56
|
return {
|
|
59
57
|
handleDescription,
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { FolderFileI } from '@/interfaces'
|
|
1
|
+
import { FolderFileI, ValueTypes } from '@/interfaces'
|
|
2
2
|
import { handleMapFile } from '@/utils'
|
|
3
|
-
import { t } from 'i18next'
|
|
3
|
+
import { t, use } from 'i18next'
|
|
4
4
|
import { useEffect, useState } from 'react'
|
|
5
5
|
import { useDropzone } from 'react-dropzone'
|
|
6
6
|
|
|
7
7
|
interface FilesUploaderHookI {
|
|
8
8
|
onUpload: (files: FolderFileI[]) => void
|
|
9
9
|
uploading: boolean
|
|
10
|
+
displayImages?: string[]
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export const useFilesUploader = ({
|
|
13
14
|
onUpload,
|
|
14
15
|
uploading,
|
|
16
|
+
displayImages = [],
|
|
15
17
|
}: FilesUploaderHookI) => {
|
|
16
18
|
const [isUploading, setIsUploading] = useState(false)
|
|
19
|
+
const [thumbnails, setThumbnails] = useState(displayImages)
|
|
17
20
|
|
|
18
21
|
const [acceptedFiles, setAcceptedFiles] = useState<FolderFileI[]>([])
|
|
19
22
|
|
|
@@ -60,5 +63,15 @@ export const useFilesUploader = ({
|
|
|
60
63
|
!uploading && setAcceptedFiles([])
|
|
61
64
|
}, [uploading])
|
|
62
65
|
|
|
63
|
-
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
setThumbnails(displayImages)
|
|
68
|
+
}, [JSON.stringify(displayImages)])
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
acceptedFiles,
|
|
72
|
+
errorMessage,
|
|
73
|
+
getRootProps,
|
|
74
|
+
getInputProps,
|
|
75
|
+
thumbnails,
|
|
76
|
+
}
|
|
64
77
|
}
|
|
@@ -51,6 +51,11 @@ export const useHomeBoard = () => {
|
|
|
51
51
|
onRightOpen()
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
const handleAppBarClick = (current: string) => {
|
|
55
|
+
setCurrentComponent(current)
|
|
56
|
+
onRightOpen()
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
const componentsByStep: Record<string, string> = {
|
|
55
60
|
nameFolder: 'AddFolder',
|
|
56
61
|
addFiles: 'FolderDetail',
|
|
@@ -128,6 +133,7 @@ export const useHomeBoard = () => {
|
|
|
128
133
|
activeTour,
|
|
129
134
|
currentComponent,
|
|
130
135
|
form,
|
|
136
|
+
handleAppBarClick,
|
|
131
137
|
handleClose,
|
|
132
138
|
handleEditHomeClick,
|
|
133
139
|
handleFolderClick,
|
package/src/hooks/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useNotificationsPanel'
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import { t } from 'i18next'
|
|
3
|
+
import { NotificationsPanelI, SelectItemI } from '@/interfaces'
|
|
4
|
+
|
|
5
|
+
export const useNotificationsPanel = ({
|
|
6
|
+
notifications,
|
|
7
|
+
}: Pick<NotificationsPanelI, 'notifications'>) => {
|
|
8
|
+
const [sortedNotifications, setSortedNotifications] = useState(notifications)
|
|
9
|
+
const [currentSort, setCurrentSort] = useState<string>(t('forms.sortBy'))
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setSortedNotifications(notifications)
|
|
13
|
+
}, [JSON.stringify(notifications)])
|
|
14
|
+
|
|
15
|
+
const handleSelectItem = (item: string | SelectItemI<string>) => {
|
|
16
|
+
if (typeof item !== 'string') return
|
|
17
|
+
setCurrentSort(item)
|
|
18
|
+
|
|
19
|
+
if (item === t('forms.sortBy')) {
|
|
20
|
+
return setSortedNotifications(notifications)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
setSortedNotifications(
|
|
24
|
+
notifications.filter(
|
|
25
|
+
(notification) =>
|
|
26
|
+
notification.type === item.toLowerCase() ||
|
|
27
|
+
notification.status === item.toLowerCase()
|
|
28
|
+
)
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const items = [
|
|
33
|
+
t('forms.sortBy'),
|
|
34
|
+
t('notifications.types.contact'),
|
|
35
|
+
t('notifications.types.file'),
|
|
36
|
+
t('notifications.types.folder'),
|
|
37
|
+
t('notifications.types.payment'),
|
|
38
|
+
t('notifications.types.receipt'),
|
|
39
|
+
t('notifications.status.added'),
|
|
40
|
+
t('notifications.status.removed'),
|
|
41
|
+
t('notifications.status.shared'),
|
|
42
|
+
t('notifications.status.updated'),
|
|
43
|
+
] as string[]
|
|
44
|
+
|
|
45
|
+
return { currentSort, items, handleSelectItem, sortedNotifications }
|
|
46
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -76,6 +76,7 @@ export {
|
|
|
76
76
|
HomeMonitor,
|
|
77
77
|
HomeMonitorSteps,
|
|
78
78
|
HomeSharedWith,
|
|
79
|
+
InboxForwardBanner,
|
|
79
80
|
InboxTile,
|
|
80
81
|
ItemNameHeader,
|
|
81
82
|
ItemsReviewBanner,
|
|
@@ -99,6 +100,9 @@ export {
|
|
|
99
100
|
NewPassword,
|
|
100
101
|
NotBeChargedBanner,
|
|
101
102
|
Notifications,
|
|
103
|
+
NotificationsReminder,
|
|
104
|
+
NotificationsPanel,
|
|
105
|
+
NotificationCard,
|
|
102
106
|
Overlay,
|
|
103
107
|
PanelHeader,
|
|
104
108
|
PartnerActiveSubscription,
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { UserProfileI } from
|
|
2
|
-
import { ReactNode } from
|
|
1
|
+
import { UserProfileI } from '@/interfaces'
|
|
2
|
+
import { ReactNode } from 'react'
|
|
3
3
|
|
|
4
4
|
export interface AppBarI {
|
|
5
5
|
children: ReactNode
|
|
6
6
|
onLogoClick: () => void
|
|
7
7
|
user: UserProfileI
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
export interface AppBarIconI {
|
|
11
|
+
onClick: () => void
|
|
12
|
+
total: number
|
|
13
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './AppBar.interface'
|
|
2
2
|
export * from './HomefileLogo.interface'
|
|
3
|
-
export * from './PeopleConnected.interface'
|
|
4
3
|
export * from './StorageUsed.interface'
|
|
5
4
|
export * from './TourButton.interface'
|
|
6
5
|
export * from './TutorialsButton.interface'
|
|
7
|
-
export * from './UserProfile.interface'
|
|
6
|
+
export * from './UserProfile.interface'
|
|
@@ -21,6 +21,7 @@ type KindTypes =
|
|
|
21
21
|
| 'textarea'
|
|
22
22
|
| 'default'
|
|
23
23
|
| UIKindTypes
|
|
24
|
+
| HomeItemTypes
|
|
24
25
|
|
|
25
26
|
type UIKindTypes =
|
|
26
27
|
| 'tile-body'
|
|
@@ -34,6 +35,8 @@ type UIKindTypes =
|
|
|
34
35
|
| 'primary-cta'
|
|
35
36
|
| 'secondary-cta'
|
|
36
37
|
|
|
38
|
+
type HomeItemTypes = 'appliances' | 'images'
|
|
39
|
+
|
|
37
40
|
export type IconTypes =
|
|
38
41
|
| 'barcode'
|
|
39
42
|
| 'battery'
|
|
@@ -111,8 +114,10 @@ export interface ReportI {
|
|
|
111
114
|
|
|
112
115
|
export interface DynamicFormI extends Partial<PartnerFooterI> {
|
|
113
116
|
callback?: TileCtaI['callback']
|
|
117
|
+
displayImages?: string[]
|
|
114
118
|
form: ReportI[]
|
|
115
119
|
menuItems?: MenuItemI[]
|
|
120
|
+
onRemoveImage?: (file: string) => void
|
|
116
121
|
onUpload?: (filesByFieldId: Record<string, FolderFileI[]>) => void
|
|
117
122
|
showTitle?: boolean
|
|
118
123
|
title?: string
|
|
@@ -123,3 +128,7 @@ export interface DynamicFormProxyI {
|
|
|
123
128
|
fields: ReportI[]
|
|
124
129
|
setFields(fields: ReportI[]): void
|
|
125
130
|
}
|
|
131
|
+
|
|
132
|
+
export interface ReadOnlyDynamicFormI extends Pick<DynamicFormI, 'form'> {
|
|
133
|
+
onEdit?: (id: string) => void
|
|
134
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ReadOnlyAppliances.interface'
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ReactNode } from 'react'
|
|
2
2
|
|
|
3
3
|
interface Tab {
|
|
4
|
-
label: string
|
|
5
|
-
component: ReactNode | null
|
|
4
|
+
label: string
|
|
5
|
+
component: ReactNode | null
|
|
6
6
|
}
|
|
7
7
|
export interface TabsHeaderI {
|
|
8
8
|
defaultIndex?: number
|
|
9
|
-
onChange?: (index: number) => void
|
|
9
|
+
onChange?: (index: number) => void
|
|
10
10
|
rightButton?: ReactNode
|
|
11
|
+
rightTabList?: Tab[]
|
|
11
12
|
tabIndex?: number
|
|
12
13
|
tabList: Tab[]
|
|
13
14
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ViewingHomeItemPanel.interface'
|
package/src/interfaces/index.ts
CHANGED
|
@@ -15,12 +15,15 @@ export * from './headers'
|
|
|
15
15
|
export * from './help'
|
|
16
16
|
export * from './homeAssistant'
|
|
17
17
|
export * from './homeBoard'
|
|
18
|
+
export * from './homeItems'
|
|
18
19
|
export * from './homeSummary'
|
|
19
20
|
export * from './icons'
|
|
21
|
+
export * from './inboxTile'
|
|
20
22
|
export * from './inputs'
|
|
21
23
|
export * from './launchpad'
|
|
22
24
|
export * from './myHomes'
|
|
23
25
|
export * from './myProfile'
|
|
26
|
+
export * from './notifications'
|
|
24
27
|
export * from './onboarding'
|
|
25
28
|
export * from './overlay'
|
|
26
29
|
export * from './pages'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type NotificationType =
|
|
2
|
+
| 'file'
|
|
3
|
+
| 'folder'
|
|
4
|
+
| 'contact'
|
|
5
|
+
| 'receipt'
|
|
6
|
+
| 'user'
|
|
7
|
+
| 'tile'
|
|
8
|
+
| 'payment'
|
|
9
|
+
type NotificationStatus = 'added' | 'removed' | 'updated' | 'shared'
|
|
10
|
+
|
|
11
|
+
export interface NotificationCardI {
|
|
12
|
+
active: boolean
|
|
13
|
+
createdAt: Date
|
|
14
|
+
_id: string
|
|
15
|
+
message: string
|
|
16
|
+
status: NotificationStatus
|
|
17
|
+
type: NotificationType
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface NotificationsPanelI {
|
|
21
|
+
notifications: NotificationCardI[]
|
|
22
|
+
onClose: () => void
|
|
23
|
+
onDismiss: (id: string) => void
|
|
24
|
+
}
|