@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.
Files changed (240) hide show
  1. package/dist/assets/images/index.d.ts +2 -1
  2. package/dist/assets/images/index.js +2 -1
  3. package/dist/assets/images/index.ts +2 -0
  4. package/dist/assets/images/speaker.svg +17 -0
  5. package/dist/assets/locales/en/index.json +35 -7
  6. package/dist/components/appBar/ContactList.d.ts +2 -2
  7. package/dist/components/appBar/NotificationsReminder.d.ts +2 -0
  8. package/dist/components/appBar/NotificationsReminder.js +24 -0
  9. package/dist/components/appBar/PeopleConnected.d.ts +2 -2
  10. package/dist/components/appBar/Trash.d.ts +2 -2
  11. package/dist/components/appBar/index.d.ts +1 -0
  12. package/dist/components/appBar/index.js +1 -0
  13. package/dist/components/badge/NumberBadge.d.ts +1 -1
  14. package/dist/components/badge/NumberBadge.js +14 -2
  15. package/dist/components/forms/dynamicForm/DynamicForm.d.ts +1 -1
  16. package/dist/components/forms/dynamicForm/DynamicForm.js +2 -2
  17. package/dist/components/forms/dynamicForm/fields/FileField.d.ts +1 -1
  18. package/dist/components/forms/dynamicForm/fields/FileField.js +9 -5
  19. package/dist/components/forms/readOnly/ReadOnlyDynamicForm.d.ts +2 -2
  20. package/dist/components/forms/readOnly/ReadOnlyDynamicForm.js +5 -2
  21. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyAppliances.d.ts +2 -0
  22. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyAppliances.js +23 -0
  23. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyAppliances.tsx +74 -0
  24. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemImages.d.ts +2 -0
  25. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemImages.js +10 -0
  26. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemImages.tsx +28 -0
  27. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemRating.d.ts +2 -0
  28. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemRating.js +14 -0
  29. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemRating.tsx +22 -0
  30. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemText.d.ts +2 -0
  31. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemText.js +10 -0
  32. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemText.tsx +22 -0
  33. package/dist/components/forms/readOnly/fields/homeItem/index.d.ts +4 -0
  34. package/dist/components/forms/readOnly/fields/homeItem/index.js +4 -0
  35. package/dist/components/forms/readOnly/fields/homeItem/index.ts +4 -0
  36. package/dist/components/forms/readOnly/fields/index.d.ts +1 -0
  37. package/dist/components/forms/readOnly/fields/index.js +1 -0
  38. package/dist/components/headers/TabsHeader.d.ts +1 -1
  39. package/dist/components/headers/TabsHeader.js +9 -6
  40. package/dist/components/homeAssistant/HomeAssistant.d.ts +1 -1
  41. package/dist/components/homeAssistant/HomeAssistant.js +3 -2
  42. package/dist/components/homeAssistant/HomeAssistantWrapper.d.ts +2 -1
  43. package/dist/components/homeAssistant/HomeAssistantWrapper.js +4 -4
  44. package/dist/components/homeAssistant/HomeMonitor.d.ts +3 -1
  45. package/dist/components/homeAssistant/HomeMonitor.js +2 -2
  46. package/dist/components/homeAssistant/monitorAlerts/Notifications.js +2 -2
  47. package/dist/components/homeBoard/HomeBoard.d.ts +2 -1
  48. package/dist/components/homeBoard/HomeBoard.js +8 -7
  49. package/dist/components/homeItems/ViewingHomeItemPanel.d.ts +2 -0
  50. package/dist/components/homeItems/ViewingHomeItemPanel.js +24 -0
  51. package/dist/components/homeItems/index.d.ts +1 -0
  52. package/dist/components/homeItems/index.js +1 -0
  53. package/dist/components/inboxTile/InboxCard.d.ts +2 -0
  54. package/dist/components/inboxTile/InboxCard.js +10 -0
  55. package/dist/components/inboxTile/InboxForwardBanner.d.ts +1 -0
  56. package/dist/components/inboxTile/InboxForwardBanner.js +7 -0
  57. package/dist/components/inboxTile/InboxTile.d.ts +2 -0
  58. package/dist/components/inboxTile/InboxTile.js +9 -0
  59. package/dist/components/{partner/adminTiles/inboxTile → inboxTile}/index.d.ts +1 -0
  60. package/dist/components/{partner/adminTiles/inboxTile → inboxTile}/index.js +1 -0
  61. package/dist/components/index.d.ts +3 -0
  62. package/dist/components/index.js +3 -0
  63. package/dist/components/notifications/NotificationCard.d.ts +2 -0
  64. package/dist/components/notifications/NotificationCard.js +64 -0
  65. package/dist/components/notifications/NotificationsPanel.d.ts +2 -0
  66. package/dist/components/notifications/NotificationsPanel.js +14 -0
  67. package/dist/components/notifications/index.d.ts +2 -0
  68. package/dist/components/notifications/index.js +2 -0
  69. package/dist/components/partner/adminTiles/index.d.ts +0 -1
  70. package/dist/components/partner/adminTiles/index.js +0 -1
  71. package/dist/components/tour/Bubble.js +1 -1
  72. package/dist/components/tour/HomeBoardTour.js +16 -16
  73. package/dist/components/valueMonitor/ValueCard.js +1 -1
  74. package/dist/hooks/display/useMediaPreview.js +4 -7
  75. package/dist/hooks/folderPanel/useFilesUploader.d.ts +3 -1
  76. package/dist/hooks/folderPanel/useFilesUploader.js +12 -2
  77. package/dist/hooks/homeBoard/useHomeBoard.d.ts +1 -0
  78. package/dist/hooks/homeBoard/useHomeBoard.js +5 -0
  79. package/dist/hooks/index.d.ts +1 -0
  80. package/dist/hooks/index.js +1 -0
  81. package/dist/hooks/notifications/index.d.ts +1 -0
  82. package/dist/hooks/notifications/index.js +1 -0
  83. package/dist/hooks/notifications/useNotificationsPanel.d.ts +7 -0
  84. package/dist/hooks/notifications/useNotificationsPanel.js +32 -0
  85. package/dist/index.d.ts +1 -1
  86. package/dist/index.js +1 -1
  87. package/dist/interfaces/appBar/AppBar.interface.d.ts +6 -2
  88. package/dist/interfaces/appBar/index.d.ts +0 -1
  89. package/dist/interfaces/appBar/index.js +0 -1
  90. package/dist/interfaces/badge/NumberBadge.interface.d.ts +2 -3
  91. package/dist/interfaces/forms/dynamicForm/DynamicForm.interface.d.ts +7 -1
  92. package/dist/interfaces/forms/dynamicForm/fields/FileField.interface.d.ts +2 -0
  93. package/dist/interfaces/forms/readOnly/homeItem/ReadOnlyAppliances.interface.d.ts +4 -0
  94. package/dist/interfaces/forms/readOnly/homeItem/index.d.ts +1 -0
  95. package/dist/interfaces/forms/readOnly/homeItem/index.js +1 -0
  96. package/dist/interfaces/forms/readOnly/index.d.ts +1 -0
  97. package/dist/interfaces/forms/readOnly/index.js +1 -0
  98. package/dist/interfaces/headers/TabsHeader.interface.d.ts +1 -0
  99. package/dist/interfaces/homeAssistant/HomeAssistantSteps.interface.d.ts +1 -0
  100. package/dist/interfaces/homeItems/ViewingHomeItemPanel.interface.d.ts +6 -0
  101. package/dist/interfaces/homeItems/index.d.ts +1 -0
  102. package/dist/interfaces/homeItems/index.js +1 -0
  103. package/dist/interfaces/inboxTile/InboxCard.interface.d.ts +10 -0
  104. package/dist/interfaces/inboxTile/InboxTile.interface.d.ts +8 -0
  105. package/dist/interfaces/inboxTile/InboxTile.interface.js +1 -0
  106. package/dist/interfaces/index.d.ts +3 -0
  107. package/dist/interfaces/index.js +3 -0
  108. package/dist/interfaces/notifications/NotificationsPanel.interface.d.ts +16 -0
  109. package/dist/interfaces/notifications/NotificationsPanel.interface.js +1 -0
  110. package/dist/interfaces/notifications/index.d.ts +1 -0
  111. package/dist/interfaces/notifications/index.js +1 -0
  112. package/dist/interfaces/partner/adminTiles/index.d.ts +0 -1
  113. package/dist/interfaces/partner/adminTiles/index.js +0 -1
  114. package/dist/interfaces/tour/Step.interface.d.ts +2 -0
  115. package/dist/interfaces/valueMonitor/ValueCard.interface.d.ts +1 -1
  116. package/dist/mocks/forms/dynamicForm.mock.d.ts +1 -0
  117. package/dist/mocks/forms/dynamicForm.mock.js +72 -12
  118. package/dist/mocks/index.d.ts +1 -0
  119. package/dist/mocks/index.js +1 -0
  120. package/dist/mocks/notifications/index.d.ts +1 -0
  121. package/dist/mocks/notifications/index.js +1 -0
  122. package/dist/mocks/notifications/notifications.mock.d.ts +2 -0
  123. package/dist/mocks/notifications/notifications.mock.js +35 -0
  124. package/dist/stories/appBar/ContactList.stories.d.ts +3 -3
  125. package/dist/stories/appBar/PeopleConnected.stories.d.ts +3 -3
  126. package/dist/stories/appBar/Trash.stories.d.ts +3 -3
  127. package/dist/stories/assets/Illustrations.stories.js +2 -2
  128. package/dist/stories/forms/dynamicForm/DynamicForm.stories.js +13 -0
  129. package/dist/stories/homeItems/ViewingHomeItem.stories.d.ts +5 -0
  130. package/dist/stories/homeItems/ViewingHomeItem.stories.js +16 -0
  131. package/dist/stories/{partner/adminTiles/InboxTile.stories.d.ts → inboxTile/inboxTile.stories.d.ts} +1 -1
  132. package/dist/stories/inboxTile/inboxTile.stories.js +29 -0
  133. package/dist/stories/notifications/NotificationsPanel.stories.d.ts +5 -0
  134. package/dist/stories/notifications/NotificationsPanel.stories.js +17 -0
  135. package/dist/stories/valueMonitor/ValueMonitor.stories.d.ts +0 -1
  136. package/dist/stories/valueMonitor/ValueMonitor.stories.js +1 -1
  137. package/dist/theme/colors.d.ts +1 -0
  138. package/dist/theme/colors.js +1 -0
  139. package/package.json +1 -1
  140. package/src/assets/images/index.ts +2 -0
  141. package/src/assets/images/speaker.svg +17 -0
  142. package/src/assets/locales/en/index.json +35 -7
  143. package/src/components/appBar/ContactList.tsx +2 -2
  144. package/src/components/appBar/NotificationsReminder.tsx +49 -0
  145. package/src/components/appBar/PeopleConnected.tsx +2 -2
  146. package/src/components/appBar/Trash.tsx +2 -2
  147. package/src/components/appBar/index.ts +2 -1
  148. package/src/components/badge/NumberBadge.tsx +2 -0
  149. package/src/components/customToast/CustomToast.tsx +1 -1
  150. package/src/components/forms/dynamicForm/DynamicForm.tsx +4 -0
  151. package/src/components/forms/dynamicForm/fields/FileField.tsx +52 -6
  152. package/src/components/forms/readOnly/ReadOnlyDynamicForm.tsx +7 -3
  153. package/src/components/forms/readOnly/fields/homeItem/ReadOnlyAppliances.tsx +74 -0
  154. package/src/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemImages.tsx +28 -0
  155. package/src/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemRating.tsx +22 -0
  156. package/src/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemText.tsx +22 -0
  157. package/src/components/forms/readOnly/fields/homeItem/index.ts +4 -0
  158. package/src/components/forms/readOnly/fields/index.ts +1 -0
  159. package/src/components/headers/TabsHeader.tsx +36 -23
  160. package/src/components/homeAssistant/HomeAssistant.tsx +12 -7
  161. package/src/components/homeAssistant/HomeAssistantWrapper.tsx +5 -3
  162. package/src/components/homeAssistant/HomeMonitor.tsx +2 -2
  163. package/src/components/homeAssistant/monitorAlerts/Notifications.tsx +3 -3
  164. package/src/components/homeBoard/HomeBoard.tsx +30 -3
  165. package/src/components/homeItems/ViewingHomeItemPanel.tsx +44 -0
  166. package/src/components/homeItems/index.ts +1 -0
  167. package/src/components/inboxTile/InboxCard.tsx +38 -0
  168. package/src/components/inboxTile/InboxForwardBanner.tsx +26 -0
  169. package/src/components/inboxTile/InboxTile.tsx +36 -0
  170. package/src/components/{partner/adminTiles/inboxTile → inboxTile}/index.ts +1 -0
  171. package/src/components/index.ts +3 -0
  172. package/src/components/notifications/NotificationCard.tsx +162 -0
  173. package/src/components/notifications/NotificationsPanel.tsx +52 -0
  174. package/src/components/notifications/index.ts +2 -0
  175. package/src/components/partner/adminTiles/index.ts +0 -1
  176. package/src/components/tour/Bubble.tsx +2 -0
  177. package/src/components/tour/HomeBoardTour.tsx +4 -7
  178. package/src/components/valueMonitor/ValueCard.tsx +17 -13
  179. package/src/hooks/display/useMediaPreview.ts +3 -5
  180. package/src/hooks/folderPanel/useFilesUploader.ts +16 -3
  181. package/src/hooks/homeBoard/useHomeBoard.ts +6 -0
  182. package/src/hooks/index.ts +1 -0
  183. package/src/hooks/notifications/index.ts +1 -0
  184. package/src/hooks/notifications/useNotificationsPanel.ts +46 -0
  185. package/src/index.ts +4 -0
  186. package/src/interfaces/appBar/AppBar.interface.ts +7 -2
  187. package/src/interfaces/appBar/index.ts +1 -2
  188. package/src/interfaces/badge/NumberBadge.interface.ts +3 -3
  189. package/src/interfaces/forms/dynamicForm/DynamicForm.interface.ts +9 -0
  190. package/src/interfaces/forms/dynamicForm/fields/FileField.interface.ts +2 -0
  191. package/src/interfaces/forms/readOnly/homeItem/ReadOnlyAppliances.interface.ts +5 -0
  192. package/src/interfaces/forms/readOnly/homeItem/index.ts +1 -0
  193. package/src/interfaces/forms/readOnly/index.ts +1 -0
  194. package/src/interfaces/headers/TabsHeader.interface.ts +4 -3
  195. package/src/interfaces/homeAssistant/HomeAssistantSteps.interface.ts +1 -0
  196. package/src/interfaces/homeItems/ViewingHomeItemPanel.interface.ts +7 -0
  197. package/src/interfaces/homeItems/index.ts +1 -0
  198. package/src/interfaces/inboxTile/InboxCard.interface.ts +11 -0
  199. package/src/interfaces/inboxTile/InboxTile.interface.ts +9 -0
  200. package/src/interfaces/index.ts +3 -0
  201. package/src/interfaces/notifications/NotificationsPanel.interface.ts +24 -0
  202. package/src/interfaces/notifications/index.ts +1 -0
  203. package/src/interfaces/partner/adminTiles/index.ts +0 -1
  204. package/src/interfaces/tour/Step.interface.ts +2 -0
  205. package/src/interfaces/valueMonitor/ValueCard.interface.ts +1 -1
  206. package/src/mocks/forms/dynamicForm.mock.ts +74 -12
  207. package/src/mocks/index.ts +1 -0
  208. package/src/mocks/notifications/index.ts +1 -0
  209. package/src/mocks/notifications/notifications.mock.ts +37 -0
  210. package/src/stories/appBar/AppBar.stories.tsx +0 -1
  211. package/src/stories/appBar/ContactList.stories.tsx +4 -5
  212. package/src/stories/appBar/PeopleConnected.stories.tsx +4 -5
  213. package/src/stories/appBar/Trash.stories.tsx +4 -6
  214. package/src/stories/assets/Illustrations.stories.tsx +2 -0
  215. package/src/stories/forms/dynamicForm/DynamicForm.stories.tsx +13 -0
  216. package/src/stories/homeItems/ViewingHomeItem.stories.tsx +25 -0
  217. package/src/stories/inboxTile/inboxTile.stories.tsx +36 -0
  218. package/src/stories/notifications/NotificationsPanel.stories.tsx +26 -0
  219. package/src/stories/valueMonitor/ValueMonitor.stories.tsx +1 -1
  220. package/src/theme/colors.ts +1 -0
  221. package/dist/components/partner/adminTiles/inboxTile/InboxCard.d.ts +0 -2
  222. package/dist/components/partner/adminTiles/inboxTile/InboxCard.js +0 -8
  223. package/dist/components/partner/adminTiles/inboxTile/InboxTile.d.ts +0 -2
  224. package/dist/components/partner/adminTiles/inboxTile/InboxTile.js +0 -8
  225. package/dist/interfaces/appBar/PeopleConnected.interface.d.ts +0 -4
  226. package/dist/interfaces/partner/adminTiles/inboxTile/InboxCard.interface.d.ts +0 -6
  227. package/dist/interfaces/partner/adminTiles/inboxTile/InboxTile.interface.d.ts +0 -5
  228. package/dist/stories/partner/adminTiles/InboxTile.stories.js +0 -35
  229. package/src/components/partner/adminTiles/inboxTile/InboxCard.tsx +0 -35
  230. package/src/components/partner/adminTiles/inboxTile/InboxTile.tsx +0 -21
  231. package/src/interfaces/appBar/PeopleConnected.interface.ts +0 -4
  232. package/src/interfaces/partner/adminTiles/inboxTile/InboxCard.interface.ts +0 -6
  233. package/src/interfaces/partner/adminTiles/inboxTile/InboxTile.interface.ts +0 -6
  234. package/src/stories/partner/adminTiles/InboxTile.stories.tsx +0 -42
  235. /package/dist/interfaces/{appBar/PeopleConnected.interface.js → forms/readOnly/homeItem/ReadOnlyAppliances.interface.js} +0 -0
  236. /package/dist/interfaces/{partner/adminTiles/inboxTile/InboxCard.interface.js → homeItems/ViewingHomeItemPanel.interface.js} +0 -0
  237. /package/dist/interfaces/{partner/adminTiles/inboxTile/InboxTile.interface.js → inboxTile/InboxCard.interface.js} +0 -0
  238. /package/dist/interfaces/{partner/adminTiles/inboxTile → inboxTile}/index.d.ts +0 -0
  239. /package/dist/interfaces/{partner/adminTiles/inboxTile → inboxTile}/index.js +0 -0
  240. /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
