@homefile/components-v2 1.2.2 → 1.4.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 (234) hide show
  1. package/dist/assets/images/circle-face.svg +21 -0
  2. package/dist/assets/images/company.svg +34 -0
  3. package/dist/assets/images/index.d.ts +5 -1
  4. package/dist/assets/images/index.js +5 -1
  5. package/dist/assets/images/index.ts +7 -0
  6. package/dist/assets/images/location.jpg +0 -0
  7. package/dist/assets/images/logos/index.d.ts +2 -1
  8. package/dist/assets/images/logos/index.js +2 -1
  9. package/dist/assets/images/logos/index.ts +12 -1
  10. package/dist/assets/images/logos/shine.png +0 -0
  11. package/dist/assets/images/shine/gutter-cleaning.png +0 -0
  12. package/dist/assets/images/shine/holiday-lights.png +0 -0
  13. package/dist/assets/images/shine/home-cleaning.png +0 -0
  14. package/dist/assets/images/shine/index.d.ts +7 -0
  15. package/dist/assets/images/shine/index.js +7 -0
  16. package/dist/assets/images/shine/index.ts +15 -0
  17. package/dist/assets/images/shine/pressure.png +0 -0
  18. package/dist/assets/images/shine/roof-cleaning.png +0 -0
  19. package/dist/assets/images/shine/window.png +0 -0
  20. package/dist/assets/locales/en/index.json +23 -1
  21. package/dist/components/animations/CloudsAnimation.js +1 -1
  22. package/dist/components/contacts/ContactCard.d.ts +1 -1
  23. package/dist/components/contacts/ContactCard.js +8 -3
  24. package/dist/components/contacts/ContactCardHeader.d.ts +1 -1
  25. package/dist/components/contacts/ContactCardHeader.js +5 -6
  26. package/dist/components/contacts/ContactHeaderMenu.d.ts +2 -0
  27. package/dist/components/contacts/ContactHeaderMenu.js +7 -0
  28. package/dist/components/contacts/ContactsContent.d.ts +1 -1
  29. package/dist/components/contacts/ContactsContent.js +2 -2
  30. package/dist/components/contacts/addEditPanel/AddEditContactPanel.d.ts +2 -0
  31. package/dist/components/contacts/addEditPanel/AddEditContactPanel.js +24 -0
  32. package/dist/components/contacts/addEditPanel/index.d.ts +1 -0
  33. package/dist/components/contacts/addEditPanel/index.js +1 -0
  34. package/dist/components/contacts/index.d.ts +3 -0
  35. package/dist/components/contacts/index.js +3 -0
  36. package/dist/components/contacts/viewPanel/CompanyInfoCard.d.ts +2 -0
  37. package/dist/components/contacts/viewPanel/CompanyInfoCard.js +13 -0
  38. package/dist/components/contacts/viewPanel/CompanyRating.d.ts +3 -0
  39. package/dist/components/contacts/viewPanel/CompanyRating.js +27 -0
  40. package/dist/components/contacts/viewPanel/ContactAddressCard.d.ts +2 -0
  41. package/dist/components/contacts/viewPanel/ContactAddressCard.js +12 -0
  42. package/dist/components/contacts/viewPanel/ContactNotes.d.ts +3 -0
  43. package/dist/components/contacts/viewPanel/ContactNotes.js +8 -0
  44. package/dist/components/contacts/viewPanel/PersonalInfoCard.d.ts +2 -0
  45. package/dist/components/contacts/viewPanel/PersonalInfoCard.js +8 -0
  46. package/dist/components/contacts/viewPanel/RoleTag.d.ts +2 -0
  47. package/dist/components/contacts/viewPanel/RoleTag.js +9 -0
  48. package/dist/components/contacts/viewPanel/ViewContactHeader.d.ts +2 -0
  49. package/dist/components/contacts/viewPanel/ViewContactHeader.js +11 -0
  50. package/dist/components/contacts/viewPanel/ViewContactPanel.d.ts +2 -0
  51. package/dist/components/contacts/viewPanel/ViewContactPanel.js +9 -0
  52. package/dist/components/contacts/viewPanel/index.d.ts +8 -0
  53. package/dist/components/contacts/viewPanel/index.js +8 -0
  54. package/dist/components/forms/dynamicForm/DynamicForm.d.ts +1 -1
  55. package/dist/components/forms/dynamicForm/DynamicForm.js +5 -5
  56. package/dist/components/forms/dynamicForm/SimpleDynamicForm.d.ts +2 -0
  57. package/dist/components/forms/dynamicForm/SimpleDynamicForm.js +29 -0
  58. package/dist/components/forms/dynamicForm/fields/FieldWithDelete.d.ts +1 -1
  59. package/dist/components/forms/dynamicForm/fields/FieldWithDelete.js +2 -3
  60. package/dist/components/forms/dynamicForm/fields/GroupField.d.ts +1 -1
  61. package/dist/components/forms/dynamicForm/fields/GroupField.js +2 -2
  62. package/dist/components/forms/dynamicForm/index.d.ts +1 -1
  63. package/dist/components/forms/dynamicForm/index.js +1 -1
  64. package/dist/components/homeAssistant/panel/ApplianceSteps.d.ts +1 -1
  65. package/dist/components/homeAssistant/panel/ApplianceSteps.js +2 -2
  66. package/dist/components/homeAssistant/panel/HomeAssistantPanel.d.ts +1 -1
  67. package/dist/components/homeAssistant/panel/HomeAssistantPanel.js +14 -7
  68. package/dist/components/homeBoard/HomeBoard.js +1 -1
  69. package/dist/components/homeBoard/HomeCardWithRecipent.d.ts +1 -1
  70. package/dist/components/homeBoard/HomeCardWithRecipent.js +8 -2
  71. package/dist/components/onboarding/pages/ActivateAccount.js +2 -2
  72. package/dist/components/onboarding/pages/BasePageWrapper.d.ts +2 -0
  73. package/dist/components/onboarding/pages/BasePageWrapper.js +5 -0
  74. package/dist/components/onboarding/pages/EmailValidation.js +3 -3
  75. package/dist/components/onboarding/pages/NewPassword.js +2 -2
  76. package/dist/components/onboarding/pages/ResendResetPassword.js +3 -3
  77. package/dist/components/onboarding/pages/ResetPassword.js +2 -2
  78. package/dist/components/onboarding/pages/SignIn.js +2 -2
  79. package/dist/components/onboarding/pages/SignUp.js +5 -5
  80. package/dist/components/onboarding/pages/TwoFactor.js +2 -2
  81. package/dist/components/onboarding/pages/index.d.ts +10 -9
  82. package/dist/components/onboarding/pages/index.js +10 -9
  83. package/dist/components/partner/customPartnerTiles/ShineTile.d.ts +2 -0
  84. package/dist/components/partner/customPartnerTiles/ShineTile.js +56 -0
  85. package/dist/components/partner/customPartnerTiles/index.d.ts +1 -0
  86. package/dist/components/partner/customPartnerTiles/index.js +1 -0
  87. package/dist/helpers/HomeRoles.helper.d.ts +1 -5
  88. package/dist/helpers/HomeRoles.helper.js +6 -0
  89. package/dist/helpers/forms/dynamicForm.helper.js +3 -1
  90. package/dist/hooks/forms/index.d.ts +1 -0
  91. package/dist/hooks/forms/index.js +1 -0
  92. package/dist/hooks/forms/useSimpleDynamicForm.d.ts +11 -0
  93. package/dist/hooks/forms/useSimpleDynamicForm.js +36 -0
  94. package/dist/hooks/myHomes/useMyHomeCard.d.ts +1 -3
  95. package/dist/index.d.ts +1 -1
  96. package/dist/index.js +1 -1
  97. package/dist/interfaces/contacts/AddEditContactPanel.interface.d.ts +12 -0
  98. package/dist/interfaces/contacts/ContactCard.interface.d.ts +15 -1
  99. package/dist/interfaces/contacts/ContactCardInfo.interface.d.ts +2 -1
  100. package/dist/interfaces/contacts/ContactsContent.interface.d.ts +4 -0
  101. package/dist/interfaces/contacts/ViewContactPanel.interface.d.ts +9 -0
  102. package/dist/interfaces/contacts/ViewContactPanel.interface.js +1 -0
  103. package/dist/interfaces/contacts/index.d.ts +2 -0
  104. package/dist/interfaces/contacts/index.js +2 -0
  105. package/dist/interfaces/forms/dynamicForm/DynamicForm.interface.d.ts +9 -7
  106. package/dist/interfaces/forms/dynamicForm/SimpleDynamicForm.interface.d.ts +4 -0
  107. package/dist/interfaces/forms/dynamicForm/SimpleDynamicForm.interface.js +1 -0
  108. package/dist/interfaces/forms/dynamicForm/fields/FieldWithDelete.interface.d.ts +1 -1
  109. package/dist/interfaces/forms/dynamicForm/fields/GroupField.interface.d.ts +1 -1
  110. package/dist/interfaces/forms/dynamicForm/index.d.ts +1 -1
  111. package/dist/interfaces/forms/dynamicForm/index.js +1 -1
  112. package/dist/interfaces/homeAssistant/ApplianceSteps.interface.d.ts +3 -0
  113. package/dist/interfaces/homeAssistant/HomeAssistantPanel.interface.d.ts +4 -1
  114. package/dist/interfaces/homeBoard/HomeCardWithRecipent.interface.d.ts +1 -0
  115. package/dist/mocks/contacts/contacts.mock.js +17 -5
  116. package/dist/mocks/forms/dynamicForm.mock.d.ts +1 -0
  117. package/dist/mocks/forms/dynamicForm.mock.js +155 -0
  118. package/dist/proxies/contacts/contactForm.proxy.d.ts +2 -0
  119. package/dist/proxies/contacts/contactForm.proxy.js +7 -0
  120. package/dist/proxies/contacts/index.d.ts +1 -0
  121. package/dist/proxies/contacts/index.js +1 -0
  122. package/dist/proxies/index.d.ts +1 -0
  123. package/dist/proxies/index.js +1 -0
  124. package/dist/stories/assets/Illustrations.stories.js +2 -2
  125. package/dist/stories/contacts/AddEditContactPanel.stories.d.ts +5 -0
  126. package/dist/stories/contacts/AddEditContactPanel.stories.js +22 -0
  127. package/dist/stories/contacts/ContactCardAddress.stories.d.ts +2 -0
  128. package/dist/stories/contacts/ContactCardInfo.stories.d.ts +2 -0
  129. package/dist/stories/contacts/ViewContactPanel.stories.d.ts +5 -0
  130. package/dist/stories/contacts/ViewContactPanel.stories.js +28 -0
  131. package/dist/stories/homeAssistant/panel/ApplianceSteps.stories.d.ts +1 -1
  132. package/dist/stories/homeAssistant/panel/ApplianceSteps.stories.js +1 -0
  133. package/dist/stories/homeAssistant/panel/HomeAssistantPanel.stories.js +1 -1
  134. package/dist/stories/onboarding/pages/NewPassword.stories.js +2 -3
  135. package/dist/stories/onboarding/pages/ResendResetPassword.stories.js +2 -3
  136. package/dist/stories/onboarding/pages/ResetPassword.stories.js +2 -3
  137. package/dist/stories/onboarding/pages/SignIn.stories.js +2 -3
  138. package/dist/stories/onboarding/pages/SignUp.stories.js +2 -3
  139. package/dist/stories/partner/customPartnerTiles/ShineTile.stories.d.ts +5 -0
  140. package/dist/stories/partner/customPartnerTiles/ShineTile.stories.js +19 -0
  141. package/package.json +1 -1
  142. package/src/assets/images/circle-face.svg +21 -0
  143. package/src/assets/images/company.svg +34 -0
  144. package/src/assets/images/index.ts +7 -0
  145. package/src/assets/images/location.jpg +0 -0
  146. package/src/assets/images/logos/index.ts +12 -1
  147. package/src/assets/images/logos/shine.png +0 -0
  148. package/src/assets/images/shine/gutter-cleaning.png +0 -0
  149. package/src/assets/images/shine/holiday-lights.png +0 -0
  150. package/src/assets/images/shine/home-cleaning.png +0 -0
  151. package/src/assets/images/shine/index.ts +15 -0
  152. package/src/assets/images/shine/pressure.png +0 -0
  153. package/src/assets/images/shine/roof-cleaning.png +0 -0
  154. package/src/assets/images/shine/window.png +0 -0
  155. package/src/assets/locales/en/index.json +23 -1
  156. package/src/components/animations/CloudsAnimation.tsx +8 -7
  157. package/src/components/contacts/ContactCard.tsx +28 -25
  158. package/src/components/contacts/ContactCardHeader.tsx +5 -38
  159. package/src/components/contacts/ContactHeaderMenu.tsx +42 -0
  160. package/src/components/contacts/ContactsContent.tsx +3 -1
  161. package/src/components/contacts/addEditPanel/AddEditContactPanel.tsx +63 -0
  162. package/src/components/contacts/addEditPanel/index.ts +1 -0
  163. package/src/components/contacts/index.ts +3 -0
  164. package/src/components/contacts/viewPanel/CompanyInfoCard.tsx +58 -0
  165. package/src/components/contacts/viewPanel/CompanyRating.tsx +27 -0
  166. package/src/components/contacts/viewPanel/ContactAddressCard.tsx +39 -0
  167. package/src/components/contacts/viewPanel/ContactNotes.tsx +16 -0
  168. package/src/components/contacts/viewPanel/PersonalInfoCard.tsx +41 -0
  169. package/src/components/contacts/viewPanel/RoleTag.tsx +30 -0
  170. package/src/components/contacts/viewPanel/ViewContactHeader.tsx +26 -0
  171. package/src/components/contacts/viewPanel/ViewContactPanel.tsx +70 -0
  172. package/src/components/contacts/viewPanel/index.ts +8 -0
  173. package/src/components/forms/dynamicForm/DynamicForm.tsx +9 -6
  174. package/src/components/forms/dynamicForm/SimpleDynamicForm.tsx +57 -0
  175. package/src/components/forms/dynamicForm/fields/FieldWithDelete.tsx +2 -3
  176. package/src/components/forms/dynamicForm/fields/GroupField.tsx +7 -2
  177. package/src/components/forms/dynamicForm/index.ts +1 -1
  178. package/src/components/homeAssistant/panel/ApplianceSteps.tsx +5 -2
  179. package/src/components/homeAssistant/panel/HomeAssistantPanel.tsx +20 -7
  180. package/src/components/homeBoard/HomeBoard.tsx +3 -0
  181. package/src/components/homeBoard/HomeCardWithRecipent.tsx +15 -1
  182. package/src/components/onboarding/pages/ActivateAccount.tsx +8 -3
  183. package/src/components/onboarding/pages/BasePageWrapper.tsx +10 -0
  184. package/src/components/onboarding/pages/EmailValidation.tsx +3 -3
  185. package/src/components/onboarding/pages/NewPassword.tsx +9 -3
  186. package/src/components/onboarding/pages/ResendResetPassword.tsx +3 -3
  187. package/src/components/onboarding/pages/ResetPassword.tsx +3 -2
  188. package/src/components/onboarding/pages/SignIn.tsx +3 -4
  189. package/src/components/onboarding/pages/SignUp.tsx +9 -8
  190. package/src/components/onboarding/pages/TwoFactor.tsx +9 -3
  191. package/src/components/onboarding/pages/index.ts +10 -9
  192. package/src/components/partner/customPartnerTiles/ShineTile.tsx +148 -0
  193. package/src/components/partner/customPartnerTiles/index.ts +1 -0
  194. package/src/helpers/HomeRoles.helper.ts +7 -1
  195. package/src/helpers/forms/dynamicForm.helper.ts +4 -0
  196. package/src/hooks/forms/index.ts +1 -0
  197. package/src/hooks/forms/useSimpleDynamicForm.ts +58 -0
  198. package/src/index.ts +3 -0
  199. package/src/interfaces/contacts/AddEditContactPanel.interface.ts +14 -0
  200. package/src/interfaces/contacts/ContactCard.interface.ts +20 -1
  201. package/src/interfaces/contacts/ContactCardInfo.interface.ts +3 -2
  202. package/src/interfaces/contacts/ContactsContent.interface.ts +3 -0
  203. package/src/interfaces/contacts/ViewContactPanel.interface.ts +10 -0
  204. package/src/interfaces/contacts/index.ts +2 -0
  205. package/src/interfaces/forms/dynamicForm/DynamicForm.interface.ts +10 -6
  206. package/src/interfaces/forms/dynamicForm/SimpleDynamicForm.interface.ts +5 -0
  207. package/src/interfaces/forms/dynamicForm/fields/FieldWithDelete.interface.ts +1 -1
  208. package/src/interfaces/forms/dynamicForm/fields/GroupField.interface.ts +1 -1
  209. package/src/interfaces/forms/dynamicForm/index.ts +1 -1
  210. package/src/interfaces/homeAssistant/ApplianceSteps.interface.ts +13 -2
  211. package/src/interfaces/homeAssistant/HomeAssistantPanel.interface.ts +4 -1
  212. package/src/interfaces/homeBoard/HomeCardWithRecipent.interface.ts +1 -0
  213. package/src/mocks/contacts/contacts.mock.ts +17 -5
  214. package/src/mocks/forms/dynamicForm.mock.ts +156 -0
  215. package/src/proxies/contacts/contactForm.proxy.ts +9 -0
  216. package/src/proxies/contacts/index.ts +1 -0
  217. package/src/proxies/index.ts +1 -0
  218. package/src/stories/assets/Illustrations.stories.tsx +4 -0
  219. package/src/stories/contacts/AddEditContactPanel.stories.tsx +45 -0
  220. package/src/stories/contacts/ViewContactPanel.stories.tsx +35 -0
  221. package/src/stories/homeAssistant/panel/ApplianceSteps.stories.tsx +2 -1
  222. package/src/stories/homeAssistant/panel/HomeAssistantPanel.stories.tsx +2 -0
  223. package/src/stories/onboarding/pages/NewPassword.stories.tsx +3 -4
  224. package/src/stories/onboarding/pages/ResendResetPassword.stories.tsx +3 -4
  225. package/src/stories/onboarding/pages/ResetPassword.stories.tsx +3 -4
  226. package/src/stories/onboarding/pages/SignIn.stories.tsx +3 -4
  227. package/src/stories/onboarding/pages/SignUp.stories.tsx +3 -4
  228. package/src/stories/partner/customPartnerTiles/ShineTile.stories.tsx +26 -0
  229. package/dist/components/forms/dynamicForm/DynamicFormSimple.d.ts +0 -2
  230. package/dist/components/forms/dynamicForm/DynamicFormSimple.js +0 -32
  231. package/dist/interfaces/forms/dynamicForm/DynamicFormSimple.interface.d.ts +0 -4
  232. package/src/components/forms/dynamicForm/DynamicFormSimple.tsx +0 -66
  233. package/src/interfaces/forms/dynamicForm/DynamicFormSimple.interface.ts +0 -5
  234. /package/dist/interfaces/{forms/dynamicForm/DynamicFormSimple.interface.js → contacts/AddEditContactPanel.interface.js} +0 -0
