@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
@@ -5,6 +5,17 @@ import Lowes from './lowes.png'
5
5
  import Walmart from './walmart.png'
6
6
  import Prime from './prime.png'
7
7
  import Sears from './sears.png'
8
+ import Shine from './shine.png'
8
9
  import Terminix from './terminix.png'
9
10
 
10
- export { APHW, HomeDepot, Homefile, Lowes, Walmart, Prime, Sears, Terminix }
11
+ export {
12
+ APHW,
13
+ HomeDepot,
14
+ Homefile,
15
+ Lowes,
16
+ Walmart,
17
+ Prime,
18
+ Sears,
19
+ Shine,
20
+ Terminix,
21
+ }
@@ -0,0 +1,15 @@
1
+ import GutterCleaning from './gutter-cleaning.png'
2
+ import HomeCleaning from './home-cleaning.png'
3
+ import HolidayLights from './holiday-lights.png'
4
+ import Pressure from './pressure.png'
5
+ import RoofCleaning from './roof-cleaning.png'
6
+ import WindowCleaning from './window.png'
7
+
8
+ export {
9
+ GutterCleaning,
10
+ HomeCleaning,
11
+ HolidayLights,
12
+ Pressure,
13
+ RoofCleaning,
14
+ WindowCleaning,
15
+ }
@@ -109,7 +109,8 @@
109
109
  "previous": "Previous",
110
110
  "save": "Save",
111
111
  "send": "Send",
112
- "skip": "Skip for now"
112
+ "skip": "Skip for now",
113
+ "saveStep": "Save Step"
113
114
  },