+ }
@@ -0,0 +1,2 @@
1
+ export * from './NotificationCard'
2
+ export * from './NotificationsPanel'
@@ -1,4 +1,3 @@
1
1
  export * from './customersTile'
2
- export * from './inboxTile'
3
2
  export * from './satisfactionTile'
4
3
  export * from './ytdTile'
@@ -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, use } from 'i18next'
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 + 30
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-top',
113
+ arrowRight: 'right-bottom',
114
114
  leftRef: coordinates.addFolders?.x - bubbleArrowWidth,
115
- topRef: getYPosition(
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
- <Flex
45
- gap="base"
46
- align="center"
47
- p="base"
48
- borderTop="1px dashed"
49
- borderColor="lightBlue.6"
50
- >
51
- <Text fontSize="sm" color="gray.4" textTransform="uppercase">
52
- {`${t('valueMonitor.label')} ${year}`}
53
- </Text>
54
- <Progress flex="1" size="md" value={percentage || 0} height="13px" />
55
- <Text fontSize="sm">{formattedYearValue}.</Text>
56
- </Flex>
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
- useMemo(() => {
54
- setDbImages(handleMapMedia({ files: images, isLocal: false }))
55
- setTotalFiles([...dbImages])
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
- return { acceptedFiles, errorMessage, getRootProps, getInputProps }
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,
@@ -13,6 +13,7 @@ export * from './inputs'
13
13
  export * from './launchpad'
14
14
  export * from './myHomes'
15
15
  export * from './myProfile'
16
+ export * from './notifications'
16
17
  export * from './onboarding'
17
18
  export * from './partner'
18
19
  export * from './propertyTiles'
@@ -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 "@/interfaces"
2
- import { ReactNode } from "react"
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'
@@ -1,6 +1,6 @@
1
- export interface NumberBadgeI {
2
- color?: string
3
- bg?: string
1
+ import { CenterProps } from '@chakra-ui/react'
2
+
3
+ export interface NumberBadgeI extends CenterProps {
4
4
  px?: string
5
5
  py?: string
6
6
  total: string | number
@@ -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
+ }
@@ -1,6 +1,8 @@
1
1
  import { FolderFileI, ReportI } from '@/interfaces'
2
2
 
3
3
  export interface FileFieldI extends Pick<ReportI, 'description' | 'icon'> {
4
+ onRemove?: (file: string) => void
4
5
  onUpload: (files: FolderFileI[]) => void
5
6
  uploading?: boolean
7
+ displayImages?: string[]
6
8
  }
@@ -0,0 +1,5 @@
1
+ import { ReportI } from '@/interfaces'
2
+
3
+ export interface ReadOnlyAppliancesI extends ReportI {
4
+ onEdit: (id: string) => void
5
+ }
@@ -0,0 +1 @@
1
+ export * from './ReadOnlyAppliances.interface'
@@ -2,3 +2,4 @@ export * from './ReadOnlyDate.interface'
2
2
  export * from './ReadOnlyGrid.interface'
3
3
  export * from './ReadOnlyInput.interface'
4
4
  export * from './ReadOnlyToggle.interface'
5
+ export * from './homeItem'
@@ -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
  }
@@ -5,4 +5,5 @@ export interface HomeAssistantStepsI {
5
5
  currentPanel?: number
6
6
  tutorialUrl?: string
7
7
  onStart?: () => void
8
+ zIndex?: string
8
9
  }
@@ -0,0 +1,7 @@
1
+ import { ReportI } from '@/interfaces'
2
+
3
+ export interface ViewingHomeItemPanelI {
4
+ form: ReportI[]
5
+ onClose: () => void
6
+ onEdit: (id: string) => void
7
+ }
@@ -0,0 +1 @@
1
+ export * from './ViewingHomeItemPanel.interface'
@@ -0,0 +1,11 @@
1
+ export interface BoxI {
2
+ image: string
3
+ name: string
4
+ newMessages?: number
5
+ totalMessages: number
6
+ }
7
+
8
+ export interface InboxCardI {
9
+ box: BoxI
10
+ onClick?: (box: string) => void
11
+ }
@@ -0,0 +1,9 @@
1
+ import { BoxI, MenuItemI } from '@/interfaces'
2
+ import { ReactNode } from 'react'
3
+
4
+ export interface InboxTileI {
5
+ banner?: ReactNode
6
+ boxes: BoxI[]
7
+ menuItems?: MenuItemI[]
8
+ onClick?: (box: string) => void
9
+ }
@@ -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
+ }