@homefile/components-v2 1.1.0 → 1.2.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/index.d.ts +3 -1
- package/dist/assets/images/index.js +3 -1
- package/dist/assets/images/index.ts +4 -0
- package/dist/assets/images/sms.svg +21 -0
- package/dist/assets/images/social.svg +10 -0
- package/dist/assets/locales/en/index.json +6 -0
- package/dist/components/contacts/ContactCard.d.ts +1 -1
- package/dist/components/contacts/ContactCard.js +2 -2
- package/dist/components/contacts/ContactCardHeader.d.ts +1 -1
- package/dist/components/contacts/ContactCardHeader.js +5 -4
- package/dist/components/contacts/ContactsContent.d.ts +1 -1
- package/dist/components/contacts/ContactsContent.js +2 -2
- package/dist/components/contacts/ShareContactPopover.d.ts +2 -0
- package/dist/components/contacts/ShareContactPopover.js +32 -0
- package/dist/components/contacts/index.d.ts +2 -0
- package/dist/components/contacts/index.js +2 -0
- package/dist/components/contacts/shareContactForms/ShareContactByEmail.d.ts +2 -0
- package/dist/components/contacts/shareContactForms/ShareContactByEmail.js +21 -0
- package/dist/components/contacts/shareContactForms/index.d.ts +1 -0
- package/dist/components/contacts/shareContactForms/index.js +1 -0
- package/dist/components/folderPanel/displayFiles/GridFile.js +1 -1
- package/dist/components/folderPanel/displayFiles/IconMenuWithMove.js +1 -1
- package/dist/components/folderPanel/displayFiles/ListFile.js +1 -1
- package/dist/components/folderPanel/displayFiles/MoveModal.js +1 -1
- package/dist/components/forms/dynamicForm/HiddenField.d.ts +1 -1
- package/dist/components/forms/dynamicForm/HiddenField.js +7 -2
- package/dist/components/homeBoard/HomeBoard.js +1 -1
- package/dist/components/homeBoard/HomeCard.js +1 -1
- package/dist/components/homeSummary/DocumentMenu.js +1 -1
- package/dist/components/icons/ShareIcon.d.ts +4 -0
- package/dist/components/icons/ShareIcon.js +5 -0
- package/dist/components/icons/index.d.ts +1 -0
- package/dist/components/icons/index.js +1 -0
- package/dist/components/launchpad/IconMenu.js +1 -1
- package/dist/components/myHomes/MyHomeCard.js +1 -1
- package/dist/components/myHomes/MyHomes.js +1 -1
- package/dist/components/myProfile/permissions/RolePermissionsTab.js +1 -1
- package/dist/components/overlay/Overlay.d.ts +1 -1
- package/dist/components/overlay/Overlay.js +2 -2
- package/dist/components/rooms/GroupCard.d.ts +1 -1
- package/dist/components/rooms/GroupCard.js +3 -3
- package/dist/components/rooms/ItemCard.d.ts +1 -1
- package/dist/components/rooms/ItemCard.js +2 -2
- package/dist/components/sendDocument/RecipientCard.js +1 -1
- package/dist/components/sharedHomePanel/ShareHomeContactList.js +1 -1
- package/dist/helpers/homeAssistant/HomeAssistant.helper.js +6 -7
- package/dist/helpers/myProfile/RolePermissions.helper.js +25 -25
- package/dist/hooks/myProfile/useRolePermissionsTab.js +4 -0
- package/dist/interfaces/contacts/ContactCard.interface.d.ts +3 -1
- package/dist/interfaces/contacts/ContactCardHeader.interface.d.ts +3 -1
- package/dist/interfaces/contacts/ContactsContent.interface.d.ts +4 -2
- package/dist/interfaces/contacts/ShareContactByEmail.interface.d.ts +11 -0
- package/dist/interfaces/contacts/ShareContactByEmail.interface.js +1 -0
- package/dist/interfaces/contacts/ShareContactPopover.interface.d.ts +8 -0
- package/dist/interfaces/contacts/ShareContactPopover.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/HiddenField.interface.d.ts +2 -0
- package/dist/interfaces/overlay/Overlay.interface.d.ts +2 -1
- package/dist/interfaces/rooms/GroupCard.interface.d.ts +1 -0
- package/dist/interfaces/rooms/ItemCard.interface.d.ts +1 -0
- package/dist/mocks/myProfile/Permissions.mock.js +9 -11
- package/dist/stories/assets/Illustrations.stories.js +2 -2
- package/dist/theme/colors.d.ts +1 -0
- package/dist/theme/colors.js +1 -0
- package/package.json +1 -1
- package/src/assets/images/index.ts +4 -0
- package/src/assets/images/sms.svg +21 -0
- package/src/assets/images/social.svg +10 -0
- package/src/assets/locales/en/index.json +6 -0
- package/src/components/contacts/ContactCard.tsx +13 -2
- package/src/components/contacts/ContactCardHeader.tsx +33 -8
- package/src/components/contacts/ContactsContent.tsx +4 -0
- package/src/components/contacts/ShareContactPopover.tsx +106 -0
- package/src/components/contacts/index.ts +3 -1
- package/src/components/contacts/shareContactForms/ShareContactByEmail.tsx +50 -0
- package/src/components/contacts/shareContactForms/index.ts +1 -0
- package/src/components/folderPanel/displayFiles/GridFile.tsx +1 -0
- package/src/components/folderPanel/displayFiles/IconMenuWithMove.tsx +1 -1
- package/src/components/folderPanel/displayFiles/ListFile.tsx +1 -0
- package/src/components/folderPanel/displayFiles/MoveModal.tsx +1 -1
- package/src/components/forms/dynamicForm/HiddenField.tsx +16 -2
- package/src/components/homeBoard/HomeBoard.tsx +1 -0
- package/src/components/homeBoard/HomeCard.tsx +1 -0
- package/src/components/homeSummary/DocumentMenu.tsx +1 -1
- package/src/components/icons/ShareIcon.tsx +74 -0
- package/src/components/icons/index.ts +1 -0
- package/src/components/launchpad/IconMenu.tsx +1 -1
- package/src/components/myHomes/MyHomeCard.tsx +12 -8
- package/src/components/myHomes/MyHomes.tsx +1 -1
- package/src/components/myProfile/permissions/RolePermissionsTab.tsx +1 -1
- package/src/components/overlay/Overlay.tsx +2 -0
- package/src/components/rooms/GroupCard.tsx +3 -1
- package/src/components/rooms/ItemCard.tsx +2 -0
- package/src/components/sendDocument/RecipientCard.tsx +1 -0
- package/src/components/sharedHomePanel/ShareHomeContactList.tsx +1 -1
- package/src/helpers/homeAssistant/HomeAssistant.helper.tsx +6 -7
- package/src/helpers/myProfile/RolePermissions.helper.ts +25 -25
- package/src/hooks/myProfile/useRolePermissionsTab.ts +8 -0
- package/src/interfaces/contacts/ContactCard.interface.ts +3 -1
- package/src/interfaces/contacts/ContactCardHeader.interface.ts +4 -2
- package/src/interfaces/contacts/ContactsContent.interface.ts +5 -3
- package/src/interfaces/contacts/ShareContactByEmail.interface.ts +12 -0
- package/src/interfaces/contacts/ShareContactPopover.interface.ts +9 -0
- package/src/interfaces/contacts/index.ts +3 -1
- package/src/interfaces/forms/dynamicForm/HiddenField.interface.ts +2 -0
- package/src/interfaces/overlay/Overlay.interface.ts +2 -1
- package/src/interfaces/rooms/GroupCard.interface.ts +1 -0
- package/src/interfaces/rooms/ItemCard.interface.ts +1 -0
- package/src/mocks/myProfile/Permissions.mock.ts +9 -11
- package/src/stories/assets/Illustrations.stories.tsx +4 -0
- package/src/theme/colors.ts +1 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Fragment, ReactNode, useState } from 'react'
|
|
2
|
+
import { t } from 'i18next'
|
|
3
|
+
import { Text, Box, Flex, IconButton, Grid } from '@chakra-ui/react'
|
|
4
|
+
import { HiddenField, Close, Overlay, ShareContactByEmail } from '@/components'
|
|
5
|
+
import { Feedback, ShareWith, SMS, Social } from '@/assets/images'
|
|
6
|
+
import { ShareContactPopoverI } from '@/interfaces'
|
|
7
|
+
|
|
8
|
+
export const ShareContactPopover = ({
|
|
9
|
+
apiError,
|
|
10
|
+
contact,
|
|
11
|
+
isOpen,
|
|
12
|
+
onClose,
|
|
13
|
+
onShare,
|
|
14
|
+
}: ShareContactPopoverI) => {
|
|
15
|
+
const [activeField, setActiveField] = useState('email')
|
|
16
|
+
if (!isOpen) return null
|
|
17
|
+
|
|
18
|
+
const forms: Record<string, ReactNode> = {
|
|
19
|
+
email: (
|
|
20
|
+
<ShareContactByEmail
|
|
21
|
+
apiError={apiError}
|
|
22
|
+
contact={contact}
|
|
23
|
+
onShare={onShare}
|
|
24
|
+
/>
|
|
25
|
+
),
|
|
26
|
+
sms: <Fragment />,
|
|
27
|
+
social: <Fragment />,
|
|
28
|
+
homefile: <Fragment />,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<Box
|
|
34
|
+
position="absolute"
|
|
35
|
+
top="0px"
|
|
36
|
+
right={['0px', '50px']}
|
|
37
|
+
bg="lightBlue.1"
|
|
38
|
+
zIndex="modal"
|
|
39
|
+
w="367px"
|
|
40
|
+
borderRadius="md"
|
|
41
|
+
boxShadow="xl"
|
|
42
|
+
overflow="hidden"
|
|
43
|
+
>
|
|
44
|
+
<Flex
|
|
45
|
+
justify="space-between"
|
|
46
|
+
align="center"
|
|
47
|
+
h="34px"
|
|
48
|
+
bg="neutral.white"
|
|
49
|
+
px="base"
|
|
50
|
+
>
|
|
51
|
+
<Text fontSize="sm">{t('contacts.shareContact')}</Text>
|
|
52
|
+
<IconButton
|
|
53
|
+
variant="menuIcon"
|
|
54
|
+
aria-label="Close"
|
|
55
|
+
icon={<Close />}
|
|
56
|
+
onClick={onClose}
|
|
57
|
+
w="fit-content"
|
|
58
|
+
/>
|
|
59
|
+
</Flex>
|
|
60
|
+
<Box>
|
|
61
|
+
{forms[activeField]}
|
|
62
|
+
<Grid
|
|
63
|
+
templateColumns="repeat(auto-fill, minmax(70px, 1fr))"
|
|
64
|
+
gap="base"
|
|
65
|
+
p="base"
|
|
66
|
+
>
|
|
67
|
+
{fields.map(({ disabled, icon = 'email', id, name = '' }) => {
|
|
68
|
+
return (
|
|
69
|
+
<HiddenField
|
|
70
|
+
key={id}
|
|
71
|
+
disabled={disabled}
|
|
72
|
+
id={id}
|
|
73
|
+
name={name}
|
|
74
|
+
icon={fieldIcons[icon]}
|
|
75
|
+
onClick={() => setActiveField(id)}
|
|
76
|
+
isActive={id === activeField}
|
|
77
|
+
/>
|
|
78
|
+
)
|
|
79
|
+
})}
|
|
80
|
+
</Grid>
|
|
81
|
+
</Box>
|
|
82
|
+
</Box>
|
|
83
|
+
<Overlay
|
|
84
|
+
onClick={onClose}
|
|
85
|
+
bg="overlay"
|
|
86
|
+
showOverlay
|
|
87
|
+
position="fixed"
|
|
88
|
+
zIndex="4"
|
|
89
|
+
/>
|
|
90
|
+
</>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const fields = [
|
|
95
|
+
{ disabled: true, icon: 'homefile', id: 'homefile', name: 'Homefile' },
|
|
96
|
+
{ disabled: true, icon: 'social', id: 'social', name: 'Social' },
|
|
97
|
+
{ disabled: true, icon: 'sms', id: 'sms', name: 'SMS' },
|
|
98
|
+
{ disabled: false, icon: 'email', id: 'email', name: 'Email' },
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
const fieldIcons: Record<string, string> = {
|
|
102
|
+
homefile: ShareWith,
|
|
103
|
+
social: Social,
|
|
104
|
+
sms: SMS,
|
|
105
|
+
email: Feedback,
|
|
106
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export * from './shareContactForms'
|
|
1
2
|
export * from './ContactCard'
|
|
2
3
|
export * from './ContactCardAddress'
|
|
3
4
|
export * from './ContactCardHeader'
|
|
4
5
|
export * from './ContactCardInfo'
|
|
5
|
-
export * from './ContactsContent'
|
|
6
|
+
export * from './ContactsContent'
|
|
7
|
+
export * from './ShareContactPopover'
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { t } from 'i18next'
|
|
3
|
+
import { Box, Button, Flex } from '@chakra-ui/react'
|
|
4
|
+
import { TextInput } from '@/components'
|
|
5
|
+
import { isValidEmail } from '@/utils'
|
|
6
|
+
import { ShareContactByEmailI } from '@/interfaces'
|
|
7
|
+
|
|
8
|
+
export const ShareContactByEmail = ({
|
|
9
|
+
apiError,
|
|
10
|
+
contact,
|
|
11
|
+
onShare,
|
|
12
|
+
}: ShareContactByEmailI) => {
|
|
13
|
+
const [value, setValue] = useState('')
|
|
14
|
+
const [isDirty, setIsDirty] = useState(apiError ?? false)
|
|
15
|
+
const errorMessage = apiError
|
|
16
|
+
? t('contacts.error')
|
|
17
|
+
: `${t('forms.email')} ${t('forms.required')}`
|
|
18
|
+
return (
|
|
19
|
+
<Box bg="lightBlue.2" p="base" w="100%">
|
|
20
|
+
<Flex gap="base">
|
|
21
|
+
<TextInput
|
|
22
|
+
errorMessage={errorMessage}
|
|
23
|
+
hasError={!isValidEmail(value) && isDirty}
|
|
24
|
+
id="shareContactByEmail"
|
|
25
|
+
handleChange={(e) => setValue(e.target.value)}
|
|
26
|
+
placeholder={t('contacts.placeholders.email')}
|
|
27
|
+
value={value}
|
|
28
|
+
onBlur={() => setIsDirty(true)}
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<Button
|
|
32
|
+
variant="secondary"
|
|
33
|
+
maxW="fit-content"
|
|
34
|
+
maxH="input.md"
|
|
35
|
+
onClick={() => {
|
|
36
|
+
onShare({
|
|
37
|
+
contact,
|
|
38
|
+
emailTo: value,
|
|
39
|
+
})
|
|
40
|
+
setValue('')
|
|
41
|
+
setIsDirty(false)
|
|
42
|
+
}}
|
|
43
|
+
disabled={!isValidEmail(value)}
|
|
44
|
+
>
|
|
45
|
+
{t('buttons.send')}
|
|
46
|
+
</Button>
|
|
47
|
+
</Flex>
|
|
48
|
+
</Box>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ShareContactByEmail'
|
|
@@ -25,6 +25,7 @@ export const GridFile = ({
|
|
|
25
25
|
<WrapItem maxW="7rem" position="relative">
|
|
26
26
|
<Box position="absolute" top="0" right="1" zIndex="docked">
|
|
27
27
|
<IconMenuWithMove
|
|
28
|
+
disabled={menu.length < 1 ? true: false}
|
|
28
29
|
icon={<MoreHorizontal size={28} />}
|
|
29
30
|
itemForm={itemForm}
|
|
30
31
|
menuItems={menu}
|
|
@@ -32,7 +32,7 @@ export const MoveModal = ({
|
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<Box w="inherit" h="inherit">
|
|
35
|
-
<Overlay bg="
|
|
35
|
+
<Overlay bg="overlay" showOverlay position="fixed" zIndex="modal" />
|
|
36
36
|
<Stack
|
|
37
37
|
p="base"
|
|
38
38
|
boxShadow="lg"
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { Center, Image, Text } from '@chakra-ui/react'
|
|
2
2
|
import { HiddenFieldI } from '@/interfaces'
|
|
3
3
|
|
|
4
|
-
export const HiddenField = ({
|
|
4
|
+
export const HiddenField = ({
|
|
5
|
+
disabled,
|
|
6
|
+
icon,
|
|
7
|
+
id,
|
|
8
|
+
isActive,
|
|
9
|
+
name,
|
|
10
|
+
onClick,
|
|
11
|
+
}: HiddenFieldI) => {
|
|
5
12
|
const handleClick = () => onClick(id)
|
|
6
13
|
return (
|
|
7
14
|
<Center
|
|
8
15
|
as="button"
|
|
16
|
+
disabled={disabled}
|
|
9
17
|
bg="neutral.white"
|
|
10
18
|
borderRadius="md"
|
|
11
19
|
w="auto"
|
|
@@ -16,10 +24,16 @@ export const HiddenField = ({ icon, id, name, onClick }: HiddenFieldI) => {
|
|
|
16
24
|
gap="1"
|
|
17
25
|
transition="all .2s ease-in-out"
|
|
18
26
|
border="1px solid"
|
|
19
|
-
borderColor=
|
|
27
|
+
borderColor={isActive ? 'blue.1' : 'transparent'}
|
|
20
28
|
_hover={{
|
|
21
29
|
borderColor: 'blue.1',
|
|
22
30
|
}}
|
|
31
|
+
_disabled={{
|
|
32
|
+
opacity: 0.5,
|
|
33
|
+
_hover: {
|
|
34
|
+
borderColor: 'transparent',
|
|
35
|
+
},
|
|
36
|
+
}}
|
|
23
37
|
_active={{
|
|
24
38
|
boxShadow: 'md',
|
|
25
39
|
}}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { colors } from '@/theme/colors'
|
|
2
|
+
|
|
3
|
+
export const ShareIcon = ({ stroke = colors.blue[3], size = 24 }) => {
|
|
4
|
+
return (
|
|
5
|
+
<svg
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
width={size}
|
|
8
|
+
height={size}
|
|
9
|
+
viewBox="0 0 19.5 21.5"
|
|
10
|
+
>
|
|
11
|
+
<g
|
|
12
|
+
id="Icon_feather-share-2"
|
|
13
|
+
data-name="Icon feather-share-2"
|
|
14
|
+
transform="translate(-3.75 -2.25)"
|
|
15
|
+
>
|
|
16
|
+
<path
|
|
17
|
+
id="Path_14156"
|
|
18
|
+
data-name="Path 14156"
|
|
19
|
+
d="M28.5,6a3,3,0,1,1-3-3,3,3,0,0,1,3,3Z"
|
|
20
|
+
transform="translate(-6 0)"
|
|
21
|
+
fill="none"
|
|
22
|
+
stroke={stroke}
|
|
23
|
+
strokeLinecap="round"
|
|
24
|
+
strokeLinejoin="round"
|
|
25
|
+
strokeWidth="1.5"
|
|
26
|
+
/>
|
|
27
|
+
<path
|
|
28
|
+
id="Path_14157"
|
|
29
|
+
data-name="Path 14157"
|
|
30
|
+
d="M10.5,16.5a3,3,0,1,1-3-3A3,3,0,0,1,10.5,16.5Z"
|
|
31
|
+
transform="translate(0 -3.5)"
|
|
32
|
+
fill="none"
|
|
33
|
+
stroke={stroke}
|
|
34
|
+
strokeLinecap="round"
|
|
35
|
+
strokeLinejoin="round"
|
|
36
|
+
strokeWidth="1.5"
|
|
37
|
+
/>
|
|
38
|
+
<path
|
|
39
|
+
id="Path_14158"
|
|
40
|
+
data-name="Path 14158"
|
|
41
|
+
d="M28.5,27a3,3,0,1,1-3-3A3,3,0,0,1,28.5,27Z"
|
|
42
|
+
transform="translate(-6 -7)"
|
|
43
|
+
fill="none"
|
|
44
|
+
stroke={stroke}
|
|
45
|
+
strokeLinecap="round"
|
|
46
|
+
strokeLinejoin="round"
|
|
47
|
+
strokeWidth="1.5"
|
|
48
|
+
/>
|
|
49
|
+
<path
|
|
50
|
+
id="Path_14159"
|
|
51
|
+
data-name="Path 14159"
|
|
52
|
+
d="M12.885,20.265l6.83,3.98"
|
|
53
|
+
transform="translate(-2.795 -5.755)"
|
|
54
|
+
fill="none"
|
|
55
|
+
stroke={stroke}
|
|
56
|
+
strokeLinecap="round"
|
|
57
|
+
strokeLinejoin="round"
|
|
58
|
+
strokeWidth="1.5"
|
|
59
|
+
/>
|
|
60
|
+
<path
|
|
61
|
+
id="Path_14160"
|
|
62
|
+
data-name="Path 14160"
|
|
63
|
+
d="M19.7,9.765l-6.82,3.98"
|
|
64
|
+
transform="translate(-2.795 -2.255)"
|
|
65
|
+
fill="none"
|
|
66
|
+
stroke={stroke}
|
|
67
|
+
strokeLinecap="round"
|
|
68
|
+
strokeLinejoin="round"
|
|
69
|
+
strokeWidth="1.5"
|
|
70
|
+
/>
|
|
71
|
+
</g>
|
|
72
|
+
</svg>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
@@ -63,14 +63,18 @@ export const MyHomeCard = ({
|
|
|
63
63
|
)}
|
|
64
64
|
{!isLoading && (
|
|
65
65
|
<>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
{
|
|
67
|
+
accountType !== "Member" && (
|
|
68
|
+
<EditFileUploader
|
|
69
|
+
handleInputChange={(event) => addImage({ event, _id })}
|
|
70
|
+
aria-label={t('ariaLabels.edit')}
|
|
71
|
+
position="absolute"
|
|
72
|
+
right="2"
|
|
73
|
+
top="1"
|
|
74
|
+
id={index === 0 ? 'homePicture' : ''}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
74
78
|
<Image
|
|
75
79
|
src={(image?.bucketName && imageUrl) || randomImages(0)}
|
|
76
80
|
alt={`${name} ${t('images.altImage')}`}
|
|
@@ -4,6 +4,7 @@ import { OverlayI } from '@/interfaces'
|
|
|
4
4
|
export const Overlay = ({
|
|
5
5
|
bg = '#fdfdfdca',
|
|
6
6
|
showOverlay = true,
|
|
7
|
+
onClick,
|
|
7
8
|
...props
|
|
8
9
|
}: OverlayI) => {
|
|
9
10
|
if (!showOverlay) return null
|
|
@@ -15,6 +16,7 @@ export const Overlay = ({
|
|
|
15
16
|
const animation = showOverlay && `${fadeIn} 0.2s ease-in-out`
|
|
16
17
|
return (
|
|
17
18
|
<Box
|
|
19
|
+
onClick={onClick}
|
|
18
20
|
bg={bg}
|
|
19
21
|
top="0"
|
|
20
22
|
left="0"
|
|
@@ -25,6 +25,7 @@ export const GroupCard = ({
|
|
|
25
25
|
title,
|
|
26
26
|
totalAmount,
|
|
27
27
|
disabled,
|
|
28
|
+
itemsDisabled,
|
|
28
29
|
...props
|
|
29
30
|
}: GroupCardI) => {
|
|
30
31
|
const {
|
|
@@ -62,7 +63,7 @@ export const GroupCard = ({
|
|
|
62
63
|
/>
|
|
63
64
|
</Flex>
|
|
64
65
|
<Box pb="10" px="base">
|
|
65
|
-
{isItemsEmpty && <AddItemCard onClick={handleAddItem} />}
|
|
66
|
+
{isItemsEmpty && <AddItemCard disabled={itemsDisabled} onClick={handleAddItem} />}
|
|
66
67
|
|
|
67
68
|
{!isItemsEmpty && (
|
|
68
69
|
<Wrap spacing="base">
|
|
@@ -116,6 +117,7 @@ export const GroupCard = ({
|
|
|
116
117
|
onAddImage={handleImage}
|
|
117
118
|
onClickDelete={onClickDelete}
|
|
118
119
|
onClickDetails={onClickDetails}
|
|
120
|
+
disabled={itemsDisabled}
|
|
119
121
|
{...props}
|
|
120
122
|
{...reportData}
|
|
121
123
|
/>
|
|
@@ -23,6 +23,7 @@ export const ItemCard = ({
|
|
|
23
23
|
room,
|
|
24
24
|
report,
|
|
25
25
|
type,
|
|
26
|
+
disabled,
|
|
26
27
|
onSave,
|
|
27
28
|
...props
|
|
28
29
|
}: ItemCardI) => {
|
|
@@ -73,6 +74,7 @@ export const ItemCard = ({
|
|
|
73
74
|
{ label: t('groups.menu.delete'), handleClick: onClickDelete },
|
|
74
75
|
]}
|
|
75
76
|
onMove={() => handleMove(reportData)}
|
|
77
|
+
disabled={disabled}
|
|
76
78
|
/>
|
|
77
79
|
</Box>
|
|
78
80
|
<Stack
|
|
@@ -82,7 +82,7 @@ export const ShareHomeContactList = ({
|
|
|
82
82
|
<FooterButtons button1={button1} button2={button2} />
|
|
83
83
|
</Box>
|
|
84
84
|
</Container>
|
|
85
|
-
<Overlay bg="
|
|
85
|
+
<Overlay bg="overlay" showOverlay position="fixed" zIndex="4" />
|
|
86
86
|
</>
|
|
87
87
|
)
|
|
88
88
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { t } from 'i18next'
|
|
2
1
|
import {
|
|
3
2
|
Fire,
|
|
4
3
|
House,
|
|
@@ -11,27 +10,27 @@ import { HomeAssistantStepI } from '@/interfaces'
|
|
|
11
10
|
|
|
12
11
|
export const homeAssistantSteps: Array<HomeAssistantStepI> = [
|
|
13
12
|
{
|
|
14
|
-
title:
|
|
13
|
+
title: 'Smoke & CO2 detectors',
|
|
15
14
|
icon: Fire,
|
|
16
15
|
},
|
|
17
16
|
{
|
|
18
|
-
title:
|
|
17
|
+
title: 'Heating & Cooling',
|
|
19
18
|
icon: Temperature,
|
|
20
19
|
},
|
|
21
20
|
{
|
|
22
|
-
title:
|
|
21
|
+
title: 'Appliances',
|
|
23
22
|
icon: LargeAppliances,
|
|
24
23
|
},
|
|
25
24
|
{
|
|
26
|
-
title:
|
|
25
|
+
title: 'Structure',
|
|
27
26
|
icon: House,
|
|
28
27
|
},
|
|
29
28
|
{
|
|
30
|
-
title:
|
|
29
|
+
title: 'Landscape',
|
|
31
30
|
icon: Water,
|
|
32
31
|
},
|
|
33
32
|
{
|
|
34
|
-
title:
|
|
33
|
+
title: 'Goals',
|
|
35
34
|
icon: Target,
|
|
36
35
|
},
|
|
37
36
|
]
|
|
@@ -8,39 +8,39 @@ export const rolePermissions: RolePermissionI[] = [
|
|
|
8
8
|
view: ['member', 'contributor', 'manager'],
|
|
9
9
|
add: ['manager'],
|
|
10
10
|
edit: ['manager'],
|
|
11
|
-
delete: [
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: 'financial-data',
|
|
16
|
-
label: 'Financial Data',
|
|
17
|
-
permissions: {
|
|
18
|
-
view: ['member', 'contributor', 'manager'],
|
|
19
|
-
add: ['contributor', 'manager'],
|
|
20
|
-
edit: ['manager'],
|
|
21
|
-
delete: ['manager'],
|
|
11
|
+
delete: [],
|
|
22
12
|
},
|
|
23
13
|
},
|
|
14
|
+
// {
|
|
15
|
+
// id: 'financial-data',
|
|
16
|
+
// label: 'Financial Data',
|
|
17
|
+
// permissions: {
|
|
18
|
+
// view: ['member', 'contributor', 'manager'],
|
|
19
|
+
// add: ['contributor', 'manager'],
|
|
20
|
+
// edit: ['manager'],
|
|
21
|
+
// delete: ['manager'],
|
|
22
|
+
// },
|
|
23
|
+
// },
|
|
24
24
|
{
|
|
25
25
|
id: 'partners',
|
|
26
26
|
label: 'Partners',
|
|
27
27
|
permissions: {
|
|
28
28
|
view: ['member', 'contributor', 'manager'],
|
|
29
29
|
add: ['contributor', 'manager'],
|
|
30
|
-
edit: [
|
|
31
|
-
delete: ['manager'],
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: 'folders',
|
|
36
|
-
label: 'Folders',
|
|
37
|
-
permissions: {
|
|
38
|
-
view: ['member', 'contributor', 'manager'],
|
|
39
|
-
add: ['manager'],
|
|
40
|
-
edit: ['contributor', 'manager'],
|
|
30
|
+
edit: [],
|
|
41
31
|
delete: ['manager'],
|
|
42
32
|
},
|
|
43
33
|
},
|
|
34
|
+
// {
|
|
35
|
+
// id: 'folders',
|
|
36
|
+
// label: 'Folders',
|
|
37
|
+
// permissions: {
|
|
38
|
+
// view: ['member', 'contributor', 'manager'],
|
|
39
|
+
// add: ['manager'],
|
|
40
|
+
// edit: ['contributor', 'manager'],
|
|
41
|
+
// delete: ['manager'],
|
|
42
|
+
// },
|
|
43
|
+
// },
|
|
44
44
|
{
|
|
45
45
|
id: 'home-items',
|
|
46
46
|
label: 'Home items',
|
|
@@ -62,10 +62,10 @@ export const rolePermissions: RolePermissionI[] = [
|
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
id: 'rooms-
|
|
66
|
-
label: '
|
|
65
|
+
id: 'rooms-categories',
|
|
66
|
+
label: 'Room Categories',
|
|
67
67
|
permissions: {
|
|
68
|
-
view: [
|
|
68
|
+
view: [],
|
|
69
69
|
add: ['contributor', 'manager'],
|
|
70
70
|
edit: ['contributor', 'manager'],
|
|
71
71
|
delete: ['contributor', 'manager'],
|
|
@@ -11,6 +11,7 @@ export const useRolePermissionsTab = ({
|
|
|
11
11
|
onSelect,
|
|
12
12
|
}: RolePermissionsTabI) => {
|
|
13
13
|
const actions: ActionsPermitted[] = ['view', 'add', 'edit', 'delete']
|
|
14
|
+
|
|
14
15
|
const selectedActionsFromSelected = () => {
|
|
15
16
|
const selectedActions: ActionsPermitted[] = []
|
|
16
17
|
actions.forEach((action) => {
|
|
@@ -21,6 +22,7 @@ export const useRolePermissionsTab = ({
|
|
|
21
22
|
})
|
|
22
23
|
return selectedActions
|
|
23
24
|
}
|
|
25
|
+
|
|
24
26
|
const [callback, setCallback] = useState<RolePermissionObject>(selected)
|
|
25
27
|
const [selectedRole, setSelectedRole] = useState<ReducedRoleType>('member')
|
|
26
28
|
const [selectedActions, setSelectedActions] = useState<ActionsPermitted[]>(
|
|
@@ -92,6 +94,12 @@ export const useRolePermissionsTab = ({
|
|
|
92
94
|
useEffect(() => {
|
|
93
95
|
setSelectedActions(selectedActionsFromSelected)
|
|
94
96
|
}, [selectedRole])
|
|
97
|
+
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
setSelectedActions(selectedActionsFromSelected)
|
|
100
|
+
setCallback(selected)
|
|
101
|
+
}, [selected])
|
|
102
|
+
|
|
95
103
|
return {
|
|
96
104
|
actions,
|
|
97
105
|
callback,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuItemI } from
|
|
1
|
+
import { MenuItemI, ShareContactPopoverI } from '@/interfaces'
|
|
2
2
|
|
|
3
3
|
export interface InfoContactCardI {
|
|
4
4
|
address: string
|
|
@@ -16,7 +16,9 @@ export interface InfoContactCardI {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface ContactCardI {
|
|
19
|
+
apiError?: boolean
|
|
19
20
|
contact: InfoContactCardI
|
|
20
21
|
index: number
|
|
21
22
|
menuItems: MenuItemI[]
|
|
23
|
+
onShare: ShareContactPopoverI['onShare']
|
|
22
24
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { InfoContactCardI, MenuItemI } from
|
|
1
|
+
import { InfoContactCardI, MenuItemI, ShareContactPopoverI } from '@/interfaces'
|
|
2
2
|
|
|
3
3
|
export interface ContactCardHeaderI {
|
|
4
|
+
apiError?: boolean
|
|
4
5
|
contact: InfoContactCardI
|
|
5
6
|
menuItems: MenuItemI[]
|
|
6
|
-
|
|
7
|
+
onShare: ShareContactPopoverI['onShare']
|
|
8
|
+
}
|