cozy-sharing 10.4.0 → 11.0.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/.storybook/fixtures/recipients.js +30 -0
- package/.storybook/main.js +18 -0
- package/.storybook/manager.js +6 -0
- package/.storybook/preview-head.html +21 -0
- package/.storybook/preview.jsx +64 -0
- package/.storybook/public/Lato-Bold.immutable.woff2 +0 -0
- package/.storybook/public/Lato-Regular.immutable.woff2 +0 -0
- package/CHANGELOG.md +38 -0
- package/dist/SharedRecipients.js +2 -2
- package/dist/SharedStatus.js +2 -2
- package/dist/SharingOwnerAvatar.js +2 -2
- package/dist/components/{Recipient/RecipientsAvatars.js → Avatar/AvatarList.js} +11 -11
- package/dist/components/{Recipient/RecipientsAvatars.spec.js → Avatar/AvatarList.spec.js} +10 -10
- package/dist/components/Avatar/AvatarList.stories.js +14 -0
- package/dist/components/{Recipient/AvatarPlusX.js → Avatar/ExtraAvatar.js} +4 -4
- package/dist/components/Avatar/ExtraAvatar.stories.js +10 -0
- package/dist/components/{Recipient/RecipientAvatar.js → Avatar/MemberAvatar.js} +2 -2
- package/dist/components/Avatar/MemberAvatar.stories.js +15 -0
- package/dist/components/ConfirmTrustedRecipientsDialog.js +2 -2
- package/dist/components/{Recipient/RecipientPlusX.js → Identity/ExtraIdentity.js} +5 -5
- package/dist/components/Identity/ExtraIdentity.stories.js +13 -0
- package/dist/components/Identity/Identity.stories.js +13 -0
- package/dist/components/{Recipient/RecipientWithoutStatus.js → Identity/MemberIdentity.js} +2 -2
- package/dist/components/Identity/MemberIdentity.stories.js +10 -0
- package/dist/components/Identity/OwnerIdentity.stories.js +10 -0
- package/dist/components/Recipient/LinkRecipient.stories.js +16 -0
- package/dist/components/Recipient/LinkRecipientPermissions.stories.js +10 -0
- package/dist/components/Recipient/{Recipient.js → MemberRecipient.js} +9 -9
- package/dist/components/Recipient/{Recipient.spec.js → MemberRecipient.spec.js} +3 -3
- package/dist/components/Recipient/MemberRecipient.stories.js +39 -0
- package/dist/components/Recipient/{RecipientPermissions.js → MemberRecipientPermissions.js} +2 -2
- package/dist/components/Recipient/MemberRecipientPermissions.stories.js +10 -0
- package/dist/components/Recipient/{RecipientStatus.js → MemberRecipientStatus.js} +2 -2
- package/dist/components/Recipient/MemberRecipientStatus.stories.js +10 -0
- package/dist/components/Recipient/OwnerRecipient.js +2 -2
- package/dist/components/Recipient/OwnerRecipient.stories.js +13 -0
- package/dist/components/Recipient/OwnerRecipientDefault.js +2 -2
- package/dist/components/Recipient/OwnerRecipientDefault.stories.js +10 -0
- package/dist/components/Recipient/RecipientConfirm.js +2 -2
- package/dist/components/Recipient/RecipientConfirm.stories.js +10 -0
- package/dist/components/Recipient/RecipientList.js +2 -2
- package/dist/components/Recipient/RecipientList.stories.js +26 -0
- package/dist/components/ShareModal/SharingDetailsModal.js +1 -1
- package/dist/components/WhoHasAccessLight.js +4 -4
- package/dist/helpers/files.js +10 -0
- package/dist/hooks/useFetchDocumentPath.js +18 -8
- package/dist/stylesheet.css +10 -10
- package/package.json +16 -5
- package/src/SharedRecipients.jsx +2 -2
- package/src/SharedStatus.jsx +2 -2
- package/src/SharingOwnerAvatar.jsx +2 -2
- package/src/components/{Recipient/RecipientsAvatars.jsx → Avatar/AvatarList.jsx} +12 -11
- package/src/components/{Recipient/RecipientsAvatars.spec.jsx → Avatar/AvatarList.spec.jsx} +12 -11
- package/src/components/Avatar/AvatarList.stories.jsx +16 -0
- package/src/components/{Recipient/AvatarPlusX.jsx → Avatar/ExtraAvatar.jsx} +4 -4
- package/src/components/Avatar/ExtraAvatar.stories.jsx +13 -0
- package/src/components/{Recipient/RecipientAvatar.jsx → Avatar/MemberAvatar.jsx} +2 -2
- package/src/components/Avatar/MemberAvatar.stories.jsx +18 -0
- package/src/components/ConfirmTrustedRecipientsDialog.jsx +2 -2
- package/src/components/{Recipient/RecipientPlusX.jsx → Identity/ExtraIdentity.jsx} +5 -5
- package/src/components/Identity/ExtraIdentity.stories.jsx +16 -0
- package/src/components/Identity/Identity.stories.jsx +16 -0
- package/src/components/{Recipient/RecipientWithoutStatus.jsx → Identity/MemberIdentity.jsx} +2 -2
- package/src/components/Identity/MemberIdentity.stories.jsx +13 -0
- package/src/components/Identity/OwnerIdentity.stories.jsx +13 -0
- package/src/components/Recipient/LinkRecipient.stories.jsx +17 -0
- package/src/components/Recipient/LinkRecipientPermissions.stories.jsx +13 -0
- package/src/components/Recipient/{Recipient.jsx → MemberRecipient.jsx} +14 -10
- package/src/components/Recipient/{Recipient.spec.jsx → MemberRecipient.spec.jsx} +3 -3
- package/src/components/Recipient/MemberRecipient.stories.jsx +44 -0
- package/src/components/Recipient/{RecipientPermissions.jsx → MemberRecipientPermissions.jsx} +2 -2
- package/src/components/Recipient/MemberRecipientPermissions.stories.jsx +13 -0
- package/src/components/Recipient/{RecipientStatus.jsx → MemberRecipientStatus.jsx} +2 -2
- package/src/components/Recipient/MemberRecipientStatus.stories.jsx +13 -0
- package/src/components/Recipient/OwnerRecipient.jsx +2 -2
- package/src/components/Recipient/OwnerRecipient.stories.jsx +16 -0
- package/src/components/Recipient/OwnerRecipientDefault.jsx +2 -2
- package/src/components/Recipient/OwnerRecipientDefault.stories.jsx +13 -0
- package/src/components/Recipient/RecipientConfirm.jsx +7 -9
- package/src/components/Recipient/RecipientConfirm.stories.jsx +13 -0
- package/src/components/Recipient/RecipientList.jsx +2 -2
- package/src/components/Recipient/RecipientList.stories.jsx +28 -0
- package/src/components/ShareModal/SharingDetailsModal.jsx +1 -1
- package/src/components/WhoHasAccessLight.jsx +4 -4
- package/src/helpers/files.js +9 -0
- package/src/hooks/useFetchDocumentPath.jsx +4 -0
- /package/dist/components/{Recipient → Identity}/Identity.js +0 -0
- /package/dist/components/{Recipient → Identity}/OwnerIdentity.js +0 -0
- /package/src/components/{Recipient → Identity}/Identity.jsx +0 -0
- /package/src/components/{Recipient → Identity}/OwnerIdentity.jsx +0 -0
|
@@ -3,10 +3,11 @@ import React from 'react'
|
|
|
3
3
|
|
|
4
4
|
import { createMockClient } from 'cozy-client'
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import {
|
|
7
|
+
AvatarList,
|
|
7
8
|
MAX_DISPLAYED_RECIPIENTS,
|
|
8
9
|
excludeMeAsOwnerFromRecipients
|
|
9
|
-
} from './
|
|
10
|
+
} from './AvatarList'
|
|
10
11
|
import AppLike from '../../../test/AppLike'
|
|
11
12
|
|
|
12
13
|
const mockRecipients = new Array(MAX_DISPLAYED_RECIPIENTS - 1)
|
|
@@ -42,7 +43,7 @@ const mockMoreRecipientsThanMaxDisplayed = [
|
|
|
42
43
|
}
|
|
43
44
|
]
|
|
44
45
|
|
|
45
|
-
describe('
|
|
46
|
+
describe('AvatarList', () => {
|
|
46
47
|
const client = createMockClient({})
|
|
47
48
|
|
|
48
49
|
const setup = ({
|
|
@@ -54,7 +55,7 @@ describe('RecipientsAvatars', () => {
|
|
|
54
55
|
}) => {
|
|
55
56
|
return render(
|
|
56
57
|
<AppLike client={client}>
|
|
57
|
-
<
|
|
58
|
+
<AvatarList
|
|
58
59
|
recipients={recipients}
|
|
59
60
|
onClick={onClick}
|
|
60
61
|
isOwner={isOwner}
|
|
@@ -70,19 +71,19 @@ describe('RecipientsAvatars', () => {
|
|
|
70
71
|
link: true
|
|
71
72
|
})
|
|
72
73
|
|
|
73
|
-
expect(getByTestId('
|
|
74
|
+
expect(getByTestId('AvatarList-link')).toBeTruthy()
|
|
74
75
|
})
|
|
75
76
|
|
|
76
77
|
it('should not render link icon if a link is not generated', () => {
|
|
77
78
|
const { queryByTestId } = setup({})
|
|
78
79
|
|
|
79
|
-
expect(queryByTestId('
|
|
80
|
+
expect(queryByTestId('AvatarList-link')).toBeNull()
|
|
80
81
|
})
|
|
81
82
|
|
|
82
83
|
it('should hide me as owner by default', () => {
|
|
83
84
|
const { queryByTestId } = setup({})
|
|
84
85
|
|
|
85
|
-
expect(queryByTestId('
|
|
86
|
+
expect(queryByTestId('AvatarList-avatar-owner')).toBeNull()
|
|
86
87
|
})
|
|
87
88
|
|
|
88
89
|
it('should show me as owner if required', () => {
|
|
@@ -90,7 +91,7 @@ describe('RecipientsAvatars', () => {
|
|
|
90
91
|
showMeAsOwner: true
|
|
91
92
|
})
|
|
92
93
|
|
|
93
|
-
expect(getByTestId('
|
|
94
|
+
expect(getByTestId('AvatarList-avatar-owner')).toBeTruthy()
|
|
94
95
|
})
|
|
95
96
|
|
|
96
97
|
it('should show a +X icon with the correct number if there is more avatars than expected', () => {
|
|
@@ -102,7 +103,7 @@ describe('RecipientsAvatars', () => {
|
|
|
102
103
|
const delta =
|
|
103
104
|
mockMoreRecipientsThanMaxDisplayed.length - MAX_DISPLAYED_RECIPIENTS
|
|
104
105
|
|
|
105
|
-
expect(getByTestId('
|
|
106
|
+
expect(getByTestId('AvatarList-plusX')).toBeTruthy()
|
|
106
107
|
expect(getByText(`+${delta}`)).toBeTruthy()
|
|
107
108
|
})
|
|
108
109
|
|
|
@@ -113,8 +114,8 @@ describe('RecipientsAvatars', () => {
|
|
|
113
114
|
link: true
|
|
114
115
|
})
|
|
115
116
|
|
|
116
|
-
expect(getByTestId('
|
|
117
|
-
expect(getByTestId('
|
|
117
|
+
expect(getByTestId('AvatarList-plusX')).toBeTruthy()
|
|
118
|
+
expect(getByTestId('AvatarList-link')).toBeTruthy()
|
|
118
119
|
})
|
|
119
120
|
})
|
|
120
121
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AvatarList } from './AvatarList'
|
|
2
|
+
import { recipients } from '../../../.storybook/fixtures/recipients'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
component: AvatarList,
|
|
6
|
+
args: {
|
|
7
|
+
recipients: [...recipients, ...recipients]
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
|
|
13
|
+
export const Default = {
|
|
14
|
+
name: 'Default',
|
|
15
|
+
args: {}
|
|
16
|
+
}
|
|
@@ -6,7 +6,7 @@ import Avatar from 'cozy-ui/transpiled/react/Avatar'
|
|
|
6
6
|
|
|
7
7
|
import { SharingTooltip, TooltipRecipientList } from '../Tooltip'
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const ExtraAvatar = ({ className, size, extraRecipients = [] }) => {
|
|
10
10
|
const sharingTooltipId = uniqueId('extra-recipients-avatar-')
|
|
11
11
|
|
|
12
12
|
return (
|
|
@@ -27,15 +27,15 @@ const AvatarPlusX = ({ className, size, extraRecipients = [] }) => {
|
|
|
27
27
|
)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
ExtraAvatar.propTypes = {
|
|
31
31
|
extraRecipients: PropTypes.arrayOf(PropTypes.string),
|
|
32
32
|
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
33
33
|
className: PropTypes.string
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
ExtraAvatar.defaultProps = {
|
|
37
37
|
extraRecipients: [],
|
|
38
38
|
size: 'medium'
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export
|
|
41
|
+
export { ExtraAvatar }
|
|
@@ -5,7 +5,7 @@ import Avatar from 'cozy-ui/transpiled/react/Avatar'
|
|
|
5
5
|
|
|
6
6
|
import { getDisplayName, getInitials } from '../../models'
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const MemberAvatar = ({ recipient, ...rest }) => {
|
|
9
9
|
const client = useClient()
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -35,4 +35,4 @@ const RecipientAvatar = ({ recipient, ...rest }) => {
|
|
|
35
35
|
)
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export
|
|
38
|
+
export { MemberAvatar }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MemberAvatar } from './MemberAvatar'
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
component: MemberAvatar,
|
|
5
|
+
args: {
|
|
6
|
+
recipient: {
|
|
7
|
+
avatarPath: null,
|
|
8
|
+
name: 'John Doe'
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
|
|
15
|
+
export const Default = {
|
|
16
|
+
name: 'Default',
|
|
17
|
+
args: {}
|
|
18
|
+
}
|
|
@@ -3,7 +3,7 @@ import React from 'react'
|
|
|
3
3
|
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
4
4
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import MemberRecipient from './Recipient/MemberRecipient'
|
|
7
7
|
import ShareDialogTwoStepsConfirmationContainer from './ShareDialogTwoStepsConfirmationContainer'
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -20,7 +20,7 @@ const SharingContent = ({ recipientsToBeConfirmed, verifyRecipient }) => {
|
|
|
20
20
|
|
|
21
21
|
{recipientsToBeConfirmed.map(recipientConfirmationData => {
|
|
22
22
|
return (
|
|
23
|
-
<
|
|
23
|
+
<MemberRecipient
|
|
24
24
|
{...recipientConfirmationData}
|
|
25
25
|
key={`key_r_${recipientConfirmationData.id}`}
|
|
26
26
|
isOwner={false}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import PropTypes from 'prop-types'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
|
-
import AvatarPlusX from './AvatarPlusX'
|
|
5
4
|
import Identity from './Identity'
|
|
6
5
|
import { getDisplayName } from '../../models'
|
|
7
6
|
import styles from '../../styles/recipient.styl'
|
|
7
|
+
import { ExtraAvatar } from '../Avatar/ExtraAvatar'
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const ExtraIdentity = ({ extraRecipients }, { t }) => (
|
|
10
10
|
<div className={styles['recipient']}>
|
|
11
|
-
<
|
|
11
|
+
<ExtraAvatar
|
|
12
12
|
extraRecipients={extraRecipients.map(recipient =>
|
|
13
13
|
getDisplayName(recipient)
|
|
14
14
|
)}
|
|
@@ -21,8 +21,8 @@ const RecipientPlusX = ({ extraRecipients }, { t }) => (
|
|
|
21
21
|
</div>
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
ExtraIdentity.contextTypes = {
|
|
25
25
|
t: PropTypes.func.isRequired
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export
|
|
28
|
+
export { ExtraIdentity }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ExtraIdentity } from './ExtraIdentity'
|
|
2
|
+
import { recipients } from '../../../.storybook/fixtures/recipients'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
component: ExtraIdentity,
|
|
6
|
+
args: {
|
|
7
|
+
extraRecipients: recipients
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
|
|
13
|
+
export const Default = {
|
|
14
|
+
name: 'Default',
|
|
15
|
+
args: {}
|
|
16
|
+
}
|
|
@@ -6,7 +6,7 @@ import Identity from './Identity'
|
|
|
6
6
|
import { getDisplayName, getInitials } from '../../models'
|
|
7
7
|
import styles from '../../styles/recipient.styl'
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const MemberIdentity = ({ instance, ...rest }) => {
|
|
10
10
|
const name = getDisplayName(rest)
|
|
11
11
|
return (
|
|
12
12
|
<div className={styles['recipient']}>
|
|
@@ -18,4 +18,4 @@ const RecipientWithoutStatus = ({ instance, ...rest }) => {
|
|
|
18
18
|
)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export
|
|
21
|
+
export { MemberIdentity }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import LinkRecipient from './LinkRecipient'
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
component: LinkRecipient,
|
|
5
|
+
args: {
|
|
6
|
+
recipientConfirmationData: false,
|
|
7
|
+
verifyRecipient: () => true,
|
|
8
|
+
link: 'test',
|
|
9
|
+
fadeIn: false
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
|
|
15
|
+
export const Default = {
|
|
16
|
+
name: 'Default'
|
|
17
|
+
}
|
|
@@ -9,16 +9,16 @@ import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
|
|
|
9
9
|
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
10
10
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
11
11
|
|
|
12
|
-
import
|
|
12
|
+
import MemberRecipientPermissions from './MemberRecipientPermissions'
|
|
13
|
+
import MemberRecipientStatus from './MemberRecipientStatus'
|
|
13
14
|
import RecipientConfirm from './RecipientConfirm'
|
|
14
|
-
import RecipientPermissions from './RecipientPermissions'
|
|
15
|
-
import RecipientStatus from './RecipientStatus'
|
|
16
15
|
import { FADE_IN_DURATION } from '../../helpers/recipients'
|
|
17
16
|
import { getDisplayName } from '../../models'
|
|
17
|
+
import { MemberAvatar } from '../Avatar/MemberAvatar'
|
|
18
18
|
|
|
19
19
|
const DEFAULT_DISPLAY_NAME = 'Share.contacts.defaultDisplayName'
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const MemberRecipient = props => {
|
|
22
22
|
const { t } = useI18n()
|
|
23
23
|
const client = useClient()
|
|
24
24
|
|
|
@@ -41,16 +41,16 @@ const Recipient = props => {
|
|
|
41
41
|
<RecipientConfirm
|
|
42
42
|
recipientConfirmationData={recipientConfirmationData}
|
|
43
43
|
verifyRecipient={verifyRecipient}
|
|
44
|
-
|
|
44
|
+
/>
|
|
45
45
|
) : (
|
|
46
|
-
<
|
|
46
|
+
<MemberRecipientPermissions {...props} className="u-flex-shrink-0" />
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
return (
|
|
50
50
|
<Fade in timeout={fadeIn ? FADE_IN_DURATION : 0}>
|
|
51
51
|
<ListItem disableGutters>
|
|
52
52
|
<ListItemIcon>
|
|
53
|
-
<
|
|
53
|
+
<MemberAvatar size="small" recipient={props} />
|
|
54
54
|
</ListItemIcon>
|
|
55
55
|
<ListItemText
|
|
56
56
|
primary={
|
|
@@ -59,7 +59,11 @@ const Recipient = props => {
|
|
|
59
59
|
</Typography>
|
|
60
60
|
}
|
|
61
61
|
secondary={
|
|
62
|
-
<
|
|
62
|
+
<MemberRecipientStatus
|
|
63
|
+
status={status}
|
|
64
|
+
isMe={isMe}
|
|
65
|
+
instance={instance}
|
|
66
|
+
/>
|
|
63
67
|
}
|
|
64
68
|
/>
|
|
65
69
|
{RightPart}
|
|
@@ -68,7 +72,7 @@ const Recipient = props => {
|
|
|
68
72
|
)
|
|
69
73
|
}
|
|
70
74
|
|
|
71
|
-
|
|
75
|
+
MemberRecipient.propTypes = {
|
|
72
76
|
instance: PropTypes.string,
|
|
73
77
|
isOwner: PropTypes.bool,
|
|
74
78
|
status: PropTypes.string,
|
|
@@ -76,4 +80,4 @@ Recipient.propTypes = {
|
|
|
76
80
|
verifyRecipient: PropTypes.func
|
|
77
81
|
}
|
|
78
82
|
|
|
79
|
-
export default
|
|
83
|
+
export default MemberRecipient
|
|
@@ -3,10 +3,10 @@ import React from 'react'
|
|
|
3
3
|
|
|
4
4
|
import { createMockClient } from 'cozy-client'
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import MemberRecipient from './MemberRecipient'
|
|
7
7
|
import AppLike from '../../../test/AppLike'
|
|
8
8
|
|
|
9
|
-
describe('
|
|
9
|
+
describe('MemberRecipient component', () => {
|
|
10
10
|
const client = createMockClient({})
|
|
11
11
|
client.options = {
|
|
12
12
|
uri: 'foo.mycozy.cloud'
|
|
@@ -15,7 +15,7 @@ describe('Recipient component', () => {
|
|
|
15
15
|
const setup = props => {
|
|
16
16
|
return render(
|
|
17
17
|
<AppLike client={client}>
|
|
18
|
-
<
|
|
18
|
+
<MemberRecipient {...props} />
|
|
19
19
|
</AppLike>
|
|
20
20
|
)
|
|
21
21
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import MemberRecipient from './MemberRecipient'
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
component: MemberRecipient,
|
|
5
|
+
args: {
|
|
6
|
+
instance: 'https://example.com',
|
|
7
|
+
isOwner: false,
|
|
8
|
+
status: 'ready',
|
|
9
|
+
recipientConfirmationData: null,
|
|
10
|
+
verifyRecipient: () => {},
|
|
11
|
+
fadeIn: true
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
status: {
|
|
15
|
+
control: 'select',
|
|
16
|
+
options: ['ready', 'mail-not-sent', 'pending', 'seen', 'owner'],
|
|
17
|
+
defaultValue: 'ready'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default meta
|
|
23
|
+
|
|
24
|
+
export const Default = {
|
|
25
|
+
name: 'Default',
|
|
26
|
+
args: {}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const Owner = {
|
|
30
|
+
name: 'Owner',
|
|
31
|
+
args: {
|
|
32
|
+
isOwner: true,
|
|
33
|
+
status: 'owner'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const RecipientConfirm = {
|
|
38
|
+
name: 'RecipientConfirm',
|
|
39
|
+
args: {
|
|
40
|
+
recipientConfirmationData: {
|
|
41
|
+
email: 'test'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/components/Recipient/{RecipientPermissions.jsx → MemberRecipientPermissions.jsx}
RENAMED
|
@@ -13,7 +13,7 @@ import ActionMenu, {
|
|
|
13
13
|
} from 'cozy-ui/transpiled/react/deprecated/ActionMenu'
|
|
14
14
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const MemberRecipientPermissions = ({
|
|
17
17
|
isOwner,
|
|
18
18
|
status,
|
|
19
19
|
instance,
|
|
@@ -113,4 +113,4 @@ const RecipientPermissions = ({
|
|
|
113
113
|
)
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
export default
|
|
116
|
+
export default MemberRecipientPermissions
|
|
@@ -10,7 +10,7 @@ import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
|
10
10
|
|
|
11
11
|
import styles from '../../styles/recipient.styl'
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const MemberRecipientStatus = ({ status, isMe, instance }) => {
|
|
14
14
|
const { t } = useI18n()
|
|
15
15
|
|
|
16
16
|
const isSendingEmail = !isMe && status === 'mail-not-sent'
|
|
@@ -45,4 +45,4 @@ const RecipientStatus = ({ status, isMe, instance }) => {
|
|
|
45
45
|
)
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export default
|
|
48
|
+
export default MemberRecipientStatus
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import PropTypes from 'prop-types'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
|
+
import MemberRecipient from './MemberRecipient'
|
|
4
5
|
import OwnerRecipientDefault from './OwnerRecipientDefault'
|
|
5
|
-
import Recipient from './Recipient'
|
|
6
6
|
|
|
7
7
|
const OwnerRecipient = ({ recipients }) => {
|
|
8
8
|
const ownerRecipient = recipients.find(
|
|
@@ -10,7 +10,7 @@ const OwnerRecipient = ({ recipients }) => {
|
|
|
10
10
|
)
|
|
11
11
|
|
|
12
12
|
if (ownerRecipient) {
|
|
13
|
-
return <
|
|
13
|
+
return <MemberRecipient {...ownerRecipient} />
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
return <OwnerRecipientDefault />
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import OwnerRecipient from './OwnerRecipient'
|
|
2
|
+
import { recipients } from '../../../.storybook/fixtures/recipients'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
component: OwnerRecipient,
|
|
6
|
+
args: {
|
|
7
|
+
recipients
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
|
|
13
|
+
export const Default = {
|
|
14
|
+
name: 'Default',
|
|
15
|
+
args: {}
|
|
16
|
+
}
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { useClient, useQuery, hasQueryBeenLoaded } from 'cozy-client'
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import MemberRecipient from './MemberRecipient'
|
|
6
6
|
import { buildInstanceSettingsQuery } from '../../queries/queries'
|
|
7
7
|
|
|
8
8
|
const OwnerRecipientDefault = () => {
|
|
@@ -16,7 +16,7 @@ const OwnerRecipientDefault = () => {
|
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
hasQueryBeenLoaded(instanceSettingsResult) && (
|
|
19
|
-
<
|
|
19
|
+
<MemberRecipient
|
|
20
20
|
isOwner={true}
|
|
21
21
|
status="owner"
|
|
22
22
|
instance={client.options.uri}
|
|
@@ -17,15 +17,13 @@ const RecipientConfirm = ({ recipientConfirmationData, verifyRecipient }) => {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/>
|
|
28
|
-
</>
|
|
20
|
+
<Button
|
|
21
|
+
style={{ position: 'initial' }} // fix z-index bug on iOS when under a BottomDrawer due to relative position
|
|
22
|
+
theme="text"
|
|
23
|
+
className={modalStyles['aligned-dropdown-button']}
|
|
24
|
+
onClick={verify}
|
|
25
|
+
label={t(`Share.twoStepsConfirmation.verify`)}
|
|
26
|
+
/>
|
|
29
27
|
)
|
|
30
28
|
}
|
|
31
29
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import MemberRecipient from './MemberRecipient'
|
|
4
4
|
import { usePrevious } from '../../helpers/hooks'
|
|
5
5
|
import { filterAndReworkRecipients } from '../../helpers/recipients'
|
|
6
6
|
|
|
@@ -26,7 +26,7 @@ const RecipientList = ({
|
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<
|
|
29
|
+
<MemberRecipient
|
|
30
30
|
{...recipient}
|
|
31
31
|
key={`key_r_${recipient.index}`}
|
|
32
32
|
isOwner={isOwner}
|