114
115
  "createDocument": {
115
116
  "tabs": {
@@ -139,11 +140,20 @@
139
140
  },
140
141
  "contacts": {
141
142
  "addBtn": "Contact",
143
+ "addContact": "Add Contact",
144
+ "companyInfo": "Company Info",
145
+ "contactView": "View Contact",
146
+ "details": "Details",
147
+ "editContact": "Edit Contact",
142
148
  "error": "Email should be from a valid Homefile account",
149
+ "homeAddress": "Home Address",
150
+ "notes": "Notes",
143
151
  "shareContact": "Share Contact",
152
+ "permissions": "Permissions",
144
153
  "placeholders": {
145
154
  "email": "Enter Email"
146
155
  },
156
+ "rating": "Homeowner Rating",
147
157
  "title": "Contacts"
148
158
  },
149
159
  "daysOfWeek": {
@@ -601,6 +611,18 @@
601
611
  },
602
612
  "needImage": "Need image",
603
613
  "noResults": "No results found",
614
+ "shine": {
615
+ "heroTitle": "We do windows and so much more!",
616
+ "scheduleService": "Schedule a Service",
617
+ "services": {
618
+ "home": "Home Cleaning",
619
+ "lights": "Holiday Lights",
620
+ "gutter": "Gutter Cleaning",
621
+ "roof": "Roof Cleaning",
622
+ "pressure": "Pressure Washing",
623
+ "window": "Window Cleaning"
624
+ }
625
+ },
604
626
  "tabs": {
605
627
  "code": "Code",
606
628
  "content": "Content",
@@ -89,11 +89,12 @@ export const CloudsAnimation = ({ children }: PropsWithChildren<{}>) => {
89
89
  position="relative"
90
90
  bgGradient={colors.skyGradient}
91
91
  overflowX="hidden"
92
+ overflowY="scroll"
92
93
  >
93
94
  {children}
94
95
  <Image
95
96
  src={Cloud1}
96
- position="absolute"
97
+ position="fixed"
97
98
  w="auto"
98
99
  h="80px"
99
100
  top="50px"
@@ -102,7 +103,7 @@ export const CloudsAnimation = ({ children }: PropsWithChildren<{}>) => {
102
103
  />
103
104
  <Image
104
105
  src={Cloud2}
105
- position="absolute"
106
+ position="fixed"
106
107
  w="auto"
107
108
  h="120px"
108
109
  top="80px"
@@ -111,7 +112,7 @@ export const CloudsAnimation = ({ children }: PropsWithChildren<{}>) => {
111
112
  />
112
113
  <Image
113
114
  src={Cloud3}
114
- position="absolute"
115
+ position="fixed"
115
116
  w="auto"
116
117
  h="160px"
117
118
  top="120px"
@@ -120,7 +121,7 @@ export const CloudsAnimation = ({ children }: PropsWithChildren<{}>) => {
120
121
  />
121
122
  <Image
122
123
  src={Cloud1}
123
- position="absolute"
124
+ position="fixed"
124
125
  w="auto"
125
126
  h="100px"
126
127
  top="160px"
@@ -129,7 +130,7 @@ export const CloudsAnimation = ({ children }: PropsWithChildren<{}>) => {
129
130
  />
130
131
  <Image
131
132
  src={Cloud2}
132
- position="absolute"
133
+ position="fixed"
133
134
  w="auto"
134
135
  h="112px"
135
136
  top="220px"
@@ -138,7 +139,7 @@ export const CloudsAnimation = ({ children }: PropsWithChildren<{}>) => {
138
139
  />
139
140
  <Image
140
141
  src={Cloud3}
141
- position="absolute"
142
+ position="fixed"
142
143
  w="auto"
143
144
  h="160px"
144
145
  top="300px"
@@ -147,7 +148,7 @@ export const CloudsAnimation = ({ children }: PropsWithChildren<{}>) => {
147
148
  />
148
149
  <Image
149
150
  src={Airplane}
150
- position="absolute"
151
+ position="fixed"
151
152
  w="auto"
152
153
  h="40px"
153
154
  top="85px"
@@ -12,41 +12,44 @@ export const ContactCard = ({
12
12
  contact,
13
13
  index,
14
14
  menuItems,
15
+ onClick,
15
16
  onShare,
16
17
  }: ContactCardI) => {
17
- const {
18
- address,
19
- city,
20
- state,
21
- zip,
22
- company,
23
- email,
24
- firstName,
25
- lastName,
26
- phone,
27
- } = contact
18
+ const hasOnClick = typeof onClick === 'function'
28
19
  return (
29
- <Container maxW={'none'}>
30
- <Stack pb="base" px="base">
20
+ <Container
21
+ maxW="none"
22
+ textAlign="start"
23
+ onClick={() => onClick?.({ ...contact, index })}
24
+ transition="background-color 0.3s"
25
+ _hover={{
26
+ bg: hasOnClick ? 'lightGreen.1' : 'transparent',
27
+ }}
28
+ cursor={hasOnClick ? 'pointer' : 'default'}
29
+ >
30
+ <Stack pb="base" pt="1" px="base" spacing="base">
31
31
  <ContactCardHeader
32
32
  apiError={apiError}
33
33
  contact={contact}
34
34
  menuItems={menuItems}
35
35
  onShare={onShare}
36
36
  />
37
- <Flex justify="space-between" align="stretch" gap="base">
38
- <ContactCardInfo
39
- {...{ company, email, firstName, lastName, phone, index }}
40
- />
41
- <Box
42
- borderLeft={`1px solid ${colors.lightBlue[1]}`}
43
- w="45%"
44
- pl="base"
45
- >
46
- <ContactCardAddress {...{ company, address, city, state, zip }} />
47
- </Box>
48
- </Flex>
37
+ <CardBody {...{ contact, index }} />
49
38
  </Stack>
50
39
  </Container>
51
40
  )
52
41
  }
42
+
43
+ const CardBody = ({
44
+ contact,
45
+ index,
46
+ }: Pick<ContactCardI, 'contact' | 'index'>) => {
47
+ return (
48
+ <Flex justify="space-between" align="stretch" gap="base">
49
+ <ContactCardInfo {...{ ...contact, index }} />
50
+ <Box borderLeft={`1px solid ${colors.lightBlue[1]}`} w="45%" pl="base">
51
+ <ContactCardAddress {...contact} />
52
+ </Box>
53
+ </Flex>
54
+ )
55
+ }
@@ -1,22 +1,11 @@
1
1
  import { t } from 'i18next'
2
- import { Flex, IconButton, Image, Text, useDisclosure } from '@chakra-ui/react'
2
+ import { Flex, Image, Text } from '@chakra-ui/react'
3
3
  import { Contacts } from '@/assets/images'
4
- import {
5
- IconMenu,
6
- MoreHorizontal,
7
- ShareContactPopover,
8
- ShareIcon,
9
- } from '@/components'
4
+ import { ContactHeaderMenu } from '@/components'
10
5
  import { ContactCardHeaderI } from '@/interfaces'
11
6
 
12
- export const ContactCardHeader = ({
13
- apiError,
14
- contact,
15
- menuItems,
16
- onShare,
17
- }: ContactCardHeaderI) => {
18
- const { category, title } = contact
19
- const { isOpen, onOpen, onClose } = useDisclosure()
7
+ export const ContactCardHeader = (props: ContactCardHeaderI) => {
8
+ const { category, title } = props.contact
20
9
  return (
21
10
  <Flex align="center" justify="space-between">
22
11
  <Flex align="center" gap="base">
@@ -35,29 +24,7 @@ export const ContactCardHeader = ({
35
24
  <Text fontSize="xs">{title.toUpperCase()}</Text>
36
25
  </Flex>
37
26
  </Flex>
38
- <Flex align="center" position="relative" gap="base" py="base">
39
- <IconButton
40
- aria-label="share"
41
- variant="menuIcon"
42
- icon={<ShareIcon size={18} />}
43
- onClick={onOpen}
44
- w="fit-content"
45
- />
46
- <ShareContactPopover
47
- apiError={apiError}
48
- contact={contact}
49
- isOpen={isOpen}
50
- onClose={onClose}
51
- onShare={onShare}
52
- />
53
-
54
- <IconMenu
55
- icon={<MoreHorizontal size={32} />}
56
- itemForm={contact}
57
- menuItems={menuItems}
58
- disabled={menuItems.length < 1}
59
- />
60
- </Flex>
27
+ <ContactHeaderMenu {...props} />
61
28
  </Flex>
62
29
  )
63
30
  }
@@ -0,0 +1,42 @@
1
+ import { Flex, IconButton, useDisclosure } from '@chakra-ui/react'
2
+ import {
3
+ ShareIcon,
4
+ MoreHorizontal,
5
+ IconMenu,
6
+ ShareContactPopover,
7
+ } from '@/components'
8
+ import { ContactCardHeaderI } from '@/interfaces'
9
+
10
+ export const ContactHeaderMenu = ({
11
+ apiError,
12
+ contact,
13
+ menuItems,
14
+ onShare,
15
+ }: ContactCardHeaderI) => {
16
+ const { isOpen, onOpen, onClose } = useDisclosure()
17
+ return (
18
+ <Flex align="center" position="relative" gap="base">
19
+ <IconButton
20
+ aria-label="share"
21
+ variant="menuIcon"
22
+ icon={<ShareIcon size={18} />}
23
+ onClick={onOpen}
24
+ w="fit-content"
25
+ />
26
+ <ShareContactPopover
27
+ apiError={apiError}
28
+ contact={contact}
29
+ isOpen={isOpen}
30
+ onClose={onClose}
31
+ onShare={onShare}
32
+ />
33
+
34
+ <IconMenu
35
+ icon={<MoreHorizontal size={32} />}
36
+ itemForm={contact}
37
+ menuItems={menuItems}
38
+ disabled={menuItems.length < 1}
39
+ />
40
+ </Flex>
41
+ )
42
+ }
@@ -24,6 +24,7 @@ export const ContactsContent = ({
24
24
  children,
25
25
  handleAdd,
26
26
  disabled,
27
+ onClick,
27
28
  onShare,
28
29
  }: ContactsContentI) => {
29
30
  const { filteredContacts, handleChange, search } =
@@ -58,7 +59,7 @@ export const ContactsContent = ({
58
59
  />
59
60
  </Flex>
60
61
  </DrawerHeader>
61
- <DrawerBody p="0">
62
+ <DrawerBody p="0" overflowX="hidden">
62
63
  <Stack spacing="2" p="base" bg="lightBlue.2" minHeight="full">
63
64
  {filteredContacts.map((contact, idx) => (
64
65
  <ContactCard
@@ -66,6 +67,7 @@ export const ContactsContent = ({
66
67
  key={contact._id}
67
68
  contact={contact}
68
69
  menuItems={menuItems}
70
+ onClick={onClick}
69
71
  onShare={onShare}
70
72
  index={idx}
71
73
  />
@@ -0,0 +1,63 @@
1
+ import { t } from 'i18next'
2
+ import {
3
+ DrawerContent,
4
+ DrawerHeader,
5
+ DrawerBody,
6
+ Flex,
7
+ Box,
8
+ Text,
9
+ } from '@chakra-ui/react'
10
+ import { BackCircleButton, PanelHeader, TabsHeader } from '@/components'
11
+ import { Contacts } from '@/assets/images'
12
+ import { AddEditContactPanelI } from '@/interfaces'
13
+ import { dynamicFormProxy } from '@/proxies'
14
+ import { useSnapshot } from 'valtio'
15
+
16
+ export const AddEditContactPanel = ({
17
+ detailsComponent,
18
+ isEditing,
19
+ onBackClick,
20
+ permissionsComponent,
21
+ }: AddEditContactPanelI) => {
22
+ const { fields } = useSnapshot(dynamicFormProxy)
23
+ const name = fields?.[0]?.children?.[0].children
24
+ const fullName = `${name?.[0].value} ${name?.[1].value}`
25
+ const tabs = [
26
+ {
27
+ label: t('contacts.details'),
28
+ component: detailsComponent,
29
+ },
30
+ {
31
+ label: t('contacts.permissions'),
32
+ component: permissionsComponent,
33
+ },
34
+ ]
35
+ return (
36
+ <DrawerContent bg="lightBlue.1">
37
+ <DrawerHeader p="0">
38
+ <PanelHeader
39
+ handleCloseButton={() => null}
40
+ icon={Contacts}
41
+ title={
42
+ isEditing ? t('contacts.editContact') : t('contacts.addContact')
43
+ }
44
+ />
45
+ <Flex align="center" gap="base" bg="lightBlue.2" p="base">
46
+ <BackCircleButton onClick={onBackClick} />
47
+ <Box
48
+ borderLeft="solid"
49
+ borderWidth="1px"
50
+ borderColor="lightBlue.6"
51
+ h="1.75rem"
52
+ />
53
+ <Text fontSize="lg" fontWeight="medium" isTruncated>
54
+ {fullName}
55
+ </Text>
56
+ </Flex>
57
+ </DrawerHeader>
58
+ <DrawerBody p="0" overflowX="hidden" position="relative">
59
+ <TabsHeader tabList={tabs} />
60
+ </DrawerBody>
61
+ </DrawerContent>
62
+ )
63
+ }
@@ -0,0 +1 @@
1
+ export * from './AddEditContactPanel'
@@ -1,7 +1,10 @@
1
+ export * from './addEditPanel'
1
2
  export * from './shareContactForms'
3
+ export * from './viewPanel'
2
4
  export * from './ContactCard'
3
5
  export * from './ContactCardAddress'
4
6
  export * from './ContactCardHeader'
5
7
  export * from './ContactCardInfo'
8
+ export * from './ContactHeaderMenu'
6
9
  export * from './ContactsContent'
7
10
  export * from './ShareContactPopover'
@@ -0,0 +1,58 @@
1
+ import { t } from 'i18next'
2
+ import { Box, Center, Flex, Stack, Text, Image } from '@chakra-ui/react'
3
+ import { ViewContactPanelI } from '@/interfaces'
4
+ import { getImageAltText } from '@/utils'
5
+ import { Location } from '@/assets/images'
6
+ import { CompanyRating } from './CompanyRating'
7
+
8
+ export const CompanyInfoCard = ({
9
+ contact,
10
+ }: Pick<ViewContactPanelI, 'contact'>) => {
11
+ if (!contact.companyInfo) return null
12
+ const { company, phone, url, address, city, state, zip, rating } =
13
+ contact.companyInfo
14
+ const alt = getImageAltText(Location)
15
+ return (
16
+ <Box position="relative">
17
+ <CompanyRating
18
+ contact={contact}
19
+ position="absolute"
20
+ top="0"
21
+ right="0"
22
+ zIndex="1"
23
+ />
24
+ <Stack spacing="base">
25
+ <Text textTransform="uppercase" fontSize="xs">
26
+ {t('contacts.companyInfo')}
27
+ </Text>
28
+ <Flex gap="base" minH="50px">
29
+ <Center h="78px" w="78px">
30
+ <Image src={Location} alt={alt} />
31
+ </Center>
32
+ <Stack spacing="6">
33
+ <Stack spacing="0.5">
34
+ <Text fontWeight="bold" fontSize="lg">
35
+ {company}
36
+ </Text>
37
+ <Box>
38
+ <Text fontSize="sm">{phone}</Text>
39
+ <Text variant="email" lineHeight="1" fontSize="sm">
40
+ {url}
41
+ </Text>
42
+ </Box>
43
+ </Stack>
44
+ <Box>
45
+ <Text fontSize="xs" lineHeight="16px">
46
+ {address}
47
+ </Text>
48
+ <Text
49
+ fontSize="xs"
50
+ lineHeight="16px"
51
+ >{`${city}, ${state} ${zip}`}</Text>
52
+ </Box>
53
+ </Stack>
54
+ </Flex>
55
+ </Stack>
56
+ </Box>
57
+ )
58
+ }
@@ -0,0 +1,27 @@
1
+ import { t } from 'i18next'
2
+ import { StackProps, Flex, Stack, Text } from '@chakra-ui/react'
3
+ import { Star } from '@/components'
4
+ import { ViewContactPanelI } from '@/interfaces'
5
+ import { colors } from '@/theme/colors'
6
+
7
+ export const CompanyRating = ({
8
+ contact,
9
+ ...props
10
+ }: Pick<ViewContactPanelI, 'contact'> & StackProps) => {
11
+ if (!contact.companyInfo?.rating) return null
12
+ const { rating, _id } = contact.companyInfo
13
+ return (
14
+ <Stack spacing="0" align="end" {...props}>
15
+ <Text textTransform="uppercase" fontSize="10px">
16
+ {t('contacts.rating')}
17
+ </Text>
18
+ <Flex align="center" gap="1">
19
+ {Array.from({ length: 5 }).map((_, index) => {
20
+ const starColor =
21
+ rating >= index ? colors.yellow['1'] : colors.gray['1']
22
+ return <Star key={`${_id}-${index}`} stroke={starColor} size={13} />
23
+ })}
24
+ </Flex>
25
+ </Stack>
26
+ )
27
+ }
@@ -0,0 +1,39 @@
1
+ import { t } from 'i18next'
2
+ import { Box, Center, Flex, Stack, Text, Image } from '@chakra-ui/react'
3
+ import { ViewContactPanelI } from '@/interfaces'
4
+ import { getImageAltText } from '@/utils'
5
+ import { Location } from '@/assets/images'
6
+
7
+ export const ContactAddressCard = ({
8
+ contact,
9
+ }: Pick<ViewContactPanelI, 'contact'>) => {
10
+ if (!contact) return null
11
+ const { address, city, state, zip, lastName } = contact
12
+ const alt = getImageAltText(Location)
13
+ return (
14
+ <Stack spacing="base">
15
+ <Text textTransform="uppercase" fontSize="xs">
16
+ {t('contacts.homeAddress')}
17
+ </Text>
18
+ <Flex gap="base" minH="50px">
19
+ <Center h="78px" w="78px">
20
+ <Image src={Location} alt={alt} />
21
+ </Center>
22
+ <Stack spacing="base">
23
+ <Text fontWeight="bold" fontSize="lg">
24
+ {`${lastName}s Home`}
25
+ </Text>
26
+ <Box>
27
+ <Text fontSize="xs" lineHeight="16px">
28
+ {address}
29
+ </Text>
30
+ <Text
31
+ fontSize="xs"
32
+ lineHeight="16px"
33
+ >{`${city}, ${state} ${zip}`}</Text>
34
+ </Box>
35
+ </Stack>
36
+ </Flex>
37
+ </Stack>
38
+ )
39
+ }
@@ -0,0 +1,16 @@
1
+ import { t } from 'i18next'
2
+ import { Stack, Text } from '@chakra-ui/react'
3
+
4
+ export const ContactNotes = ({ notes = '' }) => {
5
+ if (!notes) return null
6
+ return (
7
+ <Stack spacing="base">
8
+ <Text textTransform="uppercase" fontSize="xs">
9
+ {t('contacts.notes')}
10
+ </Text>
11
+ <Text fontSize="sm" fontFamily="secondary" lineHeight="16px">
12
+ {notes}
13
+ </Text>
14
+ </Stack>
15
+ )
16
+ }
@@ -0,0 +1,41 @@
1
+ import { Box, Center, Flex, Stack, Text } from '@chakra-ui/react'
2
+ import { ContactCardInfoI } from '@/interfaces'
3
+ import { randomColor } from '@/utils'
4
+
5
+ export const PersonalInfoCard = ({
6
+ email,
7
+ firstName,
8
+ index,
9
+ lastName,
10
+ phone,
11
+ title,
12
+ }: ContactCardInfoI) => {
13
+ const name = `${firstName} ${lastName}`.trim()
14
+ const initials = firstName.charAt(0) + lastName.charAt(0)
15
+ return (
16
+ <Flex gap="base" minH="50px" align="center">
17
+ <Center h="78px" w="78px" bg={randomColor(index)}>
18
+ <Text
19
+ fontSize="36px"
20
+ fontWeight="extrabold"
21
+ fontFamily="primary"
22
+ color="neutral.white"
23
+ >
24
+ {initials}
25
+ </Text>
26
+ </Center>
27
+ <Stack spacing="0.5">
28
+ <Text fontWeight="bold" fontSize="xl">
29
+ {name}
30
+ </Text>
31
+ <Box>
32
+ <Text fontSize="sm">{title}</Text>
33
+ <Text fontSize="sm">{phone}</Text>
34
+ <Text variant="email" lineHeight="1" fontSize="sm">
35
+ {email}
36
+ </Text>
37
+ </Box>
38
+ </Stack>
39
+ </Flex>
40
+ )
41
+ }
@@ -0,0 +1,30 @@
1
+ import { homeRoles } from '@/helpers'
2
+ import { ViewContactPanelI } from '@/interfaces'
3
+ import { Box, Text } from '@chakra-ui/react'
4
+
5
+ export const RoleTag = ({ roleType }: Pick<ViewContactPanelI, 'roleType'>) => {
6
+ if (!roleType) return null
7
+ const { bg, name } = homeRoles[roleType]
8
+ return (
9
+ <Box
10
+ bg={bg}
11
+ px="base"
12
+ pt="2"
13
+ pb="6"
14
+ position="absolute"
15
+ top="0"
16
+ left="0"
17
+ right="0"
18
+ zIndex="-1"
19
+ >
20
+ <Text
21
+ color="neutral.white"
22
+ fontSize="sm"
23
+ fontWeight="bold"
24
+ textTransform="uppercase"
25
+ >
26
+ {name}
27
+ </Text>
28
+ </Box>
29
+ )
30
+ }