@@ -0,0 +1,26 @@
1
+ import { Contacts } from '@/assets/images'
2
+ import { ContactHeaderMenu } from '@/components'
3
+ import { partnerCategoriesIcons } from '@/helpers'
4
+ import { ContactCardHeaderI } from '@/interfaces'
5
+ import { Flex, Image, Text, Stack } from '@chakra-ui/react'
6
+
7
+ export const ViewContactHeader = (props: ContactCardHeaderI) => {
8
+ const { category } = props.contact
9
+ const icon =
10
+ partnerCategoriesIcons[
11
+ category.toLowerCase() as keyof typeof partnerCategoriesIcons
12
+ ] ?? Contacts
13
+ return (
14
+ <Flex align="center" justify="space-between">
15
+ <Flex align="center" gap="2">
16
+ <Image src={icon} boxSize="22px" />
17
+ <Stack spacing="-1">
18
+ <Text fontSize="xs" noOfLines={1} textTransform="uppercase">
19
+ {category}
20
+ </Text>
21
+ </Stack>
22
+ </Flex>
23
+ <ContactHeaderMenu {...props} />
24
+ </Flex>
25
+ )
26
+ }
@@ -0,0 +1,70 @@
1
+ import { t } from 'i18next'
2
+ import {
3
+ DrawerContent,
4
+ DrawerHeader,
5
+ DrawerBody,
6
+ Stack,
7
+ Container,
8
+ Divider,
9
+ } from '@chakra-ui/react'
10
+ import { Contacts } from '@/assets/images'
11
+ import {
12
+ CompanyInfoCard,
13
+ ContactAddressCard,
14
+ ContactNotes,
15
+ PanelHeader,
16
+ RoleTag,
17
+ PersonalInfoCard,
18
+ ViewContactHeader,
19
+ } from '@/components'
20
+ import { ViewContactPanelI } from '@/interfaces'
21
+
22
+ export const ViewContactPanel = ({
23
+ contact,
24
+ menuItems,
25
+ handleClose,
26
+ onShare,
27
+ roleType,
28
+ }: ViewContactPanelI) => {
29
+ const isHomeowner = roleType === 'homeowner'
30
+ return (
31
+ <DrawerContent bg="lightBlue.1">
32
+ <DrawerHeader p="0">
33
+ <PanelHeader
34
+ handleCloseButton={handleClose}
35
+ icon={Contacts}
36
+ title={t('contacts.contactView')}
37
+ />
38
+ </DrawerHeader>
39
+ <DrawerBody p="0" overflowX="hidden" position="relative">
40
+ <RoleTag roleType={roleType} />
41
+ <Stack px="base" spacing="base">
42
+ <Container mt="36px" p="base" borderRadius="lg">
43
+ <Stack spacing="base">
44
+ <ViewContactHeader
45
+ contact={contact}
46
+ menuItems={menuItems}
47
+ onShare={onShare}
48
+ />
49
+ <PersonalInfoCard {...{ ...contact, index: 0 }} />
50
+ {isHomeowner && (
51
+ <>
52
+ <Divider borderStyle="dashed" borderColor="lightBlue.6" />
53
+ <ContactAddressCard contact={contact} />
54
+ </>
55
+ )}
56
+ {!isHomeowner && (
57
+ <>
58
+ <Divider borderStyle="dashed" borderColor="lightBlue.6" />
59
+ <CompanyInfoCard contact={contact} />
60
+ <Divider borderStyle="dashed" borderColor="lightBlue.6" />
61
+ <ContactNotes notes={contact.notes} />
62
+ </>
63
+ )}
64
+ </Stack>
65
+ </Container>
66
+ </Stack>
67
+ </DrawerBody>
68
+ </DrawerContent>
69
+ )
70
+ }
@@ -0,0 +1,8 @@
1
+ export * from './CompanyInfoCard'
2
+ export * from './CompanyRating'
3
+ export * from './ContactAddressCard'
4
+ export * from './ContactNotes'
5
+ export * from './PersonalInfoCard'
6
+ export * from './RoleTag'
7
+ export * from './ViewContactHeader'
8
+ export * from './ViewContactPanel'
@@ -23,6 +23,7 @@ import { fieldIcons } from '@/helpers'
23
23
  export const DynamicForm = ({
24
24
  form: fields,
25
25
  onUpload,
26
+ showTitle = true,
26
27
  uploadingFieldId,
27
28
  }: DynamicFormI) => {
28
29
  const {
@@ -37,13 +38,16 @@ export const DynamicForm = ({
37
38
 
38
39
  return (
39
40
  <Stack bg="lightBlue.1" spacing="0" h="full">
40
- <Text fontFamily="secondary" px="base" pt="4" pb="2">
41
- {t('forms.itemDetails')}
42
- </Text>
41
+ {showTitle && (
42
+ <Text fontFamily="secondary" px="base" pt="4" pb="2">
43
+ {t('forms.itemDetails')}
44
+ </Text>
45
+ )}
43
46
  <FormProvider {...form}>
44
47
  <>
45
48
  {visibleFields?.map((field) => {
46
49
  const {
50
+ canBeHidden,
47
51
  children,
48
52
  description,
49
53
  icon,
@@ -52,7 +56,6 @@ export const DynamicForm = ({
52
56
  options,
53
57
  type,
54
58
  value,
55
- visible,
56
59
  } = field
57
60
 
58
61
  const baseProps = {
@@ -65,7 +68,7 @@ export const DynamicForm = ({
65
68
  key: id,
66
69
  id,
67
70
  onRemove: handleRemove,
68
- isAlwaysVisible: visible,
71
+ canBeHidden,
69
72
  }
70
73
  switch (type) {
71
74
  case 'date':
@@ -153,7 +156,7 @@ export const DynamicForm = ({
153
156
  id={id}
154
157
  fields={children}
155
158
  onRemove={handleRemove}
156
- visible={visible}
159
+ canBeHidden={canBeHidden}
157
160
  />
158
161
  )
159
162
  default:
@@ -0,0 +1,57 @@
1
+ import { Stack } from '@chakra-ui/react'
2
+ import { SimpleDynamicFormI, IconTypes } from '@/interfaces'
3
+ import {
4
+ TextField,
5
+ SelectField,
6
+ SwitchField,
7
+ NumberField,
8
+ FieldDivider,
9
+ } from '@/components'
10
+ import { fieldIcons } from '@/helpers'
11
+
12
+ export const SimpleDynamicForm = ({ fields }: SimpleDynamicFormI) => {
13
+ return (
14
+ <Stack bg="neutral.white" spacing="0" h="full" boxShadow="md">
15
+ {fields?.map((field) => {
16
+ const { description, icon, id, name, options, type, value } = field
17
+
18
+ const baseProps = {
19
+ description,
20
+ id,
21
+ value,
22
+ icon: icon ? (fieldIcons[icon] as IconTypes) : undefined,
23
+ placeholder: name ?? description,
24
+ }
25
+ switch (type) {
26
+ case 'number':
27
+ return (
28
+ <FieldDivider key={id}>
29
+ <NumberField {...baseProps} />
30
+ </FieldDivider>
31
+ )
32
+ case 'text':
33
+ case 'string':
34
+ return (
35
+ <FieldDivider key={id}>
36
+ <TextField {...baseProps} />
37
+ </FieldDivider>
38
+ )
39
+ case 'select':
40
+ return (
41
+ <FieldDivider key={id}>
42
+ <SelectField {...baseProps} options={options} />
43
+ </FieldDivider>
44
+ )
45
+ case 'switch':
46
+ return (
47
+ <FieldDivider key={id}>
48
+ <SwitchField {...baseProps} />
49
+ </FieldDivider>
50
+ )
51
+ default:
52
+ return null
53
+ }
54
+ })}
55
+ </Stack>
56
+ )
57
+ }
@@ -6,10 +6,9 @@ import { FieldWithDeleteI } from '@/interfaces'
6
6
  export const FieldWithDelete = ({
7
7
  children,
8
8
  id,
9
- isAlwaysVisible,
9
+ canBeHidden = true,
10
10
  onRemove = () => {},
11
11
  }: PropsWithChildren<FieldWithDeleteI>) => {
12
- const isUndefined = isAlwaysVisible === undefined
13
12
  return (
14
13
  <Flex
15
14
  align="center"
@@ -18,7 +17,7 @@ export const FieldWithDelete = ({
18
17
  p="base"
19
18
  >
20
19
  {children}
21
- {!isUndefined && (
20
+ {canBeHidden && (
22
21
  <IconButton
23
22
  aria-label="Remove field"
24
23
  variant="unstyled"
@@ -3,9 +3,14 @@ import { GroupFieldI } from '@/interfaces'
3
3
  import { FieldWithDelete } from '@/components'
4
4
  import { SingleFields } from './SingleFields'
5
5
 
6
- export const GroupField = ({ id, fields, onRemove, visible }: GroupFieldI) => {
6
+ export const GroupField = ({
7
+ id,
8
+ fields,
9
+ onRemove,
10
+ canBeHidden,
11
+ }: GroupFieldI) => {
7
12
  return (
8
- <FieldWithDelete id={id} onRemove={onRemove} isAlwaysVisible={visible}>
13
+ <FieldWithDelete id={id} onRemove={onRemove} canBeHidden={canBeHidden}>
9
14
  <Stack spacing="base" flex="1">
10
15
  <SingleFields fields={fields} />
11
16
  </Stack>
@@ -1,5 +1,5 @@
1
1
  export * from './fields'
2
2
  export * from './DynamicForm'
3
- export * from './DynamicFormSimple'
3
+ export * from './SimpleDynamicForm'
4
4
  export * from './HiddenField'
5
5
  export * from './HiddenFieldSection'
@@ -16,8 +16,11 @@ import {
16
16
  } from '@/assets/images'
17
17
  import { useState } from 'react'
18
18
 
19
- export const ApplianceSteps = ({ onClick }: ApplianceStepsI) => {
20
- const [appliances, setAppliances] = useState<string[]>([])
19
+ export const ApplianceSteps = ({
20
+ addedAppliances = [],
21
+ onClick,
22
+ }: ApplianceStepsI) => {
23
+ const [appliances, setAppliances] = useState<string[]>(addedAppliances)
21
24
  const handleClick = (id: string) => {
22
25
  if (appliances.includes(id)) {
23
26
  const newAppliances = appliances.filter((appliance) => appliance !== id)
@@ -1,4 +1,5 @@
1
1
  import { PropsWithChildren } from 'react'
2
+ import { FormProvider } from 'react-hook-form'
2
3
  import { t } from 'i18next'
3
4
  import {
4
5
  DrawerContent,
@@ -11,13 +12,14 @@ import {
11
12
  import { IA } from '@/assets/images'
12
13
  import {
13
14
  ApplianceSteps,
14
- DynamicFormSimple,
15
+ SimpleDynamicForm,
15
16
  FooterButtons,
16
17
  HomeAssistantPanelStep,
17
18
  PanelHeader,
18
19
  } from '@/components'
19
20
  import { HomeAssistantPanelI } from '@/interfaces'
20
21
  import { homeAssistantSteps } from '@/helpers'
22
+ import { useSimpleDynamicForm } from '@/hooks'
21
23
 
22
24
  export const HomeAssistantPanel = ({
23
25
  children,
@@ -27,10 +29,17 @@ export const HomeAssistantPanel = ({
27
29
  onBack,
28
30
  onClose,
29
31
  onNext,
32
+ onSave,
33
+ backDisabled,
34
+ nextDisabled,
30
35
  }: PropsWithChildren<HomeAssistantPanelI>) => {
31
36
  const { title } = homeAssistantSteps[currentStep - 1]
32
37
  const text = `${t('homeAssistant.details')} ${title.toLowerCase()}:`
33
38
  const isAppliances = currentStep === 3
39
+ const { form, updatedFields } = useSimpleDynamicForm({
40
+ fields: currentForm,
41
+ })
42
+
34
43
  return (
35
44
  <DrawerContent bg="lightBlue.1">
36
45
  <DrawerHeader p="0">
@@ -48,7 +57,9 @@ export const HomeAssistantPanel = ({
48
57
  <Text fontFamily="secondary" fontSize="sm">
49
58
  {text}
50
59
  </Text>
51
- <DynamicFormSimple form={currentForm} />
60
+ <FormProvider {...form}>
61
+ <SimpleDynamicForm fields={currentForm} />
62
+ </FormProvider>
52
63
  </Stack>
53
64
  </DrawerBody>
54
65
  <DrawerFooter px="0" py="6" bg="neutral.white">
@@ -57,16 +68,18 @@ export const HomeAssistantPanel = ({
57
68
  buttonStyle: 'secondaryFooter',
58
69
  label: t('buttons.back'),
59
70
  onClick: onBack,
71
+ isDisabled: backDisabled,
60
72
  }}
61
73
  button2={{
62
74
  buttonStyle: 'primaryFooter',
63
- label: t('buttons.next'),
64
- onClick: onNext,
75
+ label: t('buttons.saveStep'),
76
+ onClick: () => onSave(updatedFields),
65
77
  }}
66
78
  button3={{
67
- buttonStyle: 'secondaryFooter',
68
- label: t('buttons.cancel'),
69
- onClick: onClose,
79
+ buttonStyle: 'primaryFooter',
80
+ label: t('buttons.next'),
81
+ onClick: onNext,
82
+ isDisabled: nextDisabled,
70
83
  }}
71
84
  />
72
85
  </DrawerFooter>
@@ -263,6 +263,9 @@ export const HomeBoard = () => {
263
263
  onBack={handleHomeAssistantBack}
264
264
  onApplianceClick={() => null}
265
265
  onClose={onRightClose}
266
+ onSave={() => {}}
267
+ backDisabled={false}
268
+ nextDisabled={false}
266
269
  />
267
270
  ),
268
271
  }
@@ -29,6 +29,7 @@ export const HomeCardWithRecipent = ({
29
29
  recipients,
30
30
  records = {},
31
31
  disabled,
32
+ propertyDisabled
32
33
  }: HomeCardWithRecipentI) => {
33
34
  const {
34
35
  isRightOpen,
@@ -60,6 +61,19 @@ export const HomeCardWithRecipent = ({
60
61
  },
61
62
  ]
62
63
 
64
+ const noPropertyTabs = [
65
+ {
66
+ label: t('homeBoard.tabs.tab2'),
67
+ component: (
68
+ <HomeCardRecipients
69
+ recipients={recipients}
70
+ menu={menu}
71
+ onEditClick={handleEditAccountType}
72
+ />
73
+ ),
74
+ }
75
+ ]
76
+
63
77
  return (
64
78
  <Container variant="launchpad">
65
79
  <HomeCard
@@ -77,7 +91,7 @@ export const HomeCardWithRecipent = ({
77
91
  edit={!disabled}
78
92
  />
79
93
 
80
- <TabsHeader tabList={tabs} />
94
+ <TabsHeader tabList={propertyDisabled ? noPropertyTabs : tabs} />
81
95
 
82
96
  <RightPanel isOpen={isRightOpen} onClose={onRightClose} size={panelSize}>
83
97
  <EditAccountType
@@ -1,6 +1,11 @@
1
1
  import { t } from 'i18next'
2
2
  import { Box, Container, Text, Center, Button } from '@chakra-ui/react'
3
- import { Logo, WelcomeHeader, ButtonLoader } from '@/components'
3
+ import {
4
+ Logo,
5
+ WelcomeHeader,
6
+ ButtonLoader,
7
+ BasePageWrapper,
8
+ } from '@/components'
4
9
  import { ActivateAccountI } from '@/interfaces'
5
10
  import { useWindowDimensions } from '@/hooks'
6
11
 
@@ -14,7 +19,7 @@ export const ActivateAccount = ({
14
19
  } = useWindowDimensions()
15
20
 
16
21
  return (
17
- <Box w="container.full" zIndex="2" position="relative">
22
+ <BasePageWrapper>
18
23
  <Container size="validation" boxShadow="lg">
19
24
  <Container variant="secondary">
20
25
  <Logo />
@@ -47,6 +52,6 @@ export const ActivateAccount = ({
47
52
  </Center>
48
53
  </Container>
49
54
  </Container>
50
- </Box>
55
+ </BasePageWrapper>
51
56
  )
52
57
  }
@@ -0,0 +1,10 @@
1
+ import { Box } from '@chakra-ui/react'
2
+ import { PropsWithChildren } from 'react'
3
+
4
+ export const BasePageWrapper = ({ children }: PropsWithChildren) => {
5
+ return (
6
+ <Box w="container.full" zIndex="2" position="relative" mt="onboarding.top">
7
+ {children}
8
+ </Box>
9
+ )
10
+ }
@@ -8,7 +8,7 @@ import {
8
8
  Center,
9
9
  Button,
10
10
  } from '@chakra-ui/react'
11
- import { Logo, ButtonLoader } from '@/components'
11
+ import { Logo, ButtonLoader, BasePageWrapper } from '@/components'
12
12
  import { EmailValidationI } from '@/interfaces'
13
13
  import { Confirmation } from '@/assets/images'
14
14
 
@@ -18,7 +18,7 @@ export const EmailValidation = ({
18
18
  handleResendBt,
19
19
  }: EmailValidationI) => {
20
20
  return (
21
- <Box w="container.full" zIndex="2" position="relative">
21
+ <BasePageWrapper>
22
22
  <Container size="validation" boxShadow="lg">
23
23
  <Container variant="secondary">
24
24
  <Logo />
@@ -64,6 +64,6 @@ export const EmailValidation = ({
64
64
  </Button>
65
65
  </Center>
66
66
  </Container>
67
- </Box>
67
+ </BasePageWrapper>
68
68
  )
69
69
  }
@@ -1,6 +1,12 @@
1
1
  import { t } from 'i18next'
2
2
  import { Box, Button, Text, Container, Stack, chakra } from '@chakra-ui/react'
3
- import { Logo, Footer, ButtonLoader, PasswordInput } from '@/components'
3
+ import {
4
+ Logo,
5
+ Footer,
6
+ ButtonLoader,
7
+ PasswordInput,
8
+ BasePageWrapper,
9
+ } from '@/components'
4
10
  import { isValidPassword, passwordMatch } from '@/utils'
5
11
  import { useNewPassword } from '@/hooks'
6
12
  import { NewPasswordI } from '@/interfaces'
@@ -13,7 +19,7 @@ export const NewPassword = ({
13
19
  const { inputs, handleInputChange, handleSubmit, isValidated } =
14
20
  useNewPassword(handleReset)
15
21
  return (
16
- <Box w="container.full" zIndex="2" position="relative">
22
+ <BasePageWrapper>
17
23
  <Container size="onboarding" boxShadow="lg">
18
24
  <Logo />
19
25
  <Container variant="ghost" mt={4} mb={6}>
@@ -82,6 +88,6 @@ export const NewPassword = ({
82
88
  </Box>
83
89
  </Container>
84
90
  <Footer />
85
- </Box>
91
+ </BasePageWrapper>
86
92
  )
87
93
  }
@@ -8,7 +8,7 @@ import {
8
8
  Center,
9
9
  Button,
10
10
  } from '@chakra-ui/react'
11
- import { ButtonLoader, Logo } from '@/components'
11
+ import { BasePageWrapper, ButtonLoader, Logo } from '@/components'
12
12
  import { EmailValidationI } from '@/interfaces'
13
13
  import { ResendPassword } from '@/assets/images'
14
14
 
@@ -18,7 +18,7 @@ export const ResendResetPassword = ({
18
18
  handleResendBt,
19
19
  }: EmailValidationI) => {
20
20
  return (
21
- <Box w="container.full" zIndex="2" position="relative">
21
+ <BasePageWrapper>
22
22
  <Container size="validation" boxShadow="lg">
23
23
  <Container variant="secondary">
24
24
  <Logo />
@@ -65,6 +65,6 @@ export const ResendResetPassword = ({
65
65
  </Button>
66
66
  </Center>
67
67
  </Container>
68
- </Box>
68
+ </BasePageWrapper>
69
69
  )
70
70
  }
@@ -7,6 +7,7 @@ import {
7
7
  CardFooter,
8
8
  TextInput,
9
9
  ButtonLoader,
10
+ BasePageWrapper,
10
11
  } from '@/components'
11
12
  import { isEmptyField, isValidEmail } from '@/utils'
12
13
  import { ResetPasswordI } from '@/interfaces'
@@ -25,7 +26,7 @@ export const ResetPassword = ({
25
26
  ? t('forms.errorEmailNotActivated')
26
27
  : t('forms.errorEmail')
27
28
  return (
28
- <Box w="container.full" zIndex="2" position="relative">
29
+ <BasePageWrapper>
29
30
  <Container size="onboarding" boxShadow="lg">
30
31
  <Logo />
31
32
  <PageTitle title={t('reset.title')} />
@@ -72,6 +73,6 @@ export const ResetPassword = ({
72
73
  />
73
74
  </Container>
74
75
  <Footer />
75
- </Box>
76
+ </BasePageWrapper>
76
77
  )
77
78
  }
@@ -8,6 +8,7 @@ import {
8
8
  PasswordInput,
9
9
  TextInput,
10
10
  ButtonLoader,
11
+ BasePageWrapper,
11
12
  } from '@/components'
12
13
  import { isEmptyField } from '@/utils'
13
14
  import { SignInI } from '@/interfaces'
@@ -25,14 +26,13 @@ export const SignIn = ({
25
26
  useSignIn(values)
26
27
 
27
28
  return (
28
- <Box w="container.full" mt="onboarding.top" zIndex="2" position="relative">
29
+ <BasePageWrapper>
29
30
  <Container size="onboarding" boxShadow="lg">
30
31
  <Logo />
31
32
  <PageTitle title={t('signin.title')} />
32
33
  <Box px={['container.sm', 'container.md', 'container.lg']} mb={6}>
33
34
  <Stack spacing={8}>
34
35
  <Stack spacing="base" as="form">
35
-
36
36
  <TextInput
37
37
  autoCapitalize="none"
38
38
  autoCorrect="off"
@@ -71,7 +71,6 @@ export const SignIn = ({
71
71
  handleInputChange(event)
72
72
  }}
73
73
  />
74
-
75
74
  </Stack>
76
75
  <Stack spacing={4}>
77
76
  <Button
@@ -104,6 +103,6 @@ export const SignIn = ({
104
103
  />
105
104
  </Container>
106
105
  <Footer />
107
- </Box>
106
+ </BasePageWrapper>
108
107
  )
109
108
  }
@@ -8,6 +8,7 @@ import {
8
8
  PasswordInput,
9
9
  TextInput,
10
10
  ButtonLoader,
11
+ BasePageWrapper,
11
12
  } from '@/components'
12
13
  import { SignUpI } from '@/interfaces'
13
14
  import {
@@ -45,7 +46,7 @@ export const SignUp = ({
45
46
  })
46
47
 
47
48
  return (
48
- <Box w="container.full" mt="onboarding.top" zIndex="2" position="relative">
49
+ <BasePageWrapper>
49
50
  <Container size="onboarding" boxShadow="lg">
50
51
  <Logo />
51
52
  <PageTitle title={t('signup.title')} />
@@ -58,7 +59,7 @@ export const SignUp = ({
58
59
  placeholder={t('forms.firstName')}
59
60
  value={inputs.firstName}
60
61
  handleChange={handleInputChange}
61
- autoComplete='given-name'
62
+ autoComplete="given-name"
62
63
  />
63
64
  <TextInput
64
65
  errorMessage={t('forms.lastName') + ' ' + t('forms.required')}
@@ -67,7 +68,7 @@ export const SignUp = ({
67
68
  placeholder={t('forms.lastName')}
68
69
  value={inputs.lastName}
69
70
  handleChange={handleInputChange}
70
- autoComplete='family-name'
71
+ autoComplete="family-name"
71
72
  />
72
73
  <TextInput
73
74
  autoCapitalize="none"
@@ -81,7 +82,7 @@ export const SignUp = ({
81
82
  placeholder={t('forms.email')}
82
83
  value={inputs.email}
83
84
  handleChange={handleInputChange}
84
- autoComplete='email'
85
+ autoComplete="email"
85
86
  />
86
87
  {showPromoCode && (
87
88
  <TextInput
@@ -91,7 +92,7 @@ export const SignUp = ({
91
92
  placeholder={t('forms.promoCode')}
92
93
  value={inputs.promoCode ?? ''}
93
94
  handleChange={handleInputChange}
94
- autoComplete='off'
95
+ autoComplete="off"
95
96
  />
96
97
  )}
97
98
  <Text textAlign="center" variant="caption">
@@ -108,7 +109,7 @@ export const SignUp = ({
108
109
  placeholder={t('forms.password')}
109
110
  value={inputs.password ?? ''}
110
111
  handleChange={(event) => handleInputChange(event)}
111
- autoComplete='new-password'
112
+ autoComplete="new-password"
112
113
  />
113
114
  <PasswordInput
114
115
  errorMessage={passwordErrorMessage(inputs.confirmPassword)}
@@ -121,7 +122,7 @@ export const SignUp = ({
121
122
  placeholder={t('forms.passwordConfirm')}
122
123
  value={inputs.confirmPassword ?? ''}
123
124
  handleChange={(event) => handleInputChange(event)}
124
- autoComplete='new-password'
125
+ autoComplete="new-password"
125
126
  />
126
127
  <Center
127
128
  px={['container.sm', 'container.md', 'container.lg']}
@@ -150,6 +151,6 @@ export const SignUp = ({
150
151
  />
151
152
  </Container>
152
153
  <Footer />
153
- </Box>
154
+ </BasePageWrapper>
154
155
  )
155
156
  }