@homefile/components-v2 2.3.1 → 2.5.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 (203) hide show
  1. package/dist/assets/images/animations/index.d.ts +7 -0
  2. package/dist/assets/images/animations/index.js +7 -0
  3. package/dist/assets/images/animations/index.ts +15 -0
  4. package/dist/assets/images/animations/trees-cloudy.png +0 -0
  5. package/dist/assets/images/animations/trees-day-fall.png +0 -0
  6. package/dist/assets/images/animations/trees-day-summer.png +0 -0
  7. package/dist/assets/images/animations/trees-day-winter.png +0 -0
  8. package/dist/assets/images/animations/trees-evening.png +0 -0
  9. package/dist/assets/images/animations/trees-morning.png +0 -0
  10. package/dist/assets/images/animations/trees-night.png +0 -0
  11. package/dist/assets/images/book.svg +25 -0
  12. package/dist/assets/images/chat-bubble.svg +8 -0
  13. package/dist/assets/images/document2.svg +14 -0
  14. package/dist/assets/images/index.d.ts +5 -1
  15. package/dist/assets/images/index.js +5 -1
  16. package/dist/assets/images/index.ts +7 -0
  17. package/dist/assets/locales/en/index.json +11 -10
  18. package/dist/components/animations/CloudsAnimation.js +19 -3
  19. package/dist/components/animations/WeatherTrees.d.ts +6 -0
  20. package/dist/components/animations/WeatherTrees.js +36 -0
  21. package/dist/components/animations/index.d.ts +1 -0
  22. package/dist/components/animations/index.js +1 -0
  23. package/dist/components/badge/TextBadge.js +1 -1
  24. package/dist/components/folderPanel/folderDetails/FilesCounter.js +3 -5
  25. package/dist/components/footers/FooterButtons.d.ts +1 -1
  26. package/dist/components/footers/FooterButtons.js +2 -2
  27. package/dist/components/forms/BaseCounter.d.ts +2 -0
  28. package/dist/components/forms/BaseCounter.js +8 -0
  29. package/dist/components/forms/dynamicForm/fields/uiFields/TileCta.js +1 -1
  30. package/dist/components/forms/dynamicForm/fields/uiFields/TileCta.tsx +4 -2
  31. package/dist/components/forms/index.d.ts +1 -0
  32. package/dist/components/forms/index.js +1 -0
  33. package/dist/components/forms/readOnly/ReadOnlyDynamicForm.d.ts +1 -1
  34. package/dist/components/forms/readOnly/ReadOnlyDynamicForm.js +6 -4
  35. package/dist/components/forms/readOnly/fields/ReadOnlyGrid.d.ts +1 -1
  36. package/dist/components/forms/readOnly/fields/ReadOnlyGrid.js +7 -3
  37. package/dist/components/forms/readOnly/fields/ReadOnlyNotes.d.ts +2 -0
  38. package/dist/components/forms/readOnly/fields/ReadOnlyNotes.js +5 -0
  39. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyAppliances.js +1 -1
  40. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyAppliances.tsx +1 -1
  41. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyGuidelines.d.ts +2 -0
  42. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyGuidelines.js +11 -0
  43. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyGuidelines.tsx +33 -0
  44. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemImages.js +1 -1
  45. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemImages.tsx +1 -0
  46. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyItemRelated.d.ts +2 -0
  47. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyItemRelated.js +11 -0
  48. package/dist/components/forms/readOnly/fields/homeItem/ReadOnlyItemRelated.tsx +40 -0
  49. package/dist/components/forms/readOnly/fields/homeItem/index.d.ts +2 -0
  50. package/dist/components/forms/readOnly/fields/homeItem/index.js +2 -0
  51. package/dist/components/forms/readOnly/fields/homeItem/index.ts +2 -0
  52. package/dist/components/forms/readOnly/fields/index.d.ts +1 -0
  53. package/dist/components/forms/readOnly/fields/index.js +1 -0
  54. package/dist/components/homeAssistant/HomeAssistantWrapper.d.ts +1 -1
  55. package/dist/components/homeAssistant/HomeAssistantWrapper.js +20 -6
  56. package/dist/components/homeItems/ViewingHomeItemPanel.d.ts +1 -1
  57. package/dist/components/homeItems/ViewingHomeItemPanel.js +2 -2
  58. package/dist/components/inboxTile/InboxForwardBanner.js +2 -2
  59. package/dist/components/inboxTile/index.d.ts +1 -0
  60. package/dist/components/inboxTile/index.js +1 -0
  61. package/dist/components/inboxTile/panel/MessageCard.d.ts +2 -0
  62. package/dist/components/inboxTile/panel/MessageCard.js +14 -0
  63. package/dist/components/inboxTile/panel/MessageChatPanel.d.ts +4 -0
  64. package/dist/components/inboxTile/panel/MessageChatPanel.js +38 -0
  65. package/dist/components/inboxTile/panel/MessagePanel.d.ts +2 -0
  66. package/dist/components/inboxTile/panel/MessagePanel.js +12 -0
  67. package/dist/components/inboxTile/panel/index.d.ts +3 -0
  68. package/dist/components/inboxTile/panel/index.js +3 -0
  69. package/dist/components/myHomes/WrapperWithShadow.js +1 -1
  70. package/dist/components/myHomes/steps/MyHomeDetails.d.ts +1 -0
  71. package/dist/components/myHomes/steps/MyHomeDetails.js +1 -1
  72. package/dist/components/notifications/NotificationCard.d.ts +1 -1
  73. package/dist/components/notifications/NotificationCard.js +2 -47
  74. package/dist/components/rooms/VideosCounter.js +3 -5
  75. package/dist/helpers/forms/dynamicForm.helper.js +2 -1
  76. package/dist/hooks/inbox/index.d.ts +1 -0
  77. package/dist/hooks/inbox/index.js +1 -0
  78. package/dist/hooks/inbox/useMessagePanel.d.ts +7 -0
  79. package/dist/hooks/inbox/useMessagePanel.js +17 -0
  80. package/dist/hooks/index.d.ts +1 -0
  81. package/dist/hooks/index.js +1 -0
  82. package/dist/hooks/notifications/useNotificationsPanel.js +0 -5
  83. package/dist/index.d.ts +1 -1
  84. package/dist/index.js +1 -1
  85. package/dist/interfaces/appBar/UserProfile.interface.d.ts +2 -2
  86. package/dist/interfaces/footers/FooterButtons.interface.d.ts +1 -0
  87. package/dist/interfaces/forms/BaseCounter.interface.d.ts +5 -0
  88. package/dist/interfaces/forms/BaseCounter.interface.js +1 -0
  89. package/dist/interfaces/forms/dynamicForm/DynamicForm.interface.d.ts +4 -3
  90. package/dist/interfaces/forms/index.d.ts +1 -0
  91. package/dist/interfaces/forms/index.js +1 -0
  92. package/dist/interfaces/forms/readOnly/ReadOnlyGrid.interface.d.ts +2 -1
  93. package/dist/interfaces/forms/readOnly/homeItem/ReadOnlyGuidelines.interface.d.ts +4 -0
  94. package/dist/interfaces/forms/readOnly/homeItem/ReadOnlyGuidelines.interface.js +1 -0
  95. package/dist/interfaces/forms/readOnly/homeItem/index.d.ts +1 -0
  96. package/dist/interfaces/forms/readOnly/homeItem/index.js +1 -0
  97. package/dist/interfaces/homeItems/ViewingHomeItemPanel.interface.d.ts +1 -0
  98. package/dist/interfaces/inboxTile/MessageCard.interface.d.ts +16 -0
  99. package/dist/interfaces/inboxTile/MessageCard.interface.js +1 -0
  100. package/dist/interfaces/inboxTile/MessageChatPanel.interface.d.ts +12 -0
  101. package/dist/interfaces/inboxTile/MessageChatPanel.interface.js +1 -0
  102. package/dist/interfaces/inboxTile/MessagePanel.interface.d.ts +6 -0
  103. package/dist/interfaces/inboxTile/MessagePanel.interface.js +1 -0
  104. package/dist/interfaces/inboxTile/index.d.ts +3 -0
  105. package/dist/interfaces/inboxTile/index.js +3 -0
  106. package/dist/interfaces/notifications/NotificationsPanel.interface.d.ts +3 -2
  107. package/dist/mocks/forms/dynamicForm.mock.js +60 -0
  108. package/dist/mocks/inbox/index.d.ts +1 -0
  109. package/dist/mocks/inbox/index.js +1 -0
  110. package/dist/mocks/inbox/messages.d.ts +2 -0
  111. package/dist/mocks/inbox/messages.js +136 -0
  112. package/dist/mocks/index.d.ts +1 -0
  113. package/dist/mocks/index.js +1 -0
  114. package/dist/mocks/notifications/notifications.mock.js +4 -4
  115. package/dist/stories/assets/Illustrations.stories.js +2 -2
  116. package/dist/stories/homeItems/ViewingHomeItem.stories.js +1 -0
  117. package/dist/stories/inboxTile/MessagePanel.stories.d.ts +5 -0
  118. package/dist/stories/inboxTile/MessagePanel.stories.js +24 -0
  119. package/dist/theme/colors.d.ts +4 -1
  120. package/dist/theme/colors.js +4 -1
  121. package/dist/utils/Animations.utils.d.ts +6 -0
  122. package/dist/utils/Animations.utils.js +31 -0
  123. package/dist/utils/Avatars.utils.d.ts +1 -1
  124. package/dist/utils/Avatars.utils.js +1 -1
  125. package/dist/utils/index.d.ts +1 -0
  126. package/dist/utils/index.js +1 -0
  127. package/package.json +1 -1
  128. package/src/assets/images/animations/index.ts +15 -0
  129. package/src/assets/images/animations/trees-cloudy.png +0 -0
  130. package/src/assets/images/animations/trees-day-fall.png +0 -0
  131. package/src/assets/images/animations/trees-day-summer.png +0 -0
  132. package/src/assets/images/animations/trees-day-winter.png +0 -0
  133. package/src/assets/images/animations/trees-evening.png +0 -0
  134. package/src/assets/images/animations/trees-morning.png +0 -0
  135. package/src/assets/images/animations/trees-night.png +0 -0
  136. package/src/assets/images/book.svg +25 -0
  137. package/src/assets/images/chat-bubble.svg +8 -0
  138. package/src/assets/images/document2.svg +14 -0
  139. package/src/assets/images/index.ts +7 -0
  140. package/src/assets/locales/en/index.json +11 -10
  141. package/src/components/animations/CloudsAnimation.tsx +34 -17
  142. package/src/components/animations/WeatherTrees.tsx +37 -0
  143. package/src/components/animations/index.ts +1 -0
  144. package/src/components/badge/TextBadge.tsx +1 -1
  145. package/src/components/folderPanel/folderDetails/FilesCounter.tsx +6 -21
  146. package/src/components/footers/FooterButtons.tsx +2 -1
  147. package/src/components/forms/BaseCounter.tsx +30 -0
  148. package/src/components/forms/dynamicForm/fields/uiFields/TileCta.tsx +4 -2
  149. package/src/components/forms/index.ts +1 -0
  150. package/src/components/forms/readOnly/ReadOnlyDynamicForm.tsx +8 -2
  151. package/src/components/forms/readOnly/fields/ReadOnlyGrid.tsx +32 -3
  152. package/src/components/forms/readOnly/fields/ReadOnlyNotes.tsx +16 -0
  153. package/src/components/forms/readOnly/fields/homeItem/ReadOnlyAppliances.tsx +1 -1
  154. package/src/components/forms/readOnly/fields/homeItem/ReadOnlyGuidelines.tsx +33 -0
  155. package/src/components/forms/readOnly/fields/homeItem/ReadOnlyHomeItemImages.tsx +1 -0
  156. package/src/components/forms/readOnly/fields/homeItem/ReadOnlyItemRelated.tsx +40 -0
  157. package/src/components/forms/readOnly/fields/homeItem/index.ts +2 -0
  158. package/src/components/forms/readOnly/fields/index.ts +1 -0
  159. package/src/components/homeAssistant/HomeAssistantWrapper.tsx +31 -18
  160. package/src/components/homeItems/ViewingHomeItemPanel.tsx +2 -1
  161. package/src/components/inboxTile/InboxForwardBanner.tsx +5 -4
  162. package/src/components/inboxTile/index.ts +1 -0
  163. package/src/components/inboxTile/panel/MessageCard.tsx +112 -0
  164. package/src/components/inboxTile/panel/MessageChatPanel.tsx +105 -0
  165. package/src/components/inboxTile/panel/MessagePanel.tsx +64 -0
  166. package/src/components/inboxTile/panel/index.ts +3 -0
  167. package/src/components/myHomes/WrapperWithShadow.tsx +1 -0
  168. package/src/components/myHomes/steps/MyHomeDetails.tsx +1 -1
  169. package/src/components/notifications/NotificationCard.tsx +2 -106
  170. package/src/components/onboarding/pages/SignIn.tsx +1 -0
  171. package/src/components/rooms/VideosCounter.tsx +2 -18
  172. package/src/helpers/forms/dynamicForm.helper.ts +2 -0
  173. package/src/hooks/inbox/index.ts +1 -0
  174. package/src/hooks/inbox/useMessagePanel.ts +23 -0
  175. package/src/hooks/index.ts +1 -0
  176. package/src/hooks/notifications/useNotificationsPanel.ts +0 -5
  177. package/src/index.ts +2 -0
  178. package/src/interfaces/appBar/UserProfile.interface.ts +2 -2
  179. package/src/interfaces/footers/FooterButtons.interface.ts +2 -1
  180. package/src/interfaces/forms/BaseCounter.interface.ts +5 -0
  181. package/src/interfaces/forms/dynamicForm/DynamicForm.interface.ts +9 -1
  182. package/src/interfaces/forms/index.ts +1 -0
  183. package/src/interfaces/forms/readOnly/ReadOnlyGrid.interface.ts +3 -1
  184. package/src/interfaces/forms/readOnly/homeItem/ReadOnlyGuidelines.interface.ts +6 -0
  185. package/src/interfaces/forms/readOnly/homeItem/index.ts +1 -0
  186. package/src/interfaces/homeItems/ViewingHomeItemPanel.interface.ts +1 -0
  187. package/src/interfaces/inboxTile/MessageCard.interface.ts +18 -0
  188. package/src/interfaces/inboxTile/MessageChatPanel.interface.ts +13 -0
  189. package/src/interfaces/inboxTile/MessagePanel.interface.ts +7 -0
  190. package/src/interfaces/inboxTile/index.ts +3 -0
  191. package/src/interfaces/notifications/NotificationsPanel.interface.ts +3 -9
  192. package/src/mocks/forms/dynamicForm.mock.ts +60 -0
  193. package/src/mocks/inbox/index.ts +1 -0
  194. package/src/mocks/inbox/messages.ts +139 -0
  195. package/src/mocks/index.ts +1 -0
  196. package/src/mocks/notifications/notifications.mock.ts +4 -4
  197. package/src/stories/assets/Illustrations.stories.tsx +4 -0
  198. package/src/stories/homeItems/ViewingHomeItem.stories.tsx +1 -0
  199. package/src/stories/inboxTile/MessagePanel.stories.tsx +47 -0
  200. package/src/theme/colors.ts +4 -1
  201. package/src/utils/Animations.utils.ts +39 -0
  202. package/src/utils/Avatars.utils.ts +2 -2
  203. package/src/utils/index.ts +1 -0
