@homefile/components-v2 1.3.0 → 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.
- package/dist/assets/images/circle-face.svg +21 -0
- package/dist/assets/images/company.svg +34 -0
- package/dist/assets/images/index.d.ts +5 -1
- package/dist/assets/images/index.js +5 -1
- package/dist/assets/images/index.ts +7 -0
- package/dist/assets/images/location.jpg +0 -0
- package/dist/assets/images/logos/index.d.ts +2 -1
- package/dist/assets/images/logos/index.js +2 -1
- package/dist/assets/images/logos/index.ts +12 -1
- package/dist/assets/images/logos/shine.png +0 -0
- package/dist/assets/images/shine/gutter-cleaning.png +0 -0
- package/dist/assets/images/shine/holiday-lights.png +0 -0
- package/dist/assets/images/shine/home-cleaning.png +0 -0
- package/dist/assets/images/shine/index.d.ts +7 -0
- package/dist/assets/images/shine/index.js +7 -0
- package/dist/assets/images/shine/index.ts +15 -0
- package/dist/assets/images/shine/pressure.png +0 -0
- package/dist/assets/images/shine/roof-cleaning.png +0 -0
- package/dist/assets/images/shine/window.png +0 -0
- package/dist/assets/locales/en/index.json +23 -1
- package/dist/components/contacts/ContactCard.d.ts +1 -1
- package/dist/components/contacts/ContactCard.js +8 -3
- package/dist/components/contacts/ContactCardHeader.d.ts +1 -1
- package/dist/components/contacts/ContactCardHeader.js +5 -6
- package/dist/components/contacts/ContactHeaderMenu.d.ts +2 -0
- package/dist/components/contacts/ContactHeaderMenu.js +7 -0
- package/dist/components/contacts/ContactsContent.d.ts +1 -1
- package/dist/components/contacts/ContactsContent.js +2 -2
- package/dist/components/contacts/addEditPanel/AddEditContactPanel.d.ts +2 -0
- package/dist/components/contacts/addEditPanel/AddEditContactPanel.js +24 -0
- package/dist/components/contacts/addEditPanel/index.d.ts +1 -0
- package/dist/components/contacts/addEditPanel/index.js +1 -0
- package/dist/components/contacts/index.d.ts +3 -0
- package/dist/components/contacts/index.js +3 -0
- package/dist/components/contacts/viewPanel/CompanyInfoCard.d.ts +2 -0
- package/dist/components/contacts/viewPanel/CompanyInfoCard.js +13 -0
- package/dist/components/contacts/viewPanel/CompanyRating.d.ts +3 -0
- package/dist/components/contacts/viewPanel/CompanyRating.js +27 -0
- package/dist/components/contacts/viewPanel/ContactAddressCard.d.ts +2 -0
- package/dist/components/contacts/viewPanel/ContactAddressCard.js +12 -0
- package/dist/components/contacts/viewPanel/ContactNotes.d.ts +3 -0
- package/dist/components/contacts/viewPanel/ContactNotes.js +8 -0
- package/dist/components/contacts/viewPanel/PersonalInfoCard.d.ts +2 -0
- package/dist/components/contacts/viewPanel/PersonalInfoCard.js +8 -0
- package/dist/components/contacts/viewPanel/RoleTag.d.ts +2 -0
- package/dist/components/contacts/viewPanel/RoleTag.js +9 -0
- package/dist/components/contacts/viewPanel/ViewContactHeader.d.ts +2 -0
- package/dist/components/contacts/viewPanel/ViewContactHeader.js +11 -0
- package/dist/components/contacts/viewPanel/ViewContactPanel.d.ts +2 -0
- package/dist/components/contacts/viewPanel/ViewContactPanel.js +9 -0
- package/dist/components/contacts/viewPanel/index.d.ts +8 -0
- package/dist/components/contacts/viewPanel/index.js +8 -0
- package/dist/components/forms/dynamicForm/DynamicForm.d.ts +1 -1
- package/dist/components/forms/dynamicForm/DynamicForm.js +5 -5
- package/dist/components/forms/dynamicForm/SimpleDynamicForm.d.ts +2 -0
- package/dist/components/forms/dynamicForm/SimpleDynamicForm.js +29 -0
- package/dist/components/forms/dynamicForm/fields/FieldWithDelete.d.ts +1 -1
- package/dist/components/forms/dynamicForm/fields/FieldWithDelete.js +2 -3
- package/dist/components/forms/dynamicForm/fields/GroupField.d.ts +1 -1
- package/dist/components/forms/dynamicForm/fields/GroupField.js +2 -2
- package/dist/components/forms/dynamicForm/index.d.ts +1 -1
- package/dist/components/forms/dynamicForm/index.js +1 -1
- package/dist/components/homeAssistant/panel/ApplianceSteps.d.ts +1 -1
- package/dist/components/homeAssistant/panel/ApplianceSteps.js +2 -2
- package/dist/components/homeAssistant/panel/HomeAssistantPanel.d.ts +1 -1
- package/dist/components/homeAssistant/panel/HomeAssistantPanel.js +14 -7
- package/dist/components/homeBoard/HomeBoard.js +1 -1
- package/dist/components/homeBoard/HomeCardWithRecipent.d.ts +1 -1
- package/dist/components/homeBoard/HomeCardWithRecipent.js +8 -2
- package/dist/components/partner/customPartnerTiles/ShineTile.d.ts +2 -0
- package/dist/components/partner/customPartnerTiles/ShineTile.js +56 -0
- package/dist/components/partner/customPartnerTiles/index.d.ts +1 -0
- package/dist/components/partner/customPartnerTiles/index.js +1 -0
- package/dist/helpers/HomeRoles.helper.d.ts +1 -5
- package/dist/helpers/HomeRoles.helper.js +6 -0
- package/dist/helpers/forms/dynamicForm.helper.js +3 -1
- package/dist/hooks/forms/index.d.ts +1 -0
- package/dist/hooks/forms/index.js +1 -0
- package/dist/hooks/forms/useSimpleDynamicForm.d.ts +11 -0
- package/dist/hooks/forms/useSimpleDynamicForm.js +36 -0
- package/dist/hooks/myHomes/useMyHomeCard.d.ts +1 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/interfaces/contacts/AddEditContactPanel.interface.d.ts +12 -0
- package/dist/interfaces/contacts/ContactCard.interface.d.ts +15 -1
- package/dist/interfaces/contacts/ContactCardInfo.interface.d.ts +2 -1
- package/dist/interfaces/contacts/ContactsContent.interface.d.ts +4 -0
- package/dist/interfaces/contacts/ViewContactPanel.interface.d.ts +9 -0
- package/dist/interfaces/contacts/ViewContactPanel.interface.js +1 -0
- package/dist/interfaces/contacts/index.d.ts +2 -0
- package/dist/interfaces/contacts/index.js +2 -0
- package/dist/interfaces/forms/dynamicForm/DynamicForm.interface.d.ts +9 -7
- package/dist/interfaces/forms/dynamicForm/SimpleDynamicForm.interface.d.ts +4 -0
- package/dist/interfaces/forms/dynamicForm/SimpleDynamicForm.interface.js +1 -0
- package/dist/interfaces/forms/dynamicForm/fields/FieldWithDelete.interface.d.ts +1 -1
- package/dist/interfaces/forms/dynamicForm/fields/GroupField.interface.d.ts +1 -1
- package/dist/interfaces/forms/dynamicForm/index.d.ts +1 -1
- package/dist/interfaces/forms/dynamicForm/index.js +1 -1
- package/dist/interfaces/homeAssistant/ApplianceSteps.interface.d.ts +3 -0
- package/dist/interfaces/homeAssistant/HomeAssistantPanel.interface.d.ts +4 -1
- package/dist/interfaces/homeBoard/HomeCardWithRecipent.interface.d.ts +1 -0
- package/dist/mocks/contacts/contacts.mock.js +17 -5
- package/dist/mocks/forms/dynamicForm.mock.d.ts +1 -0
- package/dist/mocks/forms/dynamicForm.mock.js +155 -0
- package/dist/proxies/contacts/contactForm.proxy.d.ts +2 -0
- package/dist/proxies/contacts/contactForm.proxy.js +7 -0
- package/dist/proxies/contacts/index.d.ts +1 -0
- package/dist/proxies/contacts/index.js +1 -0
- package/dist/proxies/index.d.ts +1 -0
- package/dist/proxies/index.js +1 -0
- package/dist/stories/assets/Illustrations.stories.js +2 -2
- package/dist/stories/contacts/AddEditContactPanel.stories.d.ts +5 -0
- package/dist/stories/contacts/AddEditContactPanel.stories.js +22 -0
- package/dist/stories/contacts/ContactCardAddress.stories.d.ts +2 -0
- package/dist/stories/contacts/ContactCardInfo.stories.d.ts +2 -0
- package/dist/stories/contacts/ViewContactPanel.stories.d.ts +5 -0
- package/dist/stories/contacts/ViewContactPanel.stories.js +28 -0
- package/dist/stories/homeAssistant/panel/ApplianceSteps.stories.d.ts +1 -1
- package/dist/stories/homeAssistant/panel/ApplianceSteps.stories.js +1 -0
- package/dist/stories/homeAssistant/panel/HomeAssistantPanel.stories.js +1 -1
- package/dist/stories/partner/customPartnerTiles/ShineTile.stories.d.ts +5 -0
- package/dist/stories/partner/customPartnerTiles/ShineTile.stories.js +19 -0
- package/package.json +1 -1
- package/src/assets/images/circle-face.svg +21 -0
- package/src/assets/images/company.svg +34 -0
- package/src/assets/images/index.ts +7 -0
- package/src/assets/images/location.jpg +0 -0
- package/src/assets/images/logos/index.ts +12 -1
- package/src/assets/images/logos/shine.png +0 -0
- package/src/assets/images/shine/gutter-cleaning.png +0 -0
- package/src/assets/images/shine/holiday-lights.png +0 -0
- package/src/assets/images/shine/home-cleaning.png +0 -0
- package/src/assets/images/shine/index.ts +15 -0
- package/src/assets/images/shine/pressure.png +0 -0
- package/src/assets/images/shine/roof-cleaning.png +0 -0
- package/src/assets/images/shine/window.png +0 -0
- package/src/assets/locales/en/index.json +23 -1
- package/src/components/contacts/ContactCard.tsx +28 -25
- package/src/components/contacts/ContactCardHeader.tsx +5 -38
- package/src/components/contacts/ContactHeaderMenu.tsx +42 -0
- package/src/components/contacts/ContactsContent.tsx +3 -1
- package/src/components/contacts/addEditPanel/AddEditContactPanel.tsx +63 -0
- package/src/components/contacts/addEditPanel/index.ts +1 -0
- package/src/components/contacts/index.ts +3 -0
- package/src/components/contacts/viewPanel/CompanyInfoCard.tsx +58 -0
- package/src/components/contacts/viewPanel/CompanyRating.tsx +27 -0
- package/src/components/contacts/viewPanel/ContactAddressCard.tsx +39 -0
- package/src/components/contacts/viewPanel/ContactNotes.tsx +16 -0
- package/src/components/contacts/viewPanel/PersonalInfoCard.tsx +41 -0
- package/src/components/contacts/viewPanel/RoleTag.tsx +30 -0
- package/src/components/contacts/viewPanel/ViewContactHeader.tsx +26 -0
- package/src/components/contacts/viewPanel/ViewContactPanel.tsx +70 -0
- package/src/components/contacts/viewPanel/index.ts +8 -0
- package/src/components/forms/dynamicForm/DynamicForm.tsx +9 -6
- package/src/components/forms/dynamicForm/SimpleDynamicForm.tsx +57 -0
- package/src/components/forms/dynamicForm/fields/FieldWithDelete.tsx +2 -3
- package/src/components/forms/dynamicForm/fields/GroupField.tsx +7 -2
- package/src/components/forms/dynamicForm/index.ts +1 -1
- package/src/components/homeAssistant/panel/ApplianceSteps.tsx +5 -2
- package/src/components/homeAssistant/panel/HomeAssistantPanel.tsx +20 -7
- package/src/components/homeBoard/HomeBoard.tsx +3 -0
- package/src/components/homeBoard/HomeCardWithRecipent.tsx +15 -1
- package/src/components/partner/customPartnerTiles/ShineTile.tsx +148 -0
- package/src/components/partner/customPartnerTiles/index.ts +1 -0
- package/src/helpers/HomeRoles.helper.ts +7 -1
- package/src/helpers/forms/dynamicForm.helper.ts +4 -0
- package/src/hooks/forms/index.ts +1 -0
- package/src/hooks/forms/useSimpleDynamicForm.ts +58 -0
- package/src/index.ts +3 -0
- package/src/interfaces/contacts/AddEditContactPanel.interface.ts +14 -0
- package/src/interfaces/contacts/ContactCard.interface.ts +20 -1
- package/src/interfaces/contacts/ContactCardInfo.interface.ts +3 -2
- package/src/interfaces/contacts/ContactsContent.interface.ts +3 -0
- package/src/interfaces/contacts/ViewContactPanel.interface.ts +10 -0
- package/src/interfaces/contacts/index.ts +2 -0
- package/src/interfaces/forms/dynamicForm/DynamicForm.interface.ts +10 -6
- package/src/interfaces/forms/dynamicForm/SimpleDynamicForm.interface.ts +5 -0
- package/src/interfaces/forms/dynamicForm/fields/FieldWithDelete.interface.ts +1 -1
- package/src/interfaces/forms/dynamicForm/fields/GroupField.interface.ts +1 -1
- package/src/interfaces/forms/dynamicForm/index.ts +1 -1
- package/src/interfaces/homeAssistant/ApplianceSteps.interface.ts +13 -2
- package/src/interfaces/homeAssistant/HomeAssistantPanel.interface.ts +4 -1
- package/src/interfaces/homeBoard/HomeCardWithRecipent.interface.ts +1 -0
- package/src/mocks/contacts/contacts.mock.ts +17 -5
- package/src/mocks/forms/dynamicForm.mock.ts +156 -0
- package/src/proxies/contacts/contactForm.proxy.ts +9 -0
- package/src/proxies/contacts/index.ts +1 -0
- package/src/proxies/index.ts +1 -0
- package/src/stories/assets/Illustrations.stories.tsx +4 -0
- package/src/stories/contacts/AddEditContactPanel.stories.tsx +45 -0
- package/src/stories/contacts/ViewContactPanel.stories.tsx +35 -0
- package/src/stories/homeAssistant/panel/ApplianceSteps.stories.tsx +2 -1
- package/src/stories/homeAssistant/panel/HomeAssistantPanel.stories.tsx +2 -0
- package/src/stories/partner/customPartnerTiles/ShineTile.stories.tsx +26 -0
- package/dist/components/forms/dynamicForm/DynamicFormSimple.d.ts +0 -2
- package/dist/components/forms/dynamicForm/DynamicFormSimple.js +0 -32
- package/dist/interfaces/forms/dynamicForm/DynamicFormSimple.interface.d.ts +0 -4
- package/src/components/forms/dynamicForm/DynamicFormSimple.tsx +0 -66
- package/src/interfaces/forms/dynamicForm/DynamicFormSimple.interface.ts +0 -5
- /package/dist/interfaces/{forms/dynamicForm/DynamicFormSimple.interface.js → contacts/AddEditContactPanel.interface.js} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useEffect } from 'react'
|
|
2
|
+
import { FieldValues, useForm } from 'react-hook-form'
|
|
3
|
+
import { FolderFileI, ReportI } from '@/interfaces'
|
|
4
|
+
|
|
5
|
+
interface UseDynamicFormI {
|
|
6
|
+
fields: ReportI[]
|
|
7
|
+
onUpload?: (filesByFieldId: Record<string, FolderFileI[]>) => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const useSimpleDynamicForm = ({ fields }: UseDynamicFormI) => {
|
|
11
|
+
const form = useForm()
|
|
12
|
+
|
|
13
|
+
const { watch, setValue } = form
|
|
14
|
+
|
|
15
|
+
const fieldValues = watch()
|
|
16
|
+
|
|
17
|
+
const parseCurrenyValue = (value: string | number): number => {
|
|
18
|
+
if (typeof value === 'number') return value
|
|
19
|
+
const justNumbers = value?.replace(/[^0-9.]/g, '')
|
|
20
|
+
return parseFloat(justNumbers)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const handleUpdateFields = (
|
|
24
|
+
field: ReportI,
|
|
25
|
+
fieldValues: FieldValues
|
|
26
|
+
): ReportI => {
|
|
27
|
+
const value = fieldValues[field.id]
|
|
28
|
+
const isCurrency = field.type === 'currency'
|
|
29
|
+
const parsedValue = isCurrency ? parseCurrenyValue(value) : value
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
...field,
|
|
33
|
+
value: parsedValue,
|
|
34
|
+
children: field?.children?.map((child) =>
|
|
35
|
+
handleUpdateFields(child, fieldValues)
|
|
36
|
+
),
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const updatedFields = fields.map((field) => {
|
|
40
|
+
return handleUpdateFields(field, fieldValues)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const handleSetDefaultValues = (fields: ReportI[]) => {
|
|
44
|
+
fields.forEach((field) => {
|
|
45
|
+
setValue(field.id, field.value)
|
|
46
|
+
handleSetDefaultValues(field.children || [])
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
handleSetDefaultValues(fields)
|
|
52
|
+
}, [JSON.stringify(fields)])
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
form,
|
|
56
|
+
updatedFields,
|
|
57
|
+
}
|
|
58
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export {
|
|
|
2
2
|
ActivateAccount,
|
|
3
3
|
ActiveSubscription,
|
|
4
4
|
AddCardBanner,
|
|
5
|
+
AddEditContactPanel,
|
|
5
6
|
AddFolder,
|
|
6
7
|
AddHomeContent,
|
|
7
8
|
AddHomeItem,
|
|
@@ -155,6 +156,7 @@ export {
|
|
|
155
156
|
ShareHome,
|
|
156
157
|
ShareHomeConnections,
|
|
157
158
|
ShareHomeForm,
|
|
159
|
+
ShineTile,
|
|
158
160
|
ShortPartnerTile,
|
|
159
161
|
SignIn,
|
|
160
162
|
SignUp,
|
|
@@ -180,6 +182,7 @@ export {
|
|
|
180
182
|
UpdateList,
|
|
181
183
|
UserDetails,
|
|
182
184
|
ValueMonitor,
|
|
185
|
+
ViewContactPanel,
|
|
183
186
|
VideoPlayer,
|
|
184
187
|
VideoPlayerModal,
|
|
185
188
|
WellDone,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react'
|
|
2
|
+
import { ReportI } from '@/interfaces'
|
|
3
|
+
|
|
4
|
+
export interface AddEditContactPanelI {
|
|
5
|
+
detailsComponent: ReactNode
|
|
6
|
+
isEditing?: boolean
|
|
7
|
+
onBackClick: () => void
|
|
8
|
+
permissionsComponent: ReactNode
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ContactFormProxyI {
|
|
12
|
+
fields: ReportI[]
|
|
13
|
+
setFields(fields: ReportI[]): void
|
|
14
|
+
}
|
|
@@ -1,10 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
MenuItemI,
|
|
3
|
+
ShareContactPopoverI,
|
|
4
|
+
ContactAndIndexForm,
|
|
5
|
+
} from '@/interfaces'
|
|
6
|
+
|
|
7
|
+
export interface ContactCompanyInfoI {
|
|
8
|
+
address: string
|
|
9
|
+
city: string
|
|
10
|
+
company: string
|
|
11
|
+
url: string
|
|
12
|
+
_id: string
|
|
13
|
+
phone: string
|
|
14
|
+
state: string
|
|
15
|
+
zip: string
|
|
16
|
+
rating?: number
|
|
17
|
+
}
|
|
2
18
|
|
|
3
19
|
export interface InfoContactCardI {
|
|
4
20
|
address: string
|
|
5
21
|
category: string
|
|
6
22
|
city: string
|
|
7
23
|
company: string
|
|
24
|
+
companyInfo?: ContactCompanyInfoI
|
|
8
25
|
email: string
|
|
9
26
|
firstName: string
|
|
10
27
|
_id: string
|
|
@@ -13,6 +30,7 @@ export interface InfoContactCardI {
|
|
|
13
30
|
state: string
|
|
14
31
|
title: string
|
|
15
32
|
zip: string
|
|
33
|
+
notes?: string
|
|
16
34
|
}
|
|
17
35
|
|
|
18
36
|
export interface ContactCardI {
|
|
@@ -20,5 +38,6 @@ export interface ContactCardI {
|
|
|
20
38
|
contact: InfoContactCardI
|
|
21
39
|
index: number
|
|
22
40
|
menuItems: MenuItemI[]
|
|
41
|
+
onClick?: (contact: ContactAndIndexForm) => void
|
|
23
42
|
onShare: ShareContactPopoverI['onShare']
|
|
24
43
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { InfoContactCardI, MenuItemI, ShareContactPopoverI } from '@/interfaces'
|
|
2
2
|
import { ReactNode } from 'react'
|
|
3
3
|
|
|
4
|
+
export type ContactAndIndexForm = InfoContactCardI & { index: number }
|
|
5
|
+
|
|
4
6
|
export interface ContactsContentI {
|
|
5
7
|
apiError?: boolean
|
|
6
8
|
contacts: InfoContactCardI[]
|
|
@@ -9,5 +11,6 @@ export interface ContactsContentI {
|
|
|
9
11
|
menuItems: MenuItemI[]
|
|
10
12
|
children?: ReactNode
|
|
11
13
|
disabled?: boolean
|
|
14
|
+
onClick?: (contact: ContactAndIndexForm) => void
|
|
12
15
|
onShare: ShareContactPopoverI['onShare']
|
|
13
16
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RoleType } from '@/helpers'
|
|
2
|
+
import { InfoContactCardI, MenuItemI, ShareContactPopoverI } from '@/interfaces'
|
|
3
|
+
|
|
4
|
+
export interface ViewContactPanelI {
|
|
5
|
+
contact: InfoContactCardI
|
|
6
|
+
handleClose: () => void
|
|
7
|
+
menuItems: MenuItemI[]
|
|
8
|
+
onShare: ShareContactPopoverI['onShare']
|
|
9
|
+
roleType: RoleType
|
|
10
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './AddEditContactPanel.interface'
|
|
1
2
|
export * from './ContactCard.interface'
|
|
2
3
|
export * from './ContactCardAddress.interface'
|
|
3
4
|
export * from './ContactCardHeader.interface'
|
|
@@ -5,3 +6,4 @@ export * from './ContactCardInfo.interface'
|
|
|
5
6
|
export * from './ContactsContent.interface'
|
|
6
7
|
export * from './ShareContactByEmail.interface'
|
|
7
8
|
export * from './ShareContactPopover.interface'
|
|
9
|
+
export * from './ViewContactPanel.interface'
|
|
@@ -61,26 +61,30 @@ export type IconTypes =
|
|
|
61
61
|
| 'plate'
|
|
62
62
|
| 'house'
|
|
63
63
|
| 'target'
|
|
64
|
+
| 'title'
|
|
65
|
+
| 'company'
|
|
64
66
|
|
|
65
67
|
export type ValueTypes = string | string[] | number | boolean
|
|
66
68
|
export type OptionsTypes = string[] | number[] | null
|
|
67
69
|
|
|
68
70
|
export interface ReportI {
|
|
71
|
+
canBeHidden?: boolean
|
|
72
|
+
children?: ReportI[]
|
|
73
|
+
comments?: string
|
|
74
|
+
description?: string
|
|
75
|
+
icon?: IconTypes
|
|
69
76
|
id: string
|
|
70
77
|
name?: string
|
|
71
|
-
|
|
72
|
-
comments?: string
|
|
73
|
-
value: ValueTypes
|
|
78
|
+
options?: OptionsTypes
|
|
74
79
|
type: KindTypes
|
|
80
|
+
value: ValueTypes
|
|
75
81
|
visible?: boolean
|
|
76
|
-
options?: OptionsTypes
|
|
77
|
-
children?: ReportI[]
|
|
78
|
-
icon?: IconTypes
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
export interface DynamicFormI {
|
|
82
85
|
form: ReportI[]
|
|
83
86
|
onUpload?: (filesByFieldId: Record<string, FolderFileI[]>) => void
|
|
87
|
+
showTitle?: boolean
|
|
84
88
|
uploadingFieldId?: string
|
|
85
89
|
}
|
|
86
90
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './edit'
|
|
2
2
|
export * from './fields'
|
|
3
3
|
export * from './DynamicForm.interface'
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './SimpleDynamicForm.interface'
|
|
5
5
|
export * from './HiddenField.interface'
|
|
6
6
|
export * from './HiddenFieldSection.interface'
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import { ApplianceStepI } from '@/interfaces'
|
|
2
|
-
|
|
3
1
|
export interface ApplianceStepsI {
|
|
2
|
+
addedAppliances?: AppliancesType[]
|
|
4
3
|
onClick: (selectedSteps: string[]) => void
|
|
5
4
|
}
|
|
5
|
+
|
|
6
|
+
type AppliancesType =
|
|
7
|
+
| 'fridge'
|
|
8
|
+
| 'freezer'
|
|
9
|
+
| 'washer'
|
|
10
|
+
| 'dryer'
|
|
11
|
+
| 'dish-washer'
|
|
12
|
+
| 'cook-top'
|
|
13
|
+
| 'oven'
|
|
14
|
+
| 'range'
|
|
15
|
+
| 'hood'
|
|
16
|
+
| 'microwave'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DynamicFormI } from '@/interfaces'
|
|
1
|
+
import { DynamicFormI, ReportI } from '@/interfaces'
|
|
2
2
|
|
|
3
3
|
export interface HomeAssistantPanelI {
|
|
4
4
|
currentForm: DynamicFormI['form']
|
|
@@ -7,4 +7,7 @@ export interface HomeAssistantPanelI {
|
|
|
7
7
|
onBack: () => void
|
|
8
8
|
onClose: () => void
|
|
9
9
|
onNext: () => void
|
|
10
|
+
onSave: (form: ReportI[]) => void
|
|
11
|
+
backDisabled: boolean
|
|
12
|
+
nextDisabled: boolean
|
|
10
13
|
}
|
|
@@ -9,12 +9,24 @@ export const ContactsMock: InfoContactCardI[] = [
|
|
|
9
9
|
lastName: faker.person.lastName(),
|
|
10
10
|
email: faker.internet.email(),
|
|
11
11
|
phone: faker.phone.number(),
|
|
12
|
-
company:
|
|
13
|
-
address:
|
|
14
|
-
zip:
|
|
15
|
-
city:
|
|
16
|
-
state:
|
|
12
|
+
company: faker.company.name(),
|
|
13
|
+
address: faker.location.streetAddress(),
|
|
14
|
+
zip: faker.location.zipCode(),
|
|
15
|
+
city: faker.location.city(),
|
|
16
|
+
state: faker.location.state(),
|
|
17
17
|
_id: faker.database.mongodbObjectId(),
|
|
18
|
+
notes: faker.lorem.paragraphs(),
|
|
19
|
+
companyInfo: {
|
|
20
|
+
address: faker.location.streetAddress(),
|
|
21
|
+
city: faker.location.city(),
|
|
22
|
+
company: faker.company.name(),
|
|
23
|
+
url: faker.internet.url(),
|
|
24
|
+
_id: faker.database.mongodbObjectId(),
|
|
25
|
+
phone: faker.phone.number(),
|
|
26
|
+
state: faker.location.state(),
|
|
27
|
+
zip: faker.location.zipCode(),
|
|
28
|
+
rating: faker.number.int({ min: 1, max: 5 }),
|
|
29
|
+
},
|
|
18
30
|
},
|
|
19
31
|
{
|
|
20
32
|
title: 'Pumpler',
|
|
@@ -191,3 +191,159 @@ export const formFieldsMock: ReportI[] = [
|
|
|
191
191
|
icon: 'book',
|
|
192
192
|
},
|
|
193
193
|
]
|
|
194
|
+
|
|
195
|
+
export const contactFieldsMock: ReportI[] = [
|
|
196
|
+
{
|
|
197
|
+
id: faker.database.mongodbObjectId(),
|
|
198
|
+
name: 'basic-info',
|
|
199
|
+
value: '',
|
|
200
|
+
type: 'group',
|
|
201
|
+
canBeHidden: false,
|
|
202
|
+
children: [
|
|
203
|
+
{
|
|
204
|
+
id: faker.database.mongodbObjectId(),
|
|
205
|
+
name: 'name',
|
|
206
|
+
value: '',
|
|
207
|
+
type: 'grid',
|
|
208
|
+
children: [
|
|
209
|
+
{
|
|
210
|
+
id: faker.database.mongodbObjectId(),
|
|
211
|
+
name: 'First Name',
|
|
212
|
+
value: faker.person.firstName(),
|
|
213
|
+
type: 'text',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: faker.database.mongodbObjectId(),
|
|
217
|
+
name: 'Last Name',
|
|
218
|
+
value: faker.person.lastName(),
|
|
219
|
+
type: 'text',
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: faker.database.mongodbObjectId(),
|
|
225
|
+
name: 'Email',
|
|
226
|
+
value: faker.internet.email(),
|
|
227
|
+
type: 'text',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
id: faker.database.mongodbObjectId(),
|
|
231
|
+
name: 'Phone',
|
|
232
|
+
value: faker.phone.number(),
|
|
233
|
+
type: 'text',
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: faker.database.mongodbObjectId(),
|
|
239
|
+
name: 'Title',
|
|
240
|
+
value: faker.person.jobTitle(),
|
|
241
|
+
type: 'text',
|
|
242
|
+
icon: 'title',
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
id: faker.database.mongodbObjectId(),
|
|
246
|
+
name: 'Category',
|
|
247
|
+
value: 'Pest Control',
|
|
248
|
+
type: 'select',
|
|
249
|
+
options: [
|
|
250
|
+
'Pest Control',
|
|
251
|
+
'Maintenance',
|
|
252
|
+
'Construction',
|
|
253
|
+
'Misc',
|
|
254
|
+
'Electrical',
|
|
255
|
+
'Design',
|
|
256
|
+
'Finance',
|
|
257
|
+
'Plumbing',
|
|
258
|
+
],
|
|
259
|
+
icon: 'book',
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
id: faker.database.mongodbObjectId(),
|
|
263
|
+
name: 'company-info',
|
|
264
|
+
value: '',
|
|
265
|
+
type: 'group',
|
|
266
|
+
children: [
|
|
267
|
+
{
|
|
268
|
+
id: faker.database.mongodbObjectId(),
|
|
269
|
+
name: 'Company Name',
|
|
270
|
+
value: faker.company.name(),
|
|
271
|
+
type: 'text',
|
|
272
|
+
icon: 'company',
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
id: faker.database.mongodbObjectId(),
|
|
276
|
+
name: 'Company Address',
|
|
277
|
+
value: faker.location.streetAddress(),
|
|
278
|
+
type: 'text',
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
id: faker.database.mongodbObjectId(),
|
|
282
|
+
name: 'company-location',
|
|
283
|
+
value: '',
|
|
284
|
+
type: 'grid',
|
|
285
|
+
children: [
|
|
286
|
+
{
|
|
287
|
+
id: faker.database.mongodbObjectId(),
|
|
288
|
+
name: 'Zip/Country',
|
|
289
|
+
value: faker.location.zipCode(),
|
|
290
|
+
type: 'text',
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
id: faker.database.mongodbObjectId(),
|
|
294
|
+
name: 'City',
|
|
295
|
+
value: faker.location.city(),
|
|
296
|
+
type: 'text',
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
id: faker.database.mongodbObjectId(),
|
|
300
|
+
name: 'State',
|
|
301
|
+
value: faker.location.state(),
|
|
302
|
+
type: 'text',
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
id: faker.database.mongodbObjectId(),
|
|
308
|
+
name: 'company-contact',
|
|
309
|
+
value: '',
|
|
310
|
+
type: 'grid',
|
|
311
|
+
children: [
|
|
312
|
+
{
|
|
313
|
+
id: faker.database.mongodbObjectId(),
|
|
314
|
+
name: 'Phone',
|
|
315
|
+
value: faker.phone.number(),
|
|
316
|
+
type: 'text',
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
id: faker.database.mongodbObjectId(),
|
|
320
|
+
name: 'Website URL',
|
|
321
|
+
value: faker.internet.url(),
|
|
322
|
+
type: 'text',
|
|
323
|
+
},
|
|
324
|
+
],
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
id: faker.database.mongodbObjectId(),
|
|
330
|
+
name: 'Notes',
|
|
331
|
+
value: faker.lorem.text(),
|
|
332
|
+
type: 'textarea',
|
|
333
|
+
icon: 'notes',
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
id: faker.database.mongodbObjectId(),
|
|
337
|
+
name: 'Rating',
|
|
338
|
+
value: faker.number.int({ min: 1, max: 4 }),
|
|
339
|
+
type: 'rating',
|
|
340
|
+
icon: 'rating',
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
id: faker.database.mongodbObjectId(),
|
|
344
|
+
name: 'Images',
|
|
345
|
+
value: [],
|
|
346
|
+
type: 'file',
|
|
347
|
+
icon: 'image',
|
|
348
|
+
},
|
|
349
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './contactForm.proxy'
|
package/src/proxies/index.ts
CHANGED
|
@@ -26,9 +26,11 @@ import {
|
|
|
26
26
|
CheckInCircle,
|
|
27
27
|
CheckPen,
|
|
28
28
|
Chemistry,
|
|
29
|
+
CircleFace,
|
|
29
30
|
Cleaning,
|
|
30
31
|
Closet,
|
|
31
32
|
Co2,
|
|
33
|
+
Company,
|
|
32
34
|
ComputerReport,
|
|
33
35
|
Confirmation,
|
|
34
36
|
Construction,
|
|
@@ -281,9 +283,11 @@ export const Illustrations = () => {
|
|
|
281
283
|
<IconWrapper icon={CheckInCircle} name="CheckInCircle" />
|
|
282
284
|
<IconWrapper icon={CheckPen} name="CheckPen" />
|
|
283
285
|
<IconWrapper icon={Chemistry} name="Chemistry" />
|
|
286
|
+
<IconWrapper icon={CircleFace} name="CircleFace" />
|
|
284
287
|
<IconWrapper icon={Cleaning} name="Cleaning" />
|
|
285
288
|
<IconWrapper icon={Closet} name="Closet" />
|
|
286
289
|
<IconWrapper icon={Co2} name="Co2" />
|
|
290
|
+
<IconWrapper icon={Company} name="Company" />
|
|
287
291
|
<IconWrapper icon={ComputerReport} name="ComputerReport" />
|
|
288
292
|
<IconWrapper icon={Confirmation} name="Confirmation" />
|
|
289
293
|
<IconWrapper icon={Construction} name="Construction" />
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react'
|
|
2
|
+
import {
|
|
3
|
+
AddEditContactPanel,
|
|
4
|
+
DynamicForm,
|
|
5
|
+
RightPanel,
|
|
6
|
+
RolePermissionsTab,
|
|
7
|
+
} from '@/components'
|
|
8
|
+
import { ContactsMock, contactFieldsMock, featuresSelectedMock } from '@/mocks'
|
|
9
|
+
import { AddEditContactPanelI } from '@/interfaces'
|
|
10
|
+
import { action } from '@storybook/addon-actions'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: 'Components/Contacts',
|
|
14
|
+
component: AddEditContactPanel,
|
|
15
|
+
args: {
|
|
16
|
+
detailsComponent: (
|
|
17
|
+
<DynamicForm
|
|
18
|
+
form={contactFieldsMock}
|
|
19
|
+
showTitle={false}
|
|
20
|
+
onUpload={action('onUpload')}
|
|
21
|
+
/>
|
|
22
|
+
),
|
|
23
|
+
permissionsComponent: (
|
|
24
|
+
<RolePermissionsTab
|
|
25
|
+
selected={featuresSelectedMock}
|
|
26
|
+
onSelect={action('onSelect')}
|
|
27
|
+
/>
|
|
28
|
+
),
|
|
29
|
+
isEditing: true,
|
|
30
|
+
menuItems: [
|
|
31
|
+
{
|
|
32
|
+
label: 'Edit',
|
|
33
|
+
handleClick: action('Edit'),
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
} as Meta<AddEditContactPanelI>
|
|
38
|
+
|
|
39
|
+
export const AddEditContactPanelComponent = (args: AddEditContactPanelI) => {
|
|
40
|
+
return (
|
|
41
|
+
<RightPanel isOpen={true} onClose={() => null}>
|
|
42
|
+
<AddEditContactPanel {...args} />
|
|
43
|
+
</RightPanel>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react'
|
|
2
|
+
import { ViewContactPanel, RightPanel } from '@/components'
|
|
3
|
+
import { ContactsMock } from '@/mocks'
|
|
4
|
+
import { ViewContactPanelI } from '@/interfaces'
|
|
5
|
+
import { action } from '@storybook/addon-actions'
|
|
6
|
+
import { homeRoleTypes } from '@/helpers'
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Components/Contacts',
|
|
10
|
+
component: ViewContactPanel,
|
|
11
|
+
argTypes: {
|
|
12
|
+
roleType: {
|
|
13
|
+
options: homeRoleTypes,
|
|
14
|
+
control: { type: 'radio' },
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
args: {
|
|
18
|
+
contact: ContactsMock[0],
|
|
19
|
+
roleType: 'member',
|
|
20
|
+
menuItems: [
|
|
21
|
+
{
|
|
22
|
+
label: 'Edit',
|
|
23
|
+
handleClick: action('Edit'),
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
} as Meta<ViewContactPanelI>
|
|
28
|
+
|
|
29
|
+
export const ViewContactPanelComponent = (args: ViewContactPanelI) => {
|
|
30
|
+
return (
|
|
31
|
+
<RightPanel isOpen={true} onClose={() => null}>
|
|
32
|
+
<ViewContactPanel {...args} />
|
|
33
|
+
</RightPanel>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -9,6 +9,7 @@ export default {
|
|
|
9
9
|
component: ApplianceSteps,
|
|
10
10
|
args: {
|
|
11
11
|
onclick: action('clicked'),
|
|
12
|
+
addedAppliances: ['fridge', 'freezer', 'range', 'hood', 'microwave'],
|
|
12
13
|
},
|
|
13
14
|
decorators: [
|
|
14
15
|
(Story: any) => (
|
|
@@ -17,7 +18,7 @@ export default {
|
|
|
17
18
|
</Box>
|
|
18
19
|
),
|
|
19
20
|
],
|
|
20
|
-
} as Meta
|
|
21
|
+
} as Meta<ApplianceStepsI>
|
|
21
22
|
|
|
22
23
|
export const ApplianceStepsComponent = (args: ApplianceStepsI) => {
|
|
23
24
|
return <ApplianceSteps {...args} />
|
|
@@ -50,6 +50,7 @@ export const HomeAssistantPanelComponent = (args: HomeAssistantPanelI) => {
|
|
|
50
50
|
if (prev === 1) return 6
|
|
51
51
|
return prev - 1
|
|
52
52
|
})
|
|
53
|
+
|
|
53
54
|
const currentForm = forms[currentStep]
|
|
54
55
|
return (
|
|
55
56
|
<HomeAssistantPanel
|
|
@@ -58,6 +59,7 @@ export const HomeAssistantPanelComponent = (args: HomeAssistantPanelI) => {
|
|
|
58
59
|
currentForm={currentForm}
|
|
59
60
|
onNext={handleFormChange}
|
|
60
61
|
onBack={handleBack}
|
|
62
|
+
onSave={action('onSave')}
|
|
61
63
|
/>
|
|
62
64
|
)
|
|
63
65
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ShineTile } from '@/components'
|
|
2
|
+
import { ShortPartnerTileI } from '@/interfaces'
|
|
3
|
+
import { menuMock } from '@/mocks'
|
|
4
|
+
import { Meta } from '@storybook/react'
|
|
5
|
+
import { Box } from '@chakra-ui/react'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Components/Partner',
|
|
9
|
+
component: ShineTile,
|
|
10
|
+
args: {
|
|
11
|
+
menuItems: menuMock,
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
menuItems: {
|
|
15
|
+
control: { disable: true },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
} as Meta
|
|
19
|
+
|
|
20
|
+
export const ShineTileComponent = (args: ShortPartnerTileI) => {
|
|
21
|
+
return (
|
|
22
|
+
<Box maxW="326px">
|
|
23
|
+
<ShineTile {...args} />
|
|
24
|
+
</Box>
|
|
25
|
+
)
|
|
26
|
+
}
|