cozy-sharing 12.0.0 → 12.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/CHANGELOG.md +23 -0
- package/dist/components/ConfirmTrustedRecipientsDialog.js +11 -3
- package/dist/components/ConfirmTrustedRecipientsDialog.stories.js +39 -0
- package/dist/components/ContactSuggestion.js +3 -14
- package/dist/components/ContactSuggestion.spec.js +22 -104
- package/dist/components/Recipient/GroupRecipient.js +36 -5
- package/dist/components/Recipient/GroupRecipient.stories.js +3 -2
- package/dist/components/Recipient/GroupRecipientDetail.js +43 -0
- package/dist/components/Recipient/GroupRecipientDetail.stories.js +55 -0
- package/dist/components/Recipient/GroupRecipientDetailWithAccess.js +44 -0
- package/dist/components/Recipient/GroupRecipientDetailWithoutAccess.js +45 -0
- package/dist/components/Recipient/LinkRecipient.js +5 -1
- package/dist/components/Recipient/MemberRecipient.js +5 -1
- package/dist/components/Recipient/RecipientList.stories.js +3 -0
- package/dist/components/ShareAutosuggest.js +0 -3
- package/dist/components/ShareDialogCozyToCozy.js +9 -3
- package/dist/components/ShareDialogOnlyByLink.js +12 -4
- package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +1 -0
- package/dist/components/ShareModal/SharingDetailsModal.js +7 -1
- package/dist/components/ShareRecipientsInput.js +23 -1
- package/dist/components/ShareRecipientsInput.spec.js +206 -115
- package/dist/components/WhoHasAccess.js +1 -3
- package/jest.config.js +2 -1
- package/locales/en.json +13 -0
- package/locales/fr.json +13 -0
- package/package.json +2 -2
- package/src/components/ConfirmTrustedRecipientsDialog.jsx +24 -13
- package/src/components/ConfirmTrustedRecipientsDialog.stories.jsx +45 -0
- package/src/components/ContactSuggestion.jsx +3 -17
- package/src/components/ContactSuggestion.spec.jsx +16 -99
- package/src/components/Recipient/GroupRecipient.jsx +51 -24
- package/src/components/Recipient/GroupRecipient.stories.jsx +3 -2
- package/src/components/Recipient/GroupRecipientDetail.jsx +50 -0
- package/src/components/Recipient/GroupRecipientDetail.stories.jsx +53 -0
- package/src/components/Recipient/GroupRecipientDetailWithAccess.jsx +57 -0
- package/src/components/Recipient/GroupRecipientDetailWithoutAccess.jsx +60 -0
- package/src/components/Recipient/LinkRecipient.jsx +3 -1
- package/src/components/Recipient/MemberRecipient.jsx +3 -1
- package/src/components/Recipient/RecipientList.stories.jsx +3 -0
- package/src/components/ShareAutosuggest.jsx +1 -6
- package/src/components/ShareDialogCozyToCozy.jsx +40 -36
- package/src/components/ShareDialogOnlyByLink.jsx +22 -8
- package/src/components/ShareDialogTwoStepsConfirmationContainer.jsx +1 -0
- package/src/components/ShareModal/SharingDetailsModal.jsx +10 -1
- package/src/components/ShareRecipientsInput.jsx +19 -1
- package/src/components/ShareRecipientsInput.spec.jsx +170 -108
- package/src/components/WhoHasAccess.jsx +1 -1
- package/src/components/__snapshots__/ContactSuggestion.spec.jsx.snap +0 -1192
- package/src/components/__snapshots__/ShareRecipientsInput.spec.jsx.snap +0 -99
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import get from 'lodash/get'
|
|
2
1
|
import PropTypes from 'prop-types'
|
|
3
2
|
import React from 'react'
|
|
4
3
|
|
|
@@ -13,28 +12,15 @@ import { Contact, Group, getDisplayName, getInitials } from '../models'
|
|
|
13
12
|
|
|
14
13
|
const ContactModel = models.contact
|
|
15
14
|
|
|
16
|
-
export const ContactSuggestion = ({ contactOrGroup
|
|
15
|
+
export const ContactSuggestion = ({ contactOrGroup }) => {
|
|
17
16
|
const { t } = useI18n()
|
|
18
17
|
let avatarText, name, details
|
|
19
18
|
if (contactOrGroup._type === Group.doctype) {
|
|
20
19
|
name = contactOrGroup.name
|
|
21
|
-
|
|
22
|
-
.reduce((total, contact) => {
|
|
23
|
-
if (
|
|
24
|
-
get(contact, 'relationships.groups.data', [])
|
|
25
|
-
.map(group => group._id)
|
|
26
|
-
.includes(contactOrGroup._id)
|
|
27
|
-
) {
|
|
28
|
-
return total + 1
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return total
|
|
32
|
-
}, 0)
|
|
33
|
-
.toString()
|
|
20
|
+
avatarText = 'G'
|
|
34
21
|
details = t('Share.members.count', {
|
|
35
|
-
smart_count: membersCount
|
|
22
|
+
smart_count: contactOrGroup.membersCount.toString()
|
|
36
23
|
})
|
|
37
|
-
avatarText = 'G'
|
|
38
24
|
} else {
|
|
39
25
|
name = getDisplayName(contactOrGroup)
|
|
40
26
|
avatarText = getInitials(contactOrGroup)
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render, screen } from '@testing-library/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
import { ContactSuggestion } from './ContactSuggestion'
|
|
5
5
|
import AppLike from '../../test/AppLike'
|
|
6
6
|
|
|
7
|
-
const WrappingComponent = ({ children }) => <AppLike>{children}</AppLike>
|
|
8
|
-
|
|
9
7
|
describe('ContactSuggestion component', () => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
8
|
+
const setup = ({ contactOrGroup }) => {
|
|
9
|
+
return render(<ContactSuggestion contactOrGroup={contactOrGroup} />, {
|
|
10
|
+
wrapper: AppLike
|
|
11
|
+
})
|
|
12
|
+
}
|
|
14
13
|
|
|
15
|
-
return s
|
|
16
|
-
})
|
|
17
14
|
it('should display contact suggestion for a contact', () => {
|
|
18
15
|
const jonSnow = {
|
|
19
16
|
_id: 'f3a4e501-abbd',
|
|
@@ -36,17 +33,9 @@ describe('ContactSuggestion component', () => {
|
|
|
36
33
|
],
|
|
37
34
|
_type: 'io.cozy.contacts'
|
|
38
35
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
contacts,
|
|
43
|
-
t: fakeT
|
|
44
|
-
}
|
|
45
|
-
const jsx = <ContactSuggestion {...props} />
|
|
46
|
-
const wrapper = mount(jsx, {
|
|
47
|
-
wrappingComponent: WrappingComponent
|
|
48
|
-
})
|
|
49
|
-
expect(wrapper).toMatchSnapshot()
|
|
36
|
+
setup({ contactOrGroup: jonSnow })
|
|
37
|
+
expect(screen.getByText('Jon Snow')).toBeInTheDocument()
|
|
38
|
+
expect(screen.getByText('https://jonsnow.mycozy.cloud')).toBeInTheDocument()
|
|
50
39
|
})
|
|
51
40
|
|
|
52
41
|
it('should display contact suggestion for a contact without fullname (for example created by a share modal)', () => {
|
|
@@ -62,91 +51,19 @@ describe('ContactSuggestion component', () => {
|
|
|
62
51
|
name: undefined,
|
|
63
52
|
_type: 'io.cozy.contacts'
|
|
64
53
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
contactOrGroup: jonSnow,
|
|
68
|
-
contacts,
|
|
69
|
-
t: fakeT
|
|
70
|
-
}
|
|
71
|
-
const jsx = <ContactSuggestion {...props} />
|
|
72
|
-
const wrapper = mount(jsx, {
|
|
73
|
-
wrappingComponent: WrappingComponent
|
|
74
|
-
})
|
|
75
|
-
expect(wrapper).toMatchSnapshot()
|
|
54
|
+
setup({ contactOrGroup: jonSnow })
|
|
55
|
+
expect(screen.getByText('jon.snow@email.com')).toBeInTheDocument()
|
|
76
56
|
})
|
|
77
57
|
|
|
78
58
|
it('should display contact suggestion for a group', () => {
|
|
79
|
-
const jon = {
|
|
80
|
-
_id: 'f3a4e501-abbd',
|
|
81
|
-
fullname: 'Jon Snow',
|
|
82
|
-
name: {
|
|
83
|
-
givenName: 'Jon',
|
|
84
|
-
familyName: 'Snow'
|
|
85
|
-
},
|
|
86
|
-
email: [
|
|
87
|
-
{
|
|
88
|
-
address: 'jon.snow@email.com',
|
|
89
|
-
type: 'primary'
|
|
90
|
-
}
|
|
91
|
-
],
|
|
92
|
-
_type: 'io.cozy.contacts',
|
|
93
|
-
relationships: {
|
|
94
|
-
groups: {
|
|
95
|
-
data: [{ _id: '610718e6-2d7a', _type: 'io.cozy.contacts.groups' }]
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
const cersei = {
|
|
100
|
-
_id: '42dc490a-7878',
|
|
101
|
-
fullname: 'Cersei Lannister',
|
|
102
|
-
name: {
|
|
103
|
-
givenName: 'Cersei',
|
|
104
|
-
familyName: 'Lannister'
|
|
105
|
-
},
|
|
106
|
-
email: [
|
|
107
|
-
{
|
|
108
|
-
address: 'cersei@email.com',
|
|
109
|
-
type: 'primary'
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
_type: 'io.cozy.contacts',
|
|
113
|
-
relationships: { groups: { data: [] } }
|
|
114
|
-
}
|
|
115
|
-
const sam = {
|
|
116
|
-
_id: 'b5bed853-93da',
|
|
117
|
-
fullname: 'Samwell Tarly',
|
|
118
|
-
name: {
|
|
119
|
-
givenName: 'Samwell',
|
|
120
|
-
familyName: 'Tarly'
|
|
121
|
-
},
|
|
122
|
-
email: [
|
|
123
|
-
{
|
|
124
|
-
address: 'samwell@email.com',
|
|
125
|
-
type: 'primary'
|
|
126
|
-
}
|
|
127
|
-
],
|
|
128
|
-
_type: 'io.cozy.contacts',
|
|
129
|
-
relationships: {
|
|
130
|
-
groups: {
|
|
131
|
-
data: [{ _id: '610718e6-2d7a', _type: 'io.cozy.contacts.groups' }]
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
const contacts = [jon, cersei, sam]
|
|
136
59
|
const theNightsWatch = {
|
|
137
60
|
_id: '610718e6-2d7a',
|
|
138
61
|
name: "The Night's Watch",
|
|
139
|
-
_type: 'io.cozy.contacts.groups'
|
|
62
|
+
_type: 'io.cozy.contacts.groups',
|
|
63
|
+
membersCount: 2
|
|
140
64
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
t: fakeT
|
|
145
|
-
}
|
|
146
|
-
const jsx = <ContactSuggestion {...props} />
|
|
147
|
-
const wrapper = mount(jsx, {
|
|
148
|
-
wrappingComponent: WrappingComponent
|
|
149
|
-
})
|
|
150
|
-
expect(wrapper).toMatchSnapshot()
|
|
65
|
+
setup({ contactOrGroup: theNightsWatch })
|
|
66
|
+
expect(screen.getByText("The Night's Watch")).toBeInTheDocument()
|
|
67
|
+
expect(screen.getByText('2 members')).toBeInTheDocument()
|
|
151
68
|
})
|
|
152
69
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
2
|
|
|
3
3
|
import { useClient } from 'cozy-client'
|
|
4
4
|
import Fade from 'cozy-ui/transpiled/react/Fade'
|
|
@@ -7,16 +7,21 @@ import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
|
|
|
7
7
|
import ListItemSecondaryAction from 'cozy-ui/transpiled/react/ListItemSecondaryAction'
|
|
8
8
|
import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
|
|
9
9
|
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
10
|
+
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
10
11
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
11
12
|
|
|
13
|
+
import { GroupRecipientDetail } from './GroupRecipientDetail'
|
|
12
14
|
import { GroupRecipientPermissions } from './GroupRecipientPermissions'
|
|
13
15
|
import { FADE_IN_DURATION } from '../../helpers/recipients'
|
|
14
16
|
import { GroupAvatar } from '../Avatar/GroupAvatar'
|
|
15
17
|
|
|
16
18
|
const GroupRecipient = props => {
|
|
17
|
-
const { name, members, fadeIn } = props
|
|
19
|
+
const { name, members, fadeIn, owner } = props
|
|
18
20
|
const { t } = useI18n()
|
|
19
21
|
const client = useClient()
|
|
22
|
+
const { isMobile } = useBreakpoints()
|
|
23
|
+
|
|
24
|
+
const [isDetailOpened, setDetailOpened] = useState(false)
|
|
20
25
|
|
|
21
26
|
const nbMember = members.length
|
|
22
27
|
const nbMemberReady = members.filter(
|
|
@@ -26,30 +31,52 @@ const GroupRecipient = props => {
|
|
|
26
31
|
member => member.instance === client.options.uri
|
|
27
32
|
)
|
|
28
33
|
|
|
34
|
+
const toogleDetailOpened = () => {
|
|
35
|
+
setDetailOpened(!isDetailOpened)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const closeDetail = () => {
|
|
39
|
+
setDetailOpened(false)
|
|
40
|
+
}
|
|
41
|
+
|
|
29
42
|
return (
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
<>
|
|
44
|
+
<Fade in timeout={fadeIn ? FADE_IN_DURATION : 0}>
|
|
45
|
+
<ListItem
|
|
46
|
+
button
|
|
47
|
+
onClick={toogleDetailOpened}
|
|
48
|
+
gutters={isMobile ? 'default' : 'double'}
|
|
49
|
+
>
|
|
50
|
+
<ListItemIcon>
|
|
51
|
+
<GroupAvatar size="small" />
|
|
52
|
+
</ListItemIcon>
|
|
53
|
+
<ListItemText
|
|
54
|
+
primary={
|
|
55
|
+
<Typography className="u-ellipsis" variant="body1">
|
|
56
|
+
{name}
|
|
57
|
+
</Typography>
|
|
58
|
+
}
|
|
59
|
+
secondary={
|
|
60
|
+
t('GroupRecipient.secondary', { nbMember, nbMemberReady }) +
|
|
61
|
+
(isCurrentInstanceInsideMembers
|
|
62
|
+
? ` (${t('GroupRecipient.secondary_you')})`
|
|
63
|
+
: '')
|
|
64
|
+
}
|
|
65
|
+
/>
|
|
66
|
+
<ListItemSecondaryAction className={isMobile ? 'u-mr-1' : 'u-mr-2'}>
|
|
67
|
+
<GroupRecipientPermissions {...props} />
|
|
68
|
+
</ListItemSecondaryAction>
|
|
69
|
+
</ListItem>
|
|
70
|
+
</Fade>
|
|
71
|
+
{isDetailOpened ? (
|
|
72
|
+
<GroupRecipientDetail
|
|
73
|
+
owner={owner}
|
|
74
|
+
name={name}
|
|
75
|
+
members={members}
|
|
76
|
+
onClose={closeDetail}
|
|
47
77
|
/>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
</ListItemSecondaryAction>
|
|
51
|
-
</ListItem>
|
|
52
|
-
</Fade>
|
|
78
|
+
) : null}
|
|
79
|
+
</>
|
|
53
80
|
)
|
|
54
81
|
}
|
|
55
82
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs'
|
|
4
|
+
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
5
|
+
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
6
|
+
|
|
7
|
+
import { GroupRecipientDetailWithAccess } from './GroupRecipientDetailWithAccess'
|
|
8
|
+
import { GroupRecipientDetailWithoutAccess } from './GroupRecipientDetailWithoutAccess'
|
|
9
|
+
|
|
10
|
+
const GroupRecipientDetail = ({ name, owner, members, onClose }) => {
|
|
11
|
+
const { t } = useI18n()
|
|
12
|
+
const withAccess = members.filter(
|
|
13
|
+
member => !['revoked', 'mail-not-sent'].includes(member.status)
|
|
14
|
+
)
|
|
15
|
+
const withoutAccess = members.filter(member =>
|
|
16
|
+
['revoked', 'mail-not-sent'].includes(member.status)
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
const ownerName = owner.public_name
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Dialog
|
|
23
|
+
open
|
|
24
|
+
size="small"
|
|
25
|
+
onClose={onClose}
|
|
26
|
+
title={
|
|
27
|
+
<>
|
|
28
|
+
{name}
|
|
29
|
+
{ownerName ? (
|
|
30
|
+
<Typography variant="caption">
|
|
31
|
+
{t('GroupRecipientDetail.subtitle', { ownerName })}
|
|
32
|
+
</Typography>
|
|
33
|
+
) : null}
|
|
34
|
+
</>
|
|
35
|
+
}
|
|
36
|
+
content={
|
|
37
|
+
<div className="u-flex u-stack-xs u-flex-column">
|
|
38
|
+
{withAccess.length > 0 ? (
|
|
39
|
+
<GroupRecipientDetailWithAccess withAccess={withAccess} />
|
|
40
|
+
) : null}
|
|
41
|
+
{withoutAccess.length > 0 ? (
|
|
42
|
+
<GroupRecipientDetailWithoutAccess withoutAccess={withoutAccess} />
|
|
43
|
+
) : null}
|
|
44
|
+
</div>
|
|
45
|
+
}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { GroupRecipientDetail }
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { GroupRecipientDetail } from './GroupRecipientDetail'
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
component: GroupRecipientDetail,
|
|
5
|
+
args: {
|
|
6
|
+
name: 'Family',
|
|
7
|
+
owner: {
|
|
8
|
+
public_name: 'Alice'
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
|
|
15
|
+
export const Default = {
|
|
16
|
+
name: 'Default',
|
|
17
|
+
args: {
|
|
18
|
+
members: [
|
|
19
|
+
{
|
|
20
|
+
name: 'Alice',
|
|
21
|
+
instance: 'http://alice.cozy.localhost:8080',
|
|
22
|
+
status: 'ready'
|
|
23
|
+
},
|
|
24
|
+
{ name: 'marine@google.com', status: 'mail-not-sent' },
|
|
25
|
+
{ email: 'Martin', status: 'pending' },
|
|
26
|
+
{ name: 'Paul', status: 'revoked' }
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const OnlyWithAccess = {
|
|
32
|
+
name: 'OnlyWithAccess',
|
|
33
|
+
args: {
|
|
34
|
+
members: [
|
|
35
|
+
{
|
|
36
|
+
name: 'Alice',
|
|
37
|
+
instance: 'http://alice.cozy.localhost:8080',
|
|
38
|
+
status: 'ready'
|
|
39
|
+
},
|
|
40
|
+
{ name: 'Martin', status: 'pending' }
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const OnlyWithoutAccess = {
|
|
46
|
+
name: 'OnlyWithoutAccess',
|
|
47
|
+
args: {
|
|
48
|
+
members: [
|
|
49
|
+
{ name: 'marine@google.com', status: 'mail-not-sent' },
|
|
50
|
+
{ name: 'Paul', status: 'revoked' }
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import Avatar from 'cozy-ui/transpiled/react/Avatar'
|
|
4
|
+
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
5
|
+
import ToTheCloudIcon from 'cozy-ui/transpiled/react/Icons/ToTheCloud'
|
|
6
|
+
import List from 'cozy-ui/transpiled/react/List'
|
|
7
|
+
import ListItem from 'cozy-ui/transpiled/react/ListItem'
|
|
8
|
+
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
|
|
9
|
+
import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
|
|
10
|
+
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
11
|
+
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
12
|
+
|
|
13
|
+
import { getInitials, getDisplayName } from '../../models'
|
|
14
|
+
|
|
15
|
+
const GroupRecipientDetailWithAccess = ({ withAccess }) => {
|
|
16
|
+
const { t } = useI18n()
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div>
|
|
20
|
+
<Typography variant="subtitle2">
|
|
21
|
+
{t('GroupRecipientDetail.withAccess.title')}
|
|
22
|
+
</Typography>
|
|
23
|
+
<List>
|
|
24
|
+
{withAccess.map(recipient => {
|
|
25
|
+
const name = getDisplayName(recipient)
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<ListItem disableGutters key={recipient.index}>
|
|
29
|
+
<ListItemIcon>
|
|
30
|
+
<Avatar text={getInitials(recipient)} textId={name} />
|
|
31
|
+
</ListItemIcon>
|
|
32
|
+
<ListItemText
|
|
33
|
+
primary={name}
|
|
34
|
+
secondary={
|
|
35
|
+
recipient.instance ? (
|
|
36
|
+
<div className="u-flex u-flex-items-center">
|
|
37
|
+
<Icon
|
|
38
|
+
icon={ToTheCloudIcon}
|
|
39
|
+
size={10}
|
|
40
|
+
style={{
|
|
41
|
+
marginRight: '0.25rem'
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
{recipient.instance}
|
|
45
|
+
</div>
|
|
46
|
+
) : null
|
|
47
|
+
}
|
|
48
|
+
/>
|
|
49
|
+
</ListItem>
|
|
50
|
+
)
|
|
51
|
+
})}
|
|
52
|
+
</List>
|
|
53
|
+
</div>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { GroupRecipientDetailWithAccess }
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import Avatar from 'cozy-ui/transpiled/react/Avatar'
|
|
4
|
+
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
5
|
+
import ForbiddenIcon from 'cozy-ui/transpiled/react/Icons/Forbidden'
|
|
6
|
+
import List from 'cozy-ui/transpiled/react/List'
|
|
7
|
+
import ListItem from 'cozy-ui/transpiled/react/ListItem'
|
|
8
|
+
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
|
|
9
|
+
import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
|
|
10
|
+
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
11
|
+
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
12
|
+
|
|
13
|
+
import { getInitials, getDisplayName } from '../../models'
|
|
14
|
+
|
|
15
|
+
const GroupRecipientDetailWithoutAccess = ({ withoutAccess }) => {
|
|
16
|
+
const { t } = useI18n()
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div>
|
|
20
|
+
<Typography variant="subtitle2">
|
|
21
|
+
{t('GroupRecipientDetail.withoutAccess.title')}
|
|
22
|
+
</Typography>
|
|
23
|
+
<List>
|
|
24
|
+
{withoutAccess.map(recipient => {
|
|
25
|
+
const icon = recipient.status === 'revoked' ? ForbiddenIcon : null
|
|
26
|
+
const name = getDisplayName(recipient)
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<ListItem disableGutters key={recipient.index}>
|
|
30
|
+
<ListItemIcon>
|
|
31
|
+
<Avatar text={getInitials(recipient)} textId={name} />
|
|
32
|
+
</ListItemIcon>
|
|
33
|
+
<ListItemText
|
|
34
|
+
primary={name}
|
|
35
|
+
secondary={
|
|
36
|
+
<div className="u-flex u-flex-items-center">
|
|
37
|
+
{icon ? (
|
|
38
|
+
<Icon
|
|
39
|
+
icon={icon}
|
|
40
|
+
size={10}
|
|
41
|
+
style={{
|
|
42
|
+
marginRight: '0.25rem'
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
) : null}
|
|
46
|
+
{t(
|
|
47
|
+
`GroupRecipientDetail.withoutAccess.status.${recipient.status}`
|
|
48
|
+
)}
|
|
49
|
+
</div>
|
|
50
|
+
}
|
|
51
|
+
/>
|
|
52
|
+
</ListItem>
|
|
53
|
+
)
|
|
54
|
+
})}
|
|
55
|
+
</List>
|
|
56
|
+
</div>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { GroupRecipientDetailWithoutAccess }
|
|
@@ -9,6 +9,7 @@ import ListItem from 'cozy-ui/transpiled/react/ListItem'
|
|
|
9
9
|
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
|
|
10
10
|
import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
|
|
11
11
|
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
12
|
+
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
12
13
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
13
14
|
|
|
14
15
|
import LinkRecipientPermissions from './LinkRecipientPermissions'
|
|
@@ -18,6 +19,7 @@ import styles from '../../styles/recipient.styl'
|
|
|
18
19
|
|
|
19
20
|
const LinkRecipient = props => {
|
|
20
21
|
const { t } = useI18n()
|
|
22
|
+
const { isMobile } = useBreakpoints()
|
|
21
23
|
|
|
22
24
|
const { recipientConfirmationData, verifyRecipient, link, fadeIn } = props
|
|
23
25
|
|
|
@@ -32,7 +34,7 @@ const LinkRecipient = props => {
|
|
|
32
34
|
|
|
33
35
|
return (
|
|
34
36
|
<Fade in timeout={fadeIn ? FADE_IN_DURATION : 0}>
|
|
35
|
-
<ListItem
|
|
37
|
+
<ListItem gutters={isMobile ? 'default' : 'double'}>
|
|
36
38
|
<ListItemIcon>
|
|
37
39
|
<Circle size="small" className={styles['link-recipient-icon-circle']}>
|
|
38
40
|
<Icon icon={LinkIcon} />
|
|
@@ -7,6 +7,7 @@ import ListItem from 'cozy-ui/transpiled/react/ListItem'
|
|
|
7
7
|
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
|
|
8
8
|
import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
|
|
9
9
|
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
10
|
+
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
10
11
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
11
12
|
|
|
12
13
|
import MemberRecipientPermissions from './MemberRecipientPermissions'
|
|
@@ -21,6 +22,7 @@ const DEFAULT_DISPLAY_NAME = 'Share.contacts.defaultDisplayName'
|
|
|
21
22
|
const MemberRecipient = props => {
|
|
22
23
|
const { t } = useI18n()
|
|
23
24
|
const client = useClient()
|
|
25
|
+
const { isMobile } = useBreakpoints()
|
|
24
26
|
|
|
25
27
|
const {
|
|
26
28
|
instance,
|
|
@@ -48,7 +50,7 @@ const MemberRecipient = props => {
|
|
|
48
50
|
|
|
49
51
|
return (
|
|
50
52
|
<Fade in timeout={fadeIn ? FADE_IN_DURATION : 0}>
|
|
51
|
-
<ListItem
|
|
53
|
+
<ListItem gutters={isMobile ? 'default' : 'double'}>
|
|
52
54
|
<ListItemIcon>
|
|
53
55
|
<MemberAvatar size="small" recipient={props} />
|
|
54
56
|
</ListItemIcon>
|
|
@@ -165,12 +165,7 @@ const ShareAutocomplete = ({
|
|
|
165
165
|
)
|
|
166
166
|
|
|
167
167
|
const renderSuggestion = contactOrGroup => (
|
|
168
|
-
<ContactSuggestion
|
|
169
|
-
contacts={contactsAndGroups.filter(
|
|
170
|
-
item => item._type === Contact.doctype
|
|
171
|
-
)}
|
|
172
|
-
contactOrGroup={contactOrGroup}
|
|
173
|
-
/>
|
|
168
|
+
<ContactSuggestion contactOrGroup={contactOrGroup} />
|
|
174
169
|
)
|
|
175
170
|
|
|
176
171
|
return (
|