@@ -0,0 +1,40 @@
1
+ import { Text, Stack, Grid, Box } from '@chakra-ui/react'
2
+ import { HiddenField } from '@/components'
3
+ import { ReadOnlyGuidelinesI } from '@/interfaces'
4
+ import { fieldIcons } from '@/helpers'
5
+
6
+ export const ReadOnlyItemRelated = ({
7
+ name,
8
+ children,
9
+ onClick,
10
+ }: ReadOnlyGuidelinesI) => {
11
+ return (
12
+ <Box
13
+ borderLeft="1px solid"
14
+ borderColor="lightBlue.6"
15
+ pl="4"
16
+ marginInlineStart="auto"
17
+ >
18
+ <Stack spacing="base">
19
+ <Text fontSize="xs" textTransform="uppercase">
20
+ {name}
21
+ </Text>
22
+ <Grid templateColumns="repeat(2, minmax(80px, 1fr))" gap="base">
23
+ {children?.map((child) => {
24
+ const { id, icon, value } = child
25
+ const btnIcon = icon ? fieldIcons[icon] : ''
26
+ return (
27
+ <HiddenField
28
+ key={id}
29
+ id={id}
30
+ icon={btnIcon}
31
+ name={value as string}
32
+ onClick={() => onClick?.(id)}
33
+ />
34
+ )
35
+ })}
36
+ </Grid>
37
+ </Stack>
38
+ </Box>
39
+ )
40
+ }
@@ -1,4 +1,6 @@
1
1
  export * from './ReadOnlyAppliances'
