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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [12.2.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@12.1.0...cozy-sharing@12.2.0) (2024-03-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Allow to add group with only more than one member ([177dc4a](https://github.com/cozy/cozy-libs/commit/177dc4a4fbceefed1ce52f2a5275c67e46b6430f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [12.1.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@12.0.0...cozy-sharing@12.1.0) (2024-03-22)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* Adapt modal design to allow gutters into ListItem ([39dc590](https://github.com/cozy/cozy-libs/commit/39dc5905ee19e07967227e76d376ff04c6145c1e))
|
|
23
|
+
* Show detail of recipient groups ([7d731db](https://github.com/cozy/cozy-libs/commit/7d731db9d313ba763652612352ce393f475bfe5f))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
# [12.0.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@11.1.0...cozy-sharing@12.0.0) (2024-03-21)
|
|
7
30
|
|
|
8
31
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import cx from 'classnames';
|
|
3
4
|
import React from 'react';
|
|
5
|
+
import List from 'cozy-ui/transpiled/react/List';
|
|
4
6
|
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
7
|
+
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
5
8
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
6
9
|
import MemberRecipient from './Recipient/MemberRecipient';
|
|
7
10
|
import ShareDialogTwoStepsConfirmationContainer from './ShareDialogTwoStepsConfirmationContainer';
|
|
@@ -16,17 +19,22 @@ var SharingContent = function SharingContent(_ref) {
|
|
|
16
19
|
var _useI18n = useI18n(),
|
|
17
20
|
t = _useI18n.t;
|
|
18
21
|
|
|
22
|
+
var _useBreakpoints = useBreakpoints(),
|
|
23
|
+
isMobile = _useBreakpoints.isMobile;
|
|
24
|
+
|
|
19
25
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
20
26
|
variant: "body1",
|
|
21
|
-
className:
|
|
22
|
-
}, t("ConfirmRecipientModal.intruction")),
|
|
27
|
+
className: cx('u-mb-half', isMobile ? 'u-ph-1 u-mt-1' : 'u-ph-2 u-mt-1-half')
|
|
28
|
+
}, t("ConfirmRecipientModal.intruction")), /*#__PURE__*/React.createElement(List, {
|
|
29
|
+
className: isMobile ? 'u-mb-half' : 'u-mb-1'
|
|
30
|
+
}, recipientsToBeConfirmed.map(function (recipientConfirmationData) {
|
|
23
31
|
return /*#__PURE__*/React.createElement(MemberRecipient, _extends({}, recipientConfirmationData, {
|
|
24
32
|
key: "key_r_".concat(recipientConfirmationData.id),
|
|
25
33
|
isOwner: false,
|
|
26
34
|
recipientConfirmationData: recipientConfirmationData,
|
|
27
35
|
verifyRecipient: verifyRecipient
|
|
28
36
|
}));
|
|
29
|
-
}));
|
|
37
|
+
})));
|
|
30
38
|
};
|
|
31
39
|
/**
|
|
32
40
|
* Displays the dialog's title that can be used when ConfirmTrustedRecipientsDialog is in sharing state
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import ConfirmTrustedRecipientsDialog from './ConfirmTrustedRecipientsDialog';
|
|
2
|
+
var meta = {
|
|
3
|
+
component: ConfirmTrustedRecipientsDialog,
|
|
4
|
+
args: {
|
|
5
|
+
recipientsToBeConfirmed: [{
|
|
6
|
+
instance: 'https://example.com',
|
|
7
|
+
isOwner: false,
|
|
8
|
+
status: 'ready',
|
|
9
|
+
recipientConfirmationData: null,
|
|
10
|
+
verifyRecipient: function verifyRecipient() {},
|
|
11
|
+
fadeIn: true,
|
|
12
|
+
type: 'two-way',
|
|
13
|
+
onRevoke: function onRevoke() {},
|
|
14
|
+
onRevokeSelf: function onRevokeSelf() {}
|
|
15
|
+
}]
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export var Default = {
|
|
20
|
+
name: 'Default',
|
|
21
|
+
args: {
|
|
22
|
+
twoStepsConfirmationMethods: {
|
|
23
|
+
getRecipientsToBeConfirmed: function getRecipientsToBeConfirmed() {
|
|
24
|
+
return [{
|
|
25
|
+
name: 'John Doe',
|
|
26
|
+
instance: 'https://example.com',
|
|
27
|
+
isOwner: false,
|
|
28
|
+
status: 'ready'
|
|
29
|
+
}, {
|
|
30
|
+
name: 'Alice Doe',
|
|
31
|
+
instance: 'https://example.com',
|
|
32
|
+
isOwner: false,
|
|
33
|
+
status: 'ready'
|
|
34
|
+
}];
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
verifyRecipient: function verifyRecipient() {}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -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
|
import { models } from 'cozy-client';
|
|
@@ -10,8 +9,7 @@ import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
|
10
9
|
import { Contact, Group, getDisplayName, getInitials } from '../models';
|
|
11
10
|
var ContactModel = models.contact;
|
|
12
11
|
export var ContactSuggestion = function ContactSuggestion(_ref) {
|
|
13
|
-
var contactOrGroup = _ref.contactOrGroup
|
|
14
|
-
contacts = _ref.contacts;
|
|
12
|
+
var contactOrGroup = _ref.contactOrGroup;
|
|
15
13
|
|
|
16
14
|
var _useI18n = useI18n(),
|
|
17
15
|
t = _useI18n.t;
|
|
@@ -20,19 +18,10 @@ export var ContactSuggestion = function ContactSuggestion(_ref) {
|
|
|
20
18
|
|
|
21
19
|
if (contactOrGroup._type === Group.doctype) {
|
|
22
20
|
name = contactOrGroup.name;
|
|
23
|
-
|
|
24
|
-
if (get(contact, 'relationships.groups.data', []).map(function (group) {
|
|
25
|
-
return group._id;
|
|
26
|
-
}).includes(contactOrGroup._id)) {
|
|
27
|
-
return total + 1;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return total;
|
|
31
|
-
}, 0).toString();
|
|
21
|
+
avatarText = 'G';
|
|
32
22
|
details = t('Share.members.count', {
|
|
33
|
-
smart_count: membersCount
|
|
23
|
+
smart_count: contactOrGroup.membersCount.toString()
|
|
34
24
|
});
|
|
35
|
-
avatarText = 'G';
|
|
36
25
|
} else {
|
|
37
26
|
name = getDisplayName(contactOrGroup);
|
|
38
27
|
avatarText = getInitials(contactOrGroup);
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ContactSuggestion } from './ContactSuggestion';
|
|
4
4
|
import AppLike from '../../test/AppLike';
|
|
5
|
-
|
|
6
|
-
var WrappingComponent = function WrappingComponent(_ref) {
|
|
7
|
-
var children = _ref.children;
|
|
8
|
-
return /*#__PURE__*/React.createElement(AppLike, null, children);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
5
|
describe('ContactSuggestion component', function () {
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
var setup = function setup(_ref) {
|
|
7
|
+
var contactOrGroup = _ref.contactOrGroup;
|
|
8
|
+
return render( /*#__PURE__*/React.createElement(ContactSuggestion, {
|
|
9
|
+
contactOrGroup: contactOrGroup
|
|
10
|
+
}), {
|
|
11
|
+
wrapper: AppLike
|
|
12
|
+
});
|
|
13
|
+
};
|
|
16
14
|
|
|
17
|
-
return s;
|
|
18
|
-
});
|
|
19
15
|
it('should display contact suggestion for a contact', function () {
|
|
20
16
|
var jonSnow = {
|
|
21
17
|
_id: 'f3a4e501-abbd',
|
|
@@ -34,17 +30,11 @@ describe('ContactSuggestion component', function () {
|
|
|
34
30
|
}],
|
|
35
31
|
_type: 'io.cozy.contacts'
|
|
36
32
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
contactOrGroup: jonSnow,
|
|
40
|
-
contacts: contacts,
|
|
41
|
-
t: fakeT
|
|
42
|
-
};
|
|
43
|
-
var jsx = /*#__PURE__*/React.createElement(ContactSuggestion, props);
|
|
44
|
-
var wrapper = mount(jsx, {
|
|
45
|
-
wrappingComponent: WrappingComponent
|
|
33
|
+
setup({
|
|
34
|
+
contactOrGroup: jonSnow
|
|
46
35
|
});
|
|
47
|
-
expect(
|
|
36
|
+
expect(screen.getByText('Jon Snow')).toBeInTheDocument();
|
|
37
|
+
expect(screen.getByText('https://jonsnow.mycozy.cloud')).toBeInTheDocument();
|
|
48
38
|
});
|
|
49
39
|
it('should display contact suggestion for a contact without fullname (for example created by a share modal)', function () {
|
|
50
40
|
var jonSnow = {
|
|
@@ -57,94 +47,22 @@ describe('ContactSuggestion component', function () {
|
|
|
57
47
|
name: undefined,
|
|
58
48
|
_type: 'io.cozy.contacts'
|
|
59
49
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
contactOrGroup: jonSnow,
|
|
63
|
-
contacts: contacts,
|
|
64
|
-
t: fakeT
|
|
65
|
-
};
|
|
66
|
-
var jsx = /*#__PURE__*/React.createElement(ContactSuggestion, props);
|
|
67
|
-
var wrapper = mount(jsx, {
|
|
68
|
-
wrappingComponent: WrappingComponent
|
|
50
|
+
setup({
|
|
51
|
+
contactOrGroup: jonSnow
|
|
69
52
|
});
|
|
70
|
-
expect(
|
|
53
|
+
expect(screen.getByText('jon.snow@email.com')).toBeInTheDocument();
|
|
71
54
|
});
|
|
72
55
|
it('should display contact suggestion for a group', function () {
|
|
73
|
-
var jon = {
|
|
74
|
-
_id: 'f3a4e501-abbd',
|
|
75
|
-
fullname: 'Jon Snow',
|
|
76
|
-
name: {
|
|
77
|
-
givenName: 'Jon',
|
|
78
|
-
familyName: 'Snow'
|
|
79
|
-
},
|
|
80
|
-
email: [{
|
|
81
|
-
address: 'jon.snow@email.com',
|
|
82
|
-
type: 'primary'
|
|
83
|
-
}],
|
|
84
|
-
_type: 'io.cozy.contacts',
|
|
85
|
-
relationships: {
|
|
86
|
-
groups: {
|
|
87
|
-
data: [{
|
|
88
|
-
_id: '610718e6-2d7a',
|
|
89
|
-
_type: 'io.cozy.contacts.groups'
|
|
90
|
-
}]
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
var cersei = {
|
|
95
|
-
_id: '42dc490a-7878',
|
|
96
|
-
fullname: 'Cersei Lannister',
|
|
97
|
-
name: {
|
|
98
|
-
givenName: 'Cersei',
|
|
99
|
-
familyName: 'Lannister'
|
|
100
|
-
},
|
|
101
|
-
email: [{
|
|
102
|
-
address: 'cersei@email.com',
|
|
103
|
-
type: 'primary'
|
|
104
|
-
}],
|
|
105
|
-
_type: 'io.cozy.contacts',
|
|
106
|
-
relationships: {
|
|
107
|
-
groups: {
|
|
108
|
-
data: []
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
var sam = {
|
|
113
|
-
_id: 'b5bed853-93da',
|
|
114
|
-
fullname: 'Samwell Tarly',
|
|
115
|
-
name: {
|
|
116
|
-
givenName: 'Samwell',
|
|
117
|
-
familyName: 'Tarly'
|
|
118
|
-
},
|
|
119
|
-
email: [{
|
|
120
|
-
address: 'samwell@email.com',
|
|
121
|
-
type: 'primary'
|
|
122
|
-
}],
|
|
123
|
-
_type: 'io.cozy.contacts',
|
|
124
|
-
relationships: {
|
|
125
|
-
groups: {
|
|
126
|
-
data: [{
|
|
127
|
-
_id: '610718e6-2d7a',
|
|
128
|
-
_type: 'io.cozy.contacts.groups'
|
|
129
|
-
}]
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
var contacts = [jon, cersei, sam];
|
|
134
56
|
var theNightsWatch = {
|
|
135
57
|
_id: '610718e6-2d7a',
|
|
136
58
|
name: "The Night's Watch",
|
|
137
|
-
_type: 'io.cozy.contacts.groups'
|
|
138
|
-
|
|
139
|
-
var props = {
|
|
140
|
-
contactOrGroup: theNightsWatch,
|
|
141
|
-
contacts: contacts,
|
|
142
|
-
t: fakeT
|
|
59
|
+
_type: 'io.cozy.contacts.groups',
|
|
60
|
+
membersCount: 2
|
|
143
61
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
wrappingComponent: WrappingComponent
|
|
62
|
+
setup({
|
|
63
|
+
contactOrGroup: theNightsWatch
|
|
147
64
|
});
|
|
148
|
-
expect(
|
|
65
|
+
expect(screen.getByText("The Night's Watch")).toBeInTheDocument();
|
|
66
|
+
expect(screen.getByText('2 members')).toBeInTheDocument();
|
|
149
67
|
});
|
|
150
68
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { useState } from 'react';
|
|
2
3
|
import { useClient } from 'cozy-client';
|
|
3
4
|
import Fade from 'cozy-ui/transpiled/react/Fade';
|
|
4
5
|
import ListItem from 'cozy-ui/transpiled/react/ListItem';
|
|
@@ -6,7 +7,9 @@ import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
|
|
|
6
7
|
import ListItemSecondaryAction from 'cozy-ui/transpiled/react/ListItemSecondaryAction';
|
|
7
8
|
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
8
9
|
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
10
|
+
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
9
11
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
12
|
+
import { GroupRecipientDetail } from './GroupRecipientDetail';
|
|
10
13
|
import { GroupRecipientPermissions } from './GroupRecipientPermissions';
|
|
11
14
|
import { FADE_IN_DURATION } from '../../helpers/recipients';
|
|
12
15
|
import { GroupAvatar } from '../Avatar/GroupAvatar';
|
|
@@ -14,12 +17,22 @@ import { GroupAvatar } from '../Avatar/GroupAvatar';
|
|
|
14
17
|
var GroupRecipient = function GroupRecipient(props) {
|
|
15
18
|
var name = props.name,
|
|
16
19
|
members = props.members,
|
|
17
|
-
fadeIn = props.fadeIn
|
|
20
|
+
fadeIn = props.fadeIn,
|
|
21
|
+
owner = props.owner;
|
|
18
22
|
|
|
19
23
|
var _useI18n = useI18n(),
|
|
20
24
|
t = _useI18n.t;
|
|
21
25
|
|
|
22
26
|
var client = useClient();
|
|
27
|
+
|
|
28
|
+
var _useBreakpoints = useBreakpoints(),
|
|
29
|
+
isMobile = _useBreakpoints.isMobile;
|
|
30
|
+
|
|
31
|
+
var _useState = useState(false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
isDetailOpened = _useState2[0],
|
|
34
|
+
setDetailOpened = _useState2[1];
|
|
35
|
+
|
|
23
36
|
var nbMember = members.length;
|
|
24
37
|
var nbMemberReady = members.filter(function (member) {
|
|
25
38
|
return !['revoked', 'mail-not-sent'].includes(member.status);
|
|
@@ -27,11 +40,22 @@ var GroupRecipient = function GroupRecipient(props) {
|
|
|
27
40
|
var isCurrentInstanceInsideMembers = members.some(function (member) {
|
|
28
41
|
return member.instance === client.options.uri;
|
|
29
42
|
});
|
|
30
|
-
|
|
43
|
+
|
|
44
|
+
var toogleDetailOpened = function toogleDetailOpened() {
|
|
45
|
+
setDetailOpened(!isDetailOpened);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var closeDetail = function closeDetail() {
|
|
49
|
+
setDetailOpened(false);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Fade, {
|
|
31
53
|
in: true,
|
|
32
54
|
timeout: fadeIn ? FADE_IN_DURATION : 0
|
|
33
55
|
}, /*#__PURE__*/React.createElement(ListItem, {
|
|
34
|
-
|
|
56
|
+
button: true,
|
|
57
|
+
onClick: toogleDetailOpened,
|
|
58
|
+
gutters: isMobile ? 'default' : 'double'
|
|
35
59
|
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(GroupAvatar, {
|
|
36
60
|
size: "small"
|
|
37
61
|
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
@@ -43,7 +67,14 @@ var GroupRecipient = function GroupRecipient(props) {
|
|
|
43
67
|
nbMember: nbMember,
|
|
44
68
|
nbMemberReady: nbMemberReady
|
|
45
69
|
}) + (isCurrentInstanceInsideMembers ? " (".concat(t('GroupRecipient.secondary_you'), ")") : '')
|
|
46
|
-
}), /*#__PURE__*/React.createElement(ListItemSecondaryAction,
|
|
70
|
+
}), /*#__PURE__*/React.createElement(ListItemSecondaryAction, {
|
|
71
|
+
className: isMobile ? 'u-mr-1' : 'u-mr-2'
|
|
72
|
+
}, /*#__PURE__*/React.createElement(GroupRecipientPermissions, props)))), isDetailOpened ? /*#__PURE__*/React.createElement(GroupRecipientDetail, {
|
|
73
|
+
owner: owner,
|
|
74
|
+
name: name,
|
|
75
|
+
members: members,
|
|
76
|
+
onClose: closeDetail
|
|
77
|
+
}) : null);
|
|
47
78
|
};
|
|
48
79
|
|
|
49
80
|
export { GroupRecipient };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
3
|
+
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
4
|
+
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
5
|
+
import { GroupRecipientDetailWithAccess } from './GroupRecipientDetailWithAccess';
|
|
6
|
+
import { GroupRecipientDetailWithoutAccess } from './GroupRecipientDetailWithoutAccess';
|
|
7
|
+
|
|
8
|
+
var GroupRecipientDetail = function GroupRecipientDetail(_ref) {
|
|
9
|
+
var name = _ref.name,
|
|
10
|
+
owner = _ref.owner,
|
|
11
|
+
members = _ref.members,
|
|
12
|
+
onClose = _ref.onClose;
|
|
13
|
+
|
|
14
|
+
var _useI18n = useI18n(),
|
|
15
|
+
t = _useI18n.t;
|
|
16
|
+
|
|
17
|
+
var withAccess = members.filter(function (member) {
|
|
18
|
+
return !['revoked', 'mail-not-sent'].includes(member.status);
|
|
19
|
+
});
|
|
20
|
+
var withoutAccess = members.filter(function (member) {
|
|
21
|
+
return ['revoked', 'mail-not-sent'].includes(member.status);
|
|
22
|
+
});
|
|
23
|
+
var ownerName = owner.public_name;
|
|
24
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
25
|
+
open: true,
|
|
26
|
+
size: "small",
|
|
27
|
+
onClose: onClose,
|
|
28
|
+
title: /*#__PURE__*/React.createElement(React.Fragment, null, name, ownerName ? /*#__PURE__*/React.createElement(Typography, {
|
|
29
|
+
variant: "caption"
|
|
30
|
+
}, t('GroupRecipientDetail.subtitle', {
|
|
31
|
+
ownerName: ownerName
|
|
32
|
+
})) : null),
|
|
33
|
+
content: /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "u-flex u-stack-xs u-flex-column"
|
|
35
|
+
}, withAccess.length > 0 ? /*#__PURE__*/React.createElement(GroupRecipientDetailWithAccess, {
|
|
36
|
+
withAccess: withAccess
|
|
37
|
+
}) : null, withoutAccess.length > 0 ? /*#__PURE__*/React.createElement(GroupRecipientDetailWithoutAccess, {
|
|
38
|
+
withoutAccess: withoutAccess
|
|
39
|
+
}) : null)
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { GroupRecipientDetail };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { GroupRecipientDetail } from './GroupRecipientDetail';
|
|
2
|
+
var meta = {
|
|
3
|
+
component: GroupRecipientDetail,
|
|
4
|
+
args: {
|
|
5
|
+
name: 'Family',
|
|
6
|
+
owner: {
|
|
7
|
+
public_name: 'Alice'
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export var Default = {
|
|
13
|
+
name: 'Default',
|
|
14
|
+
args: {
|
|
15
|
+
members: [{
|
|
16
|
+
name: 'Alice',
|
|
17
|
+
instance: 'http://alice.cozy.localhost:8080',
|
|
18
|
+
status: 'ready'
|
|
19
|
+
}, {
|
|
20
|
+
name: 'marine@google.com',
|
|
21
|
+
status: 'mail-not-sent'
|
|
22
|
+
}, {
|
|
23
|
+
email: 'Martin',
|
|
24
|
+
status: 'pending'
|
|
25
|
+
}, {
|
|
26
|
+
name: 'Paul',
|
|
27
|
+
status: 'revoked'
|
|
28
|
+
}]
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export var OnlyWithAccess = {
|
|
32
|
+
name: 'OnlyWithAccess',
|
|
33
|
+
args: {
|
|
34
|
+
members: [{
|
|
35
|
+
name: 'Alice',
|
|
36
|
+
instance: 'http://alice.cozy.localhost:8080',
|
|
37
|
+
status: 'ready'
|
|
38
|
+
}, {
|
|
39
|
+
name: 'Martin',
|
|
40
|
+
status: 'pending'
|
|
41
|
+
}]
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
export var OnlyWithoutAccess = {
|
|
45
|
+
name: 'OnlyWithoutAccess',
|
|
46
|
+
args: {
|
|
47
|
+
members: [{
|
|
48
|
+
name: 'marine@google.com',
|
|
49
|
+
status: 'mail-not-sent'
|
|
50
|
+
}, {
|
|
51
|
+
name: 'Paul',
|
|
52
|
+
status: 'revoked'
|
|
53
|
+
}]
|
|
54
|
+
}
|
|
55
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Avatar from 'cozy-ui/transpiled/react/Avatar';
|
|
3
|
+
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
4
|
+
import ToTheCloudIcon from 'cozy-ui/transpiled/react/Icons/ToTheCloud';
|
|
5
|
+
import List from 'cozy-ui/transpiled/react/List';
|
|
6
|
+
import ListItem from 'cozy-ui/transpiled/react/ListItem';
|
|
7
|
+
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
|
|
8
|
+
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
9
|
+
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
10
|
+
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
11
|
+
import { getInitials, getDisplayName } from '../../models';
|
|
12
|
+
|
|
13
|
+
var GroupRecipientDetailWithAccess = function GroupRecipientDetailWithAccess(_ref) {
|
|
14
|
+
var withAccess = _ref.withAccess;
|
|
15
|
+
|
|
16
|
+
var _useI18n = useI18n(),
|
|
17
|
+
t = _useI18n.t;
|
|
18
|
+
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
|
|
20
|
+
variant: "subtitle2"
|
|
21
|
+
}, t('GroupRecipientDetail.withAccess.title')), /*#__PURE__*/React.createElement(List, null, withAccess.map(function (recipient) {
|
|
22
|
+
var name = getDisplayName(recipient);
|
|
23
|
+
return /*#__PURE__*/React.createElement(ListItem, {
|
|
24
|
+
disableGutters: true,
|
|
25
|
+
key: recipient.index
|
|
26
|
+
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Avatar, {
|
|
27
|
+
text: getInitials(recipient),
|
|
28
|
+
textId: name
|
|
29
|
+
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
30
|
+
primary: name,
|
|
31
|
+
secondary: recipient.instance ? /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: "u-flex u-flex-items-center"
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
34
|
+
icon: ToTheCloudIcon,
|
|
35
|
+
size: 10,
|
|
36
|
+
style: {
|
|
37
|
+
marginRight: '0.25rem'
|
|
38
|
+
}
|
|
39
|
+
}), recipient.instance) : null
|
|
40
|
+
}));
|
|
41
|
+
})));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { GroupRecipientDetailWithAccess };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Avatar from 'cozy-ui/transpiled/react/Avatar';
|
|
3
|
+
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
4
|
+
import ForbiddenIcon from 'cozy-ui/transpiled/react/Icons/Forbidden';
|
|
5
|
+
import List from 'cozy-ui/transpiled/react/List';
|
|
6
|
+
import ListItem from 'cozy-ui/transpiled/react/ListItem';
|
|
7
|
+
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
|
|
8
|
+
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
9
|
+
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
10
|
+
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
11
|
+
import { getInitials, getDisplayName } from '../../models';
|
|
12
|
+
|
|
13
|
+
var GroupRecipientDetailWithoutAccess = function GroupRecipientDetailWithoutAccess(_ref) {
|
|
14
|
+
var withoutAccess = _ref.withoutAccess;
|
|
15
|
+
|
|
16
|
+
var _useI18n = useI18n(),
|
|
17
|
+
t = _useI18n.t;
|
|
18
|
+
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
|
|
20
|
+
variant: "subtitle2"
|
|
21
|
+
}, t('GroupRecipientDetail.withoutAccess.title')), /*#__PURE__*/React.createElement(List, null, withoutAccess.map(function (recipient) {
|
|
22
|
+
var icon = recipient.status === 'revoked' ? ForbiddenIcon : null;
|
|
23
|
+
var name = getDisplayName(recipient);
|
|
24
|
+
return /*#__PURE__*/React.createElement(ListItem, {
|
|
25
|
+
disableGutters: true,
|
|
26
|
+
key: recipient.index
|
|
27
|
+
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Avatar, {
|
|
28
|
+
text: getInitials(recipient),
|
|
29
|
+
textId: name
|
|
30
|
+
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
31
|
+
primary: name,
|
|
32
|
+
secondary: /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: "u-flex u-flex-items-center"
|
|
34
|
+
}, icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
35
|
+
icon: icon,
|
|
36
|
+
size: 10,
|
|
37
|
+
style: {
|
|
38
|
+
marginRight: '0.25rem'
|
|
39
|
+
}
|
|
40
|
+
}) : null, t("GroupRecipientDetail.withoutAccess.status.".concat(recipient.status)))
|
|
41
|
+
}));
|
|
42
|
+
})));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
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
|
import LinkRecipientPermissions from './LinkRecipientPermissions';
|
|
14
15
|
import RecipientConfirm from './RecipientConfirm';
|
|
@@ -35,6 +36,9 @@ var LinkRecipient = function LinkRecipient(props) {
|
|
|
35
36
|
var _useI18n = useI18n(),
|
|
36
37
|
t = _useI18n.t;
|
|
37
38
|
|
|
39
|
+
var _useBreakpoints = useBreakpoints(),
|
|
40
|
+
isMobile = _useBreakpoints.isMobile;
|
|
41
|
+
|
|
38
42
|
var recipientConfirmationData = props.recipientConfirmationData,
|
|
39
43
|
verifyRecipient = props.verifyRecipient,
|
|
40
44
|
link = props.link,
|
|
@@ -49,7 +53,7 @@ var LinkRecipient = function LinkRecipient(props) {
|
|
|
49
53
|
in: true,
|
|
50
54
|
timeout: fadeIn ? FADE_IN_DURATION : 0
|
|
51
55
|
}, /*#__PURE__*/React.createElement(ListItem, {
|
|
52
|
-
|
|
56
|
+
gutters: isMobile ? 'default' : 'double'
|
|
53
57
|
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Circle, {
|
|
54
58
|
size: "small",
|
|
55
59
|
className: styles['link-recipient-icon-circle']
|
|
@@ -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
|
import MemberRecipientPermissions from './MemberRecipientPermissions';
|
|
14
15
|
import MemberRecipientStatus from './MemberRecipientStatus';
|
|
@@ -24,6 +25,9 @@ var MemberRecipient = function MemberRecipient(props) {
|
|
|
24
25
|
|
|
25
26
|
var client = useClient();
|
|
26
27
|
|
|
28
|
+
var _useBreakpoints = useBreakpoints(),
|
|
29
|
+
isMobile = _useBreakpoints.isMobile;
|
|
30
|
+
|
|
27
31
|
var instance = props.instance,
|
|
28
32
|
isOwner = props.isOwner,
|
|
29
33
|
status = props.status,
|
|
@@ -45,7 +49,7 @@ var MemberRecipient = function MemberRecipient(props) {
|
|
|
45
49
|
in: true,
|
|
46
50
|
timeout: fadeIn ? FADE_IN_DURATION : 0
|
|
47
51
|
}, /*#__PURE__*/React.createElement(ListItem, {
|
|
48
|
-
|
|
52
|
+
gutters: isMobile ? 'default' : 'double'
|
|
49
53
|
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(MemberAvatar, {
|
|
50
54
|
size: "small",
|
|
51
55
|
recipient: props
|
|
@@ -174,9 +174,6 @@ var ShareAutocomplete = function ShareAutocomplete(_ref) {
|
|
|
174
174
|
|
|
175
175
|
var renderSuggestion = function renderSuggestion(contactOrGroup) {
|
|
176
176
|
return /*#__PURE__*/React.createElement(ContactSuggestion, {
|
|
177
|
-
contacts: contactsAndGroups.filter(function (item) {
|
|
178
|
-
return item._type === Contact.doctype;
|
|
179
|
-
}),
|
|
180
177
|
contactOrGroup: contactOrGroup
|
|
181
178
|
});
|
|
182
179
|
};
|