2
+ export * from './ReadOnlyGuidelines'
2
3
  export * from './ReadOnlyHomeItemImages'
3
4
  export * from './ReadOnlyHomeItemRating'
4
5
  export * from './ReadOnlyHomeItemText'
6
+ export * from './ReadOnlyItemRelated'
@@ -4,6 +4,7 @@ export * from './ReadOnlyImage'
4
4
  export * from './ReadOnlyGrid'
5
5
  export * from './ReadOnlyGroup'
6
6
  export * from './ReadOnlyInput'
7
+ export * from './ReadOnlyNotes'
7
8
  export * from './ReadOnlyRating'
8
9
  export * from './ReadOnlyTextArea'
9
10
  export * from './ReadOnlyWrapper'
@@ -1,45 +1,59 @@
1
- import { PropsWithChildren } from 'react'
2
- import { t } from 'i18next'
3
- import { Box, Center, GridItem, Image } from '@chakra-ui/react'
1
+ import { PropsWithChildren, useEffect, useState } from 'react'
2
+ import { Box, GridItem, Image } from '@chakra-ui/react'
4
3
  import {
5
4
  ContainerHeader,
6
5
  TileTooltip,
7
6
  moveRightToLeftWithFade,
8
7
  moveRightToLeft,
9
8
  moveLeftToRightAirplane,
9
+ WeatherTrees,
10
10
  } from '@/components'
11
+ import { Airplane, Cloud1, Cloud2, Cloud3, IA } from '@/assets/images'
11
12
  import {
12
- Airplane,
13
- Cloud1,
14
- Cloud2,
15
- Cloud3,
16
- IA,
17
- TreesCrop,
18
- } from '@/assets/images'
19
- import { getImageAltText } from '@/utils'
13
+ getTimeOfDay,
14
+ getTimeOfDaySeason,
15
+ TimeOfDay,
16
+ TimeOfDaySeason,
17
+ } from '@/utils'
20
18
  import { colors } from '@/theme/colors'
21
19
 
22
20
  export const HomeAssistantWrapper = ({
23
21
  children,
24
22
  showAirplane,
25
23
  title,
26
- zIndex
24
+ zIndex,
27
25
  }: PropsWithChildren<{
28
26
  showAirplane?: boolean
29
27
  title: string
30
28
  zIndex?: string
31
29
  }>) => {
32
- const treesAlt = getImageAltText(TreesCrop)
30
+ const [timeOfDay, setTimeOfDay] = useState<TimeOfDay>(getTimeOfDay())
31
+ const timeOfDaySeason = getTimeOfDaySeason()
32
+ const gradients: Record<TimeOfDay, string> = {
33
+ day: colors.dayGradient,
34
+ evening: colors.eveningGradient,
35
+ morning: colors.morningGradient,
36
+ night: colors.nightGradient,
37
+ }
38
+
39
+ useEffect(() => {
40
+ const interval = setInterval(() => {
41
+ setTimeOfDay(getTimeOfDay())
42
+ }, 60000)
43
+
44
+ return () => clearInterval(interval)
45
+ }, [])
33
46
 
34
47
  return (
35
48
  <GridItem colSpan={[1, 2]} zIndex={zIndex}>
36
49
  <TileTooltip label="homeAssistant">
37
50
  <Box
38
- bgGradient={colors.skyGradient}
51
+ bgGradient={gradients[timeOfDay]}
39
52
  boxShadow="base"
40
53
  h="full"
41
54
  position="relative"
42
55
  overflow="hidden"
56
+ transition="background 1s ease-in-out"
43
57
  >
44
58
  <ContainerHeader title={title} titleIcon={IA} />
45
59
  <>{children}</>
@@ -77,14 +91,13 @@ export const HomeAssistantWrapper = ({
77
91
  animation={`${moveLeftToRightAirplane} 500s cubic-bezier(1, 1, 1, 500) infinite`}
78
92
  />
79
93
  )}
80
- <Image
81
- src={TreesCrop}
82
- alt={treesAlt}
94
+ <WeatherTrees
95
+ timeOfDaySeason={timeOfDaySeason}
83
96
  position="absolute"
84
97
  bottom="0"
85
98
  right="2"
86
99
  w="auto"
87
- h="70px"
100
+ h="100px"
88
101
  />
89
102
  </Box>
90
103
  </TileTooltip>
@@ -6,6 +6,7 @@ import { ViewingHomeItemPanelI } from '@/interfaces'
6
6
 
7
7
  export const ViewingHomeItemPanel = ({
8
8
  form,
9
+ onClick,
9
10
  onClose,
10
11
  onEdit,
11
12
  }: ViewingHomeItemPanelI) => {
@@ -38,7 +39,7 @@ export const ViewingHomeItemPanel = ({
38
39
  <TabsHeader tabList={tabs} rightTabList={rightTabs} />
39
40
  </Box>
40
41
  </DrawerHeader>
41
- <ReadOnlyDynamicForm form={form} onEdit={onEdit} />
42
+ <ReadOnlyDynamicForm form={form} onClick={onClick} onEdit={onEdit} />
42
43
  </DrawerContent>
43
44
  )
44
45
  }
@@ -1,5 +1,5 @@
1
1
  import { t } from 'i18next'
2
- import { AspectRatio, Flex, Text, Image } from '@chakra-ui/react'
2
+ import { AspectRatio, Flex, Text, Image, chakra } from '@chakra-ui/react'
3
3
  import { IA } from '@/assets/images'
4
4
 
5
5
  export const InboxForwardBanner = () => {
@@ -11,15 +11,16 @@ export const InboxForwardBanner = () => {
11
11
 
12
12
  <Text variant="home" lineHeight="1">
13
13
  {t('inbox.forwardTo')}
14
- <Text
15
- variant="home"
14
+ <chakra.span
15
+ fontFamily="secondary"
16
+ fontSize="sm"
16
17
  lineHeight="1"
17
18
  color="neutral.black"
18
19
  fontWeight="bold"
19
20
  display="inline"
20
21
  >
21
22
  homefileit@homefile.com.
22
- </Text>
23
+ </chakra.span>
23
24
  </Text>
24
25
  </Flex>
25
26
  )
@@ -1,3 +1,4 @@
1
+ export * from './panel'
1
2
  export * from './InboxCard'
2
3
  export * from './InboxForwardBanner'
3
4
  export * from './InboxTile'
@@ -0,0 +1,112 @@
1
+ import { t } from 'i18next'
2
+ import {
3
+ Avatar,
4
+ Box,
5
+ Center,
6
+ chakra,
7
+ Container,
8
+ Divider,
9
+ Flex,
10
+ Stack,
11
+ Text,
12
+ } from '@chakra-ui/react'
13
+ import { ChatBubble } from '@/assets/images'
14
+ import { TextBadge } from '@/components'
15
+ import { formatDateWithAt } from '@/utils'
16
+ import { MessageCardI } from '@/interfaces'
17
+
18
+ export const MessageCard = ({
19
+ message,
20
+ onClick,
21
+ variant = 'inbox',
22
+ }: MessageCardI) => {
23
+ const { currentUser, from, subject, date, isNew, chatReplies, description } =
24
+ message
25
+ const formattedDate = formatDateWithAt({ date })
26
+ const showChatBubble = Number(chatReplies?.length) > 0
27
+ const isInbox = variant === 'inbox'
28
+ const isCurrentUser = currentUser?.userName === from
29
+ return (
30
+ <Flex gap="base">
31
+ {!isCurrentUser && !isInbox && (
32
+ <Avatar
33
+ size="sm"
34
+ name={from}
35
+ bg="blue.4"
36
+ fontWeight="bold"
37
+ color="neutral.white"
38
+ />
39
+ )}
40
+ <Container
41
+ as={isInbox ? 'button' : 'div'}
42
+ bg={isCurrentUser ? 'yellow.6' : 'neutral.white'}
43
+ transition="background-color 0.3s"
44
+ textAlign="left"
45
+ _hover={isInbox ? { bg: 'lightGreen.1' } : {}}
46
+ onClick={() => onClick?.(message)}
47
+ >
48
+ <Box>
49
+ {!isCurrentUser && (
50
+ <Flex
51
+ justify="space-between"
52
+ align="center"
53
+ py="1"
54
+ pr="base"
55
+ pl={isNew ? '' : 'base'}
56
+ >
57
+ <Flex
58
+ gap="base"
59
+ align="center"
60
+ position="relative"
61
+ left={isNew ? '-13px' : ''}
62
+ >
63
+ {isNew && isInbox && (
64
+ <TextBadge
65
+ text="New"
66
+ showAnimation={false}
67
+ bgColor="violet.1"
68
+ />
69
+ )}
70
+ <Text variant="home" color="gray.1">
71
+ {t('inbox.from')}
72
+ <chakra.span color="gray.4">{from}</chakra.span>
73
+ </Text>
74
+ </Flex>
75
+ <Text variant="home" fontSize="xs">
76
+ {formattedDate}
77
+ </Text>
78
+ </Flex>
79
+ )}
80
+ {isInbox && <Divider />}
81
+ <Stack spacing="base" p="base">
82
+ <Flex align="center" justify="space-between">
83
+ <Text variant="home" fontWeight="bold">
84
+ {subject}
85
+ </Text>
86
+ {showChatBubble && isInbox && (
87
+ <Center
88
+ backgroundImage={`url(${ChatBubble})`}
89
+ backgroundRepeat="no-repeat"
90
+ backgroundSize="contain"
91
+ backgroundPosition="bottom"
92
+ w="20px"
93
+ h="24px"
94
+ >
95
+ <Text fontSize="10px" color="blue.2" fontWeight="bold">
96
+ {chatReplies?.length}
97
+ </Text>
98
+ </Center>
99
+ )}
100
+ </Flex>
101
+ {isInbox && (
102
+ <Text variant="home" noOfLines={3} textOverflow="ellipsis">
103
+ {description}
104
+ </Text>
105
+ )}
106
+ {!isInbox && <Text variant="home">{description}</Text>}
107
+ </Stack>
108
+ </Box>
109
+ </Container>
110
+ </Flex>
111
+ )
112
+ }
@@ -0,0 +1,105 @@
1
+ import { useState } from 'react'
2
+ import { t } from 'i18next'
3
+ import {
4
+ Box,
5
+ DrawerBody,
6
+ DrawerContent,
7
+ DrawerFooter,
8
+ DrawerHeader,
9
+ Stack,
10
+ Text,
11
+ } from '@chakra-ui/react'
12
+ import QuillEditor from 'react-quill'
13
+ import { Document2 } from '@/assets/images'
14
+ import {
15
+ BackCircleButton,
16
+ FooterButtons,
17
+ MessageCard,
18
+ PanelHeader,
19
+ up,
20
+ WrapperWithShadow,
21
+ } from '@/components'
22
+ import { MessageChatPanelI } from '@/interfaces'
23
+
24
+ import 'react-quill/dist/quill.snow.css'
25
+ import '@/styles/quill.css'
26
+
27
+ export const MessageChatPanel = ({
28
+ message,
29
+ onBack,
30
+ onClose,
31
+ onReply,
32
+ }: MessageChatPanelI) => {
33
+ const [value, setValue] = useState('')
34
+ const onChange = (content: string) => {
35
+ setValue(content)
36
+ }
37
+ return (
38
+ <DrawerContent bg="lightBlue.1">
39
+ <DrawerHeader p="0">
40
+ <PanelHeader
41
+ handleCloseButton={onClose}
42
+ title={message?.from ?? ''}
43
+ icon={Document2}
44
+ />
45
+ </DrawerHeader>
46
+ <DrawerBody p="0">
47
+ <Box bg="lightBlue.2" py="2" px="base">
48
+ <BackCircleButton onClick={onBack} />
49
+ </Box>
50
+ <Stack spacing="base" p="base" pb="4">
51
+ {message?.chatReplies?.map((reply) => (
52
+ <MessageCard
53
+ key={reply._id}
54
+ message={{
55
+ ...reply,
56
+ currentUser: message.currentUser,
57
+ }}
58
+ variant="chat"
59
+ />
60
+ ))}
61
+ </Stack>
62
+ </DrawerBody>
63
+ <DrawerFooter p="0" maxH="400px">
64
+ <WrapperWithShadow animation={up} fadeDelay={0.2}>
65
+ <Stack spacing="base">
66
+ <Text>{t('inbox.createReply')}</Text>
67
+ <QuillEditor
68
+ theme="snow"
69
+ value={value}
70
+ modules={{ toolbar }}
71
+ onChange={onChange}
72
+ placeholder={t('inbox.enterContent')}
73
+ />
74
+ <FooterButtons
75
+ px="0"
76
+ button1={{
77
+ buttonStyle: 'secondaryFooter',
78
+ label: t('buttons.send'),
79
+ isDisabled: Number(value.length) === 0,
80
+ onClick: () =>
81
+ onReply({
82
+ id: message?._id ?? '',
83
+ message: value,
84
+ }),
85
+ }}
86
+ />
87
+ </Stack>
88
+ </WrapperWithShadow>
89
+ </DrawerFooter>
90
+ </DrawerContent>
91
+ )
92
+ }
93
+
94
+ const toolbar = [
95
+ ['bold', 'italic', 'underline', 'strike'],
96
+ ['blockquote', 'link', 'image'],
97
+ [{ list: 'ordered' }, { list: 'bullet' }, { list: 'check' }],
98
+ [{ script: 'sub' }, { script: 'super' }],
99
+ [{ indent: '-1' }, { indent: '+1' }],
100
+ [{ header: [1, 2, 3, 4, 5, 6, false] }],
101
+
102
+ [{ color: [] }, { background: [] }],
103
+
104
+ ['clean'],
105
+ ]
@@ -0,0 +1,64 @@
1
+ import { t } from 'i18next'
2
+ import {
3
+ Box,
4
+ DrawerBody,
5
+ DrawerContent,
6
+ DrawerHeader,
7
+ Stack,
8
+ } from '@chakra-ui/react'
9
+ import { Inbox } from '@/assets/images'
10
+ import {
11
+ BaseCounter,
12
+ MessageCard,
13
+ PanelHeader,
14
+ SelectInput,
15
+ } from '@/components'
16
+ import { MessagePanelI } from '@/interfaces'
17
+ import { useMessagePanel } from '@/hooks'
18
+ import { pluralize } from '@/utils'
19
+
20
+ export const MessagePanel = ({ messages, onClick, onClose }: MessagePanelI) => {
21
+ const { currentSort, sortedMessages, handleSelectItem, items } =
22
+ useMessagePanel(messages)
23
+
24
+ const baseCounterText = `${t('counter.showing')} ${sortedMessages.length} ${t(
25
+ 'counter.of'
26
+ )} ${messages.length} ${pluralize(
27
+ sortedMessages.length,
28
+ t('inbox.message').toLowerCase()
29
+ )} `
30
+ return (
31
+ <DrawerContent bg="lightBlue.1">
32
+ <DrawerHeader p="0">
33
+ <PanelHeader
34
+ handleCloseButton={onClose}
35
+ title={t('inbox.message')}
36
+ icon={Inbox}
37
+ />
38
+ </DrawerHeader>
39
+ <DrawerBody p="0">
40
+ <Stack spacing="base" pb="4">
41
+ <Box p="base" bg="lightBlue.2">
42
+ <SelectInput
43
+ handleClick={handleSelectItem}
44
+ initialValue={currentSort}
45
+ items={items}
46
+ />
47
+ </Box>
48
+ <Box px="base">
49
+ <BaseCounter text={baseCounterText} />
50
+ </Box>
51
+ <Stack spacing="1" pl="26px" pr="base">
52
+ {sortedMessages.map((message) => (
53
+ <MessageCard
54
+ key={message._id}
55
+ message={message}
56
+ onClick={onClick}
57
+ />
58
+ ))}
59
+ </Stack>
60
+ </Stack>
61
+ </DrawerBody>
62
+ </DrawerContent>
63
+ )
64
+ }
@@ -0,0 +1,3 @@
1
+ export * from './MessageCard'
2
+ export * from './MessageChatPanel'
3
+ export * from './MessagePanel'
@@ -9,6 +9,7 @@ export const WrapperWithShadow = ({
9
9
  }: PropsWithChildren<WrapperWithShadowI>) => {
10
10
  return (
11
11
  <Stack
12
+ w="full"
12
13
  spacing="base"
13
14
  p="base"
14
15
  borderTopRadius="xl"
@@ -34,7 +34,7 @@ const upAnimation = keyframes`
34
34
  to { transform: translateY(0); box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.07)}
35
35
  `
36
36
 
37
- const up = `${upAnimation} 200ms ease forwards`
37
+ export const up = `${upAnimation} 200ms ease forwards`
38
38
 
39
39
  export const MyHomeDetails = ({
40
40
  handleCreateHomeClick,
@@ -7,115 +7,11 @@ import { formatDateWithAt } from '@/utils'
7
7
  export const NotificationCard = ({
8
8
  _id,
9
9
  createdAt,
10
+ label,
10
11
  message,
11
12
  onDismiss,
12
13
  status,
13
- type,
14
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
15
  const bgColors: Record<NotificationCardI['status'], string> = {
120
16
  added: 'lightGreen.3',
121
17
  removed: 'error.1',
@@ -140,7 +36,7 @@ export const NotificationCard = ({
140
36
  textTransform="uppercase"
141
37
  color={colors[status]}
142
38
  >
143
- {actionLabels[type][status]}
39
+ {label}
144
40
  </Text>
145
41
  <Flex gap="1" align="center">
146
42
  <Text variant="date">{formatDateWithAt({ date: createdAt })}</Text>
@@ -9,6 +9,7 @@ import {
9
9
  TextInput,
10
10
  ButtonLoader,
11
11
  BasePageWrapper,
12
+ CloudsAnimation,
12
13
  } from '@/components'
13
14
  import { isEmptyField } from '@/utils'
14
15
  import { SignInI } from '@/interfaces'
@@ -1,9 +1,7 @@
1
1
  import { t } from 'i18next'
2
- import { Box, Flex, Text, chakra } from '@chakra-ui/react'
3
- import { BeatLoader } from 'react-spinners'
4
- import { colors } from '@/theme/colors'
5
2
  import { VideosCounterI } from '@/interfaces'
6
3
  import { pluralize } from '@/utils'
4
+ import { BaseCounter } from '@/components'
7
5
 
8
6
  export const VideosCounter = ({ totalVideos, uploading }: VideosCounterI) => {
9
7
  const videos = pluralize(totalVideos, t('roomVideo.more'))
@@ -11,20 +9,6 @@ export const VideosCounter = ({ totalVideos, uploading }: VideosCounterI) => {
11
9
  const text = `${t('roomVideo.youCan')} ${totalVideos} ${videos}`
12
10
 
13
11
  return (
14
- <Box w="100%">
15
- <Flex justify="space-between" align="center">
16
- {!uploading && <Text variant="home">{text}</Text>}
17
- {uploading && (
18
- <Text variant="home">
19
- <chakra.span fontWeight="bold">
20
- {t('folderSharing.uploading')}
21
- </chakra.span>
22
- <chakra.span ml="2">
23
- <BeatLoader size="4px" color={colors.blue[6]} />
24
- </chakra.span>
25
- </Text>
26
- )}
27
- </Flex>
28
- </Box>
12
+ <BaseCounter text={text} uploading={uploading} uploadingText={videos} />
29
13
  )
30
14
  }