cozy-sharing 32.3.1 → 32.3.2

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/components/FederatedFolder/FederatedFolderModal.js +56 -19
  3. package/dist/components/FederatedFolder/FederatedFolderModal.spec.js +101 -254
  4. package/dist/components/Recipient/RecipientList.js +0 -15
  5. package/dist/components/ShareModal/ShareModal.js +8 -8
  6. package/dist/state.js +6 -1
  7. package/package.json +2 -2
  8. package/src/components/FederatedFolder/FederatedFolderModal.jsx +65 -19
  9. package/src/components/FederatedFolder/FederatedFolderModal.spec.jsx +28 -150
  10. package/src/components/Recipient/RecipientList.jsx +0 -18
  11. package/src/components/ShareModal/ShareModal.jsx +5 -5
  12. package/src/state.js +5 -1
  13. package/.claude/settings.local.json +0 -27
  14. package/AGENTS.md +0 -7
  15. package/dist/RefreshableSharings.spec.js +0 -40
  16. package/dist/assets/illustrations/illustration-shared-drives.svg +0 -1
  17. package/dist/components/EditLinkPermissionDialog.js +0 -72
  18. package/dist/components/EditLinkPermissionDialog.spec.js +0 -48
  19. package/dist/components/FederatedFolder/DumbFederatedFolderModal.js +0 -65
  20. package/dist/components/FederatedFolder/DumbFederatedFolderModal.spec.js +0 -107
  21. package/dist/components/FederatedFolder/FederatedFolderModal.jsx.tmp.179197.1773939270471 +0 -172
  22. package/dist/components/Recipient/actions/revokeGroup.js +0 -42
  23. package/dist/components/Recipient/actions/revokeMember.js +0 -42
  24. package/dist/components/Recipient/actions/revokeSharedDriveMember.js +0 -41
  25. package/dist/components/ShareModal/ShareModal copy.js +0 -43
  26. package/dist/components/ShareModal/ShareModal.spec.js +0 -197
  27. package/dist/components/ShareModal/ShareModalBatchContainer.js +0 -276
  28. package/dist/components/ShareModal/ShareModalBatchContainer.spec.js +0 -131
  29. package/dist/components/ShareModal/SharedDriveEditModal.js +0 -59
  30. package/dist/components/SharedDrive/DumbSharedDriveModal.js +0 -78
  31. package/dist/components/SharedDrive/DumbSharedDriveModal.spec.js +0 -126
  32. package/dist/components/SharedDrive/SharedDriveEditModal.js +0 -110
  33. package/dist/components/SharedDrive/SharedDriveModal copy.js +0 -356
  34. package/dist/components/SharedDrive/SharedDriveRecipient.js +0 -61
  35. package/dist/components/SharedDrive/SharedDriveRecipientPermissions.js +0 -109
  36. package/dist/components/SharedDrive/SharedDriveRecipientStatus.js +0 -22
  37. package/dist/components/SharedDrive/helpers.js +0 -102
  38. package/dist/components/SharedDrive/helpers.spec.js +0 -208
  39. package/dist/components/SharedDriveEditModal.js +0 -43
  40. package/dist/components/SharedFolder/DumbBatchSharedFolderModal.js +0 -145
  41. package/dist/components/SharedFolder/DumbBatchSharedFolderModal.spec.js +0 -321
  42. package/dist/components/SharedStatus.js +0 -61
  43. package/dist/components/SharedStatus.spec.js +0 -44
  44. package/dist/components/Sharesubmit.js +0 -28
  45. package/dist/components/__snapshots__/SharedStatus.spec.js.snap +0 -94
  46. package/dist/helpers/owner.js +0 -14
  47. package/dist/helpers/owner.spec.js +0 -34
  48. package/dist/hooks/useConfirmDiscardChanges.js +0 -33
  49. package/dist/hooks/useContactsAndGroups.js +0 -65
  50. package/dist/hooks/useSharedDrive.js +0 -130
  51. package/dist/hooks/useSharedDriveContactsAndGroups.js +0 -65
  52. package/dist/propTypes.js +0 -26
  53. package/dist/styles/shareddrive.styl +0 -8
  54. package/src/components/SharedDrive/SharedDriveRecipient.jsx +0 -62
  55. package/src/components/SharedDrive/SharedDriveRecipientPermissions.jsx +0 -78
  56. package/src/components/SharedDrive/SharedDriveRecipientStatus.jsx +0 -23
  57. package/src/components/SharedFolder/DumbBatchSharedFolderModal.jsx +0 -161
@@ -1,65 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
-
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
-
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
-
8
- import { useQueryAll, isQueryLoading } from 'cozy-client';
9
- import flag from 'cozy-flags';
10
- import { getContactsFromGroupId } from '../helpers/contacts';
11
- import { buildReachableContactsQuery, buildContactGroupsQuery, buildUnreachableContactsWithGroupsQuery } from '../queries/queries';
12
- /**
13
- * Custom hook to fetch and process contacts and groups for sharing
14
- * @param {Array} currentRecipients - Array of current recipients to filter out from groups
15
- * @returns {Object} Object containing contactsAndGroups array and isLoading boolean
16
- */
17
-
18
- var useContactsAndGroups = function useContactsAndGroups() {
19
- var currentRecipients = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
20
- var reachableContactsQuery = buildReachableContactsQuery();
21
- var reachableContactsResult = useQueryAll(reachableContactsQuery.definition, reachableContactsQuery.options);
22
- var unreachableContactsWithGroupsQuery = buildUnreachableContactsWithGroupsQuery();
23
- var unreachableContactsWithGroupsResult = useQueryAll(unreachableContactsWithGroupsQuery.definition, _objectSpread(_objectSpread({}, unreachableContactsWithGroupsQuery.options), {}, {
24
- enabled: !!flag('sharing.show-recipient-groups')
25
- }));
26
- var contactGroupsQuery = buildContactGroupsQuery();
27
- var contactGroupsResult = useQueryAll(contactGroupsQuery.definition, contactGroupsQuery.options);
28
- var isLoading = isQueryLoading(reachableContactsResult) || reachableContactsResult.hasMore || isQueryLoading(contactGroupsResult) || contactGroupsResult.hasMore || flag('sharing.show-recipient-groups') && (isQueryLoading(unreachableContactsWithGroupsResult) || unreachableContactsWithGroupsResult.hasMore);
29
- var currentRecipientGroups = currentRecipients.map(function (_ref) {
30
- var id = _ref.id;
31
- return id;
32
- }).filter(Boolean);
33
- var contactGroups = (contactGroupsResult.data || []).filter(function (_ref2) {
34
- var _id = _ref2._id;
35
- return !flag('sharing.show-recipient-groups') || !currentRecipientGroups.includes(_id);
36
- }).map(function (contactGroup) {
37
- var reachableMembers = getContactsFromGroupId(reachableContactsResult.data, contactGroup.id).map(function (contact) {
38
- return _objectSpread(_objectSpread({}, contact), {}, {
39
- isReachable: true
40
- });
41
- });
42
-
43
- if (flag('sharing.show-recipient-groups') !== true) {
44
- return _objectSpread(_objectSpread({}, contactGroup), {}, {
45
- members: reachableMembers
46
- });
47
- }
48
-
49
- var unreachableMembers = getContactsFromGroupId(unreachableContactsWithGroupsResult.data, contactGroup.id).map(function (contact) {
50
- return _objectSpread(_objectSpread({}, contact), {}, {
51
- isReachable: false
52
- });
53
- });
54
- return _objectSpread(_objectSpread({}, contactGroup), {}, {
55
- members: [].concat(_toConsumableArray(reachableMembers), _toConsumableArray(unreachableMembers))
56
- });
57
- });
58
- var contactsAndGroups = [].concat(_toConsumableArray(reachableContactsResult.data || []), _toConsumableArray(contactGroups));
59
- return {
60
- contactsAndGroups: contactsAndGroups,
61
- isLoading: isLoading
62
- };
63
- };
64
-
65
- export default useContactsAndGroups;
@@ -1,130 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import { useState, useEffect } from 'react';
5
- import { useClient } from 'cozy-client';
6
- import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert';
7
- import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
8
- import { buildSharingsByIdQuery } from '../queries/queries';
9
- /**
10
- * Separates sharing members into recipients and read-only recipients
11
- * @param {Array} members - Array of sharing members
12
- * @returns {Object} Object containing recipients and readOnlyRecipients arrays
13
- */
14
-
15
- var separateMembersByPermission = function separateMembersByPermission(members) {
16
- return members.reduce(function (acc, member) {
17
- if (member.status !== 'owner') {
18
- if (member.read_only === true) {
19
- acc.readOnlyRecipients.push(member);
20
- } else {
21
- acc.recipients.push(member);
22
- }
23
- }
24
-
25
- return acc;
26
- }, {
27
- recipients: [],
28
- readOnlyRecipients: []
29
- });
30
- };
31
- /**
32
- * Custom hook to fetch shared drive data
33
- * @param {string} sharedDriveId - The ID of the shared drive to fetch
34
- * @returns {Object} Object containing shared drive data and loading state
35
- */
36
-
37
-
38
- export var useSharedDrive = function useSharedDrive(sharedDriveId) {
39
- var client = useClient();
40
-
41
- var _useI18n = useI18n(),
42
- t = _useI18n.t;
43
-
44
- var _useAlert = useAlert(),
45
- showAlert = _useAlert.showAlert;
46
-
47
- var _useState = useState(null),
48
- _useState2 = _slicedToArray(_useState, 2),
49
- sharedDrive = _useState2[0],
50
- setSharedDrive = _useState2[1];
51
-
52
- var _useState3 = useState(false),
53
- _useState4 = _slicedToArray(_useState3, 2),
54
- isLoading = _useState4[0],
55
- setIsLoading = _useState4[1];
56
-
57
- useEffect(function () {
58
- var fetchSharedDrive = /*#__PURE__*/function () {
59
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
60
- var _yield$client$query2, sharing, sharedDriveName, sharedDriveRecipients;
61
-
62
- return _regeneratorRuntime.wrap(function _callee$(_context) {
63
- while (1) switch (_context.prev = _context.next) {
64
- case 0:
65
- if (sharedDriveId) {
66
- _context.next = 3;
67
- break;
68
- }
69
-
70
- setSharedDrive(null);
71
- return _context.abrupt("return");
72
-
73
- case 3:
74
- setIsLoading(true);
75
- _context.prev = 4;
76
- _context.next = 7;
77
- return client.query(buildSharingsByIdQuery(sharedDriveId).definition);
78
-
79
- case 7:
80
- _yield$client$query2 = _context.sent;
81
- sharing = _yield$client$query2.data;
82
-
83
- if (sharing) {
84
- sharedDriveName = sharing.rules[0].title || '';
85
- sharedDriveRecipients = separateMembersByPermission(sharing.members);
86
- setSharedDrive({
87
- name: sharedDriveName,
88
- recipients: sharedDriveRecipients
89
- });
90
- } else {
91
- setSharedDrive(null);
92
- }
93
-
94
- _context.next = 16;
95
- break;
96
-
97
- case 12:
98
- _context.prev = 12;
99
- _context.t0 = _context["catch"](4);
100
- setSharedDrive(null);
101
- showAlert({
102
- message: t('SharedDrive.sharedDriveModal.fetchErrorNotification'),
103
- severity: 'error',
104
- variant: 'filled'
105
- });
106
-
107
- case 16:
108
- _context.prev = 16;
109
- setIsLoading(false);
110
- return _context.finish(16);
111
-
112
- case 19:
113
- case "end":
114
- return _context.stop();
115
- }
116
- }, _callee, null, [[4, 12, 16, 19]]);
117
- }));
118
-
119
- return function fetchSharedDrive() {
120
- return _ref.apply(this, arguments);
121
- };
122
- }();
123
-
124
- fetchSharedDrive();
125
- }, [sharedDriveId, client, showAlert, t]);
126
- return {
127
- sharedDrive: sharedDrive,
128
- isLoading: isLoading
129
- };
130
- };
@@ -1,65 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
-
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
-
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
-
8
- import { useQueryAll, isQueryLoading } from 'cozy-client';
9
- import flag from 'cozy-flags';
10
- import { getContactsFromGroupId } from '../helpers/contacts';
11
- import { buildReachableContactsQuery, buildContactGroupsQuery, buildUnreachableContactsWithGroupsQuery } from '../queries/queries';
12
- /**
13
- * Custom hook to fetch and process contacts and groups for sharing
14
- * @param {Array} currentRecipients - Array of current recipients to filter out from groups
15
- * @returns {Object} Object containing contactsAndGroups array and isLoading boolean
16
- */
17
-
18
- var useContactsAndGroups = function useContactsAndGroups() {
19
- var currentRecipients = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
20
- var reachableContactsQuery = buildReachableContactsQuery();
21
- var reachableContactsResult = useQueryAll(reachableContactsQuery.definition, reachableContactsQuery.options);
22
- var unreachableContactsWithGroupsQuery = buildUnreachableContactsWithGroupsQuery();
23
- var unreachableContactsWithGroupsResult = useQueryAll(unreachableContactsWithGroupsQuery.definition, _objectSpread(_objectSpread({}, unreachableContactsWithGroupsQuery.options), {}, {
24
- enabled: !!flag('sharing.show-recipient-groups')
25
- }));
26
- var contactGroupsQuery = buildContactGroupsQuery();
27
- var contactGroupsResult = useQueryAll(contactGroupsQuery.definition, contactGroupsQuery.options);
28
- var isLoading = isQueryLoading(reachableContactsResult) || reachableContactsResult.hasMore || isQueryLoading(contactGroupsResult) || contactGroupsResult.hasMore || flag('sharing.show-recipient-groups') && (isQueryLoading(unreachableContactsWithGroupsResult) || unreachableContactsWithGroupsResult.hasMore);
29
- var currentRecipientGroups = currentRecipients.map(function (_ref) {
30
- var id = _ref.id;
31
- return id;
32
- }).filter(Boolean);
33
- var contactGroups = (contactGroupsResult.data || []).filter(function (_ref2) {
34
- var _id = _ref2._id;
35
- return !flag('sharing.show-recipient-groups') || !currentRecipientGroups.includes(_id);
36
- }).map(function (contactGroup) {
37
- var reachableMembers = getContactsFromGroupId(reachableContactsResult.data, contactGroup.id).map(function (contact) {
38
- return _objectSpread(_objectSpread({}, contact), {}, {
39
- isReachable: true
40
- });
41
- });
42
-
43
- if (flag('sharing.show-recipient-groups') !== true) {
44
- return _objectSpread(_objectSpread({}, contactGroup), {}, {
45
- members: reachableMembers
46
- });
47
- }
48
-
49
- var unreachableMembers = getContactsFromGroupId(unreachableContactsWithGroupsResult.data, contactGroup.id).map(function (contact) {
50
- return _objectSpread(_objectSpread({}, contact), {}, {
51
- isReachable: false
52
- });
53
- });
54
- return _objectSpread(_objectSpread({}, contactGroup), {}, {
55
- members: [].concat(_toConsumableArray(reachableMembers), _toConsumableArray(unreachableMembers))
56
- });
57
- });
58
- var contactsAndGroups = [].concat(_toConsumableArray(reachableContactsResult.data || []), _toConsumableArray(contactGroups));
59
- return {
60
- contactsAndGroups: contactsAndGroups,
61
- isLoading: isLoading
62
- };
63
- };
64
-
65
- export default useContactsAndGroups;
package/dist/propTypes.js DELETED
@@ -1,26 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import { Contact, Group } from './models';
3
- export var contactsResponseType = PropTypes.shape({
4
- count: PropTypes.number,
5
- data: PropTypes.arrayOf(Contact.propType),
6
- definition: PropTypes.object,
7
- fetchMore: PropTypes.func,
8
- fetchStatus: PropTypes.string,
9
- hasMore: PropTypes.bool,
10
- id: PropTypes.string,
11
- lastError: PropTypes.string,
12
- lastFetch: PropTypes.number,
13
- lastUpdate: PropTypes.number
14
- });
15
- export var contactGroupsResponseType = PropTypes.shape({
16
- count: PropTypes.number,
17
- data: PropTypes.arrayOf(Group.propType),
18
- definition: PropTypes.object,
19
- fetchMore: PropTypes.func,
20
- fetchStatus: PropTypes.string,
21
- hasMore: PropTypes.bool,
22
- id: PropTypes.string,
23
- lastError: PropTypes.string,
24
- lastFetch: PropTypes.number,
25
- lastUpdate: PropTypes.number
26
- });
@@ -1,8 +0,0 @@
1
- @require 'components/forms.styl'
2
-
3
- .shared-drive-who-has-access-wrapper
4
- border: 1px solid var(--borderMainColor)
5
- border-radius: 0.5rem
6
- width: 100%
7
- padding: 1rem
8
- box-sizing: border-box
@@ -1,62 +0,0 @@
1
- import PropTypes from 'prop-types'
2
- import React from 'react'
3
-
4
- import Fade from 'cozy-ui/transpiled/react/Fade'
5
- import ListItem from 'cozy-ui/transpiled/react/ListItem'
6
- import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
7
- import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
8
- import Typography from 'cozy-ui/transpiled/react/Typography'
9
- import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
10
- import { useI18n } from 'twake-i18n'
11
-
12
- import SharedDriveRecipientPermissions from './SharedDriveRecipientPermissions'
13
- import SharedDriveRecipientStatus from './SharedDriveRecipientStatus'
14
- import {
15
- FADE_IN_DURATION,
16
- DEFAULT_DISPLAY_NAME
17
- } from '../../helpers/recipients'
18
- import { getDisplayName } from '../../models'
19
- import { GroupAvatar } from '../Avatar/GroupAvatar'
20
- import { MemberAvatar } from '../Avatar/MemberAvatar'
21
-
22
- const SharedDriveRecipient = props => {
23
- const { t } = useI18n()
24
- const { isMobile } = useBreakpoints()
25
-
26
- const { fadeIn, members, ...rest } = props
27
-
28
- const defaultDisplayName = t(DEFAULT_DISPLAY_NAME)
29
- const name = getDisplayName(rest, defaultDisplayName)
30
-
31
- return (
32
- <Fade in timeout={fadeIn ? FADE_IN_DURATION : 0}>
33
- <ListItem gutters={isMobile ? 'default' : 'double'} size="small">
34
- <ListItemIcon>
35
- {members ? (
36
- <GroupAvatar size="m" />
37
- ) : (
38
- <MemberAvatar size="m" recipient={props} />
39
- )}
40
- </ListItemIcon>
41
- <ListItemText
42
- primary={<Typography variant="body1">{name}</Typography>}
43
- secondary={<SharedDriveRecipientStatus {...props} />}
44
- />
45
- <SharedDriveRecipientPermissions
46
- {...props}
47
- className="u-flex-shrink-0"
48
- />
49
- </ListItem>
50
- </Fade>
51
- )
52
- }
53
-
54
- SharedDriveRecipient.propTypes = {
55
- instance: PropTypes.string,
56
- isOwner: PropTypes.bool,
57
- status: PropTypes.string,
58
- recipientConfirmationData: PropTypes.object,
59
- verifyRecipient: PropTypes.func
60
- }
61
-
62
- export default SharedDriveRecipient
@@ -1,78 +0,0 @@
1
- import React, { useState, useRef } from 'react'
2
-
3
- import ActionsMenu from 'cozy-ui/transpiled/react/ActionsMenu'
4
- import { makeActions } from 'cozy-ui/transpiled/react/ActionsMenu/Actions'
5
- import DropdownButton from 'cozy-ui/transpiled/react/DropdownButton'
6
- import Icon from 'cozy-ui/transpiled/react/Icon'
7
- import IconButton from 'cozy-ui/transpiled/react/IconButton'
8
- import CrossCircleOutlineIcon from 'cozy-ui/transpiled/react/Icons/CrossCircleOutline'
9
- import { useI18n } from 'twake-i18n'
10
-
11
- import { setReadOnlySharedPermission } from '../Recipient/actions/setReadOnlySharedPermission'
12
- import { setReadWriteSharedPermission } from '../Recipient/actions/setReadWriteSharedPermission'
13
-
14
- const ShareDriveRecipientPermissions = ({
15
- index,
16
- onSetType,
17
- type,
18
- onRevoke
19
- }) => {
20
- const { t } = useI18n()
21
- const buttonRef = useRef()
22
- const [isMenuDisplayed, setMenuDisplayed] = useState(false)
23
-
24
- const toggleMenu = () => setMenuDisplayed(!isMenuDisplayed)
25
- const hideMenu = () => setMenuDisplayed(false)
26
-
27
- const handleRevocation = async () => {
28
- onRevoke(index)
29
- hideMenu()
30
- }
31
-
32
- const setType = async newType => {
33
- if (newType !== type) {
34
- onSetType(index, newType)
35
- }
36
- hideMenu()
37
- }
38
-
39
- const actions = makeActions(
40
- [setReadOnlySharedPermission, setReadWriteSharedPermission],
41
- {
42
- t,
43
- type,
44
- setType
45
- }
46
- )
47
-
48
- return (
49
- <div>
50
- <DropdownButton
51
- ref={buttonRef}
52
- aria-controls="simple-menu"
53
- aria-haspopup="true"
54
- onClick={toggleMenu}
55
- textVariant="body2"
56
- >
57
- {t(`Share.type.${type}`)}
58
- </DropdownButton>
59
- <ActionsMenu
60
- ref={buttonRef}
61
- open={isMenuDisplayed}
62
- actions={actions}
63
- autoClose
64
- onClose={hideMenu}
65
- />
66
- <IconButton
67
- onClick={handleRevocation}
68
- size="small"
69
- className="u-ml-half"
70
- aria-label={t('Share.members.revoke')}
71
- >
72
- <Icon icon={CrossCircleOutlineIcon} />
73
- </IconButton>
74
- </div>
75
- )
76
- }
77
-
78
- export default ShareDriveRecipientPermissions
@@ -1,23 +0,0 @@
1
- import React from 'react'
2
-
3
- import Typography from 'cozy-ui/transpiled/react/Typography'
4
- import { useI18n } from 'twake-i18n'
5
-
6
- const SharedDriveRecipientStatus = ({ members, email }) => {
7
- const { t } = useI18n()
8
-
9
- const text = members
10
- ? t('GroupRecipient.secondary', {
11
- memberCount: members.length,
12
- smart_count: members.length
13
- })
14
- : email
15
-
16
- return (
17
- <Typography variant="caption" color="textSecondary">
18
- {text}
19
- </Typography>
20
- )
21
- }
22
-
23
- export default SharedDriveRecipientStatus
@@ -1,161 +0,0 @@
1
- import PropTypes from 'prop-types'
2
- import React from 'react'
3
-
4
- import Button from 'cozy-ui/transpiled/react/Buttons'
5
- import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
6
- import TextField from 'cozy-ui/transpiled/react/TextField'
7
- import Typography from 'cozy-ui/transpiled/react/Typography'
8
- import { useI18n } from 'twake-i18n'
9
-
10
- import withLocales from '../../hoc/withLocales'
11
- import AntivirusAlert from '../AntivirusAlert'
12
- import { default as DumbShareByEmail } from '../ShareByEmail'
13
- import ShareByLink from '../ShareByLink'
14
- import WhoHasAccess from '../WhoHasAccess'
15
-
16
- export const DumbBatchSharedFolderModal = withLocales(
17
- ({
18
- title,
19
- document,
20
- folderName,
21
- handleFolderNameChange,
22
- recipients,
23
- currentRecipients,
24
- onRevoke,
25
- onSend,
26
- onClose,
27
- showNameField = false,
28
- sharingLink,
29
- nameLabel,
30
- shareLabel,
31
- showShareByEmail = true,
32
- autoOpenShareRestriction,
33
- showGenerateLinkButton,
34
- pendingRecipients,
35
- onPendingRecipientsChange,
36
- selectedOption,
37
- onSelectedOptionChange
38
- }) => {
39
- const { t } = useI18n()
40
- const actionButtons = (() => {
41
- if (!showShareByEmail) {
42
- return (
43
- <ShareByLink
44
- link={sharingLink}
45
- document={document}
46
- documentType="Files"
47
- showGenerateLinkButton={showGenerateLinkButton}
48
- autoOpenShareRestriction={autoOpenShareRestriction}
49
- />
50
- )
51
- }
52
-
53
- if (!showNameField) {
54
- return (
55
- <>
56
- <ShareByLink
57
- link={sharingLink}
58
- document={document}
59
- documentType="Files"
60
- showGenerateLinkButton={showGenerateLinkButton}
61
- autoOpenShareRestriction={autoOpenShareRestriction}
62
- />
63
- <Button
64
- variant="primary"
65
- label={shareLabel}
66
- disabled={!onSend}
67
- onClick={onSend}
68
- />
69
- </>
70
- )
71
- }
72
-
73
- return null
74
- })()
75
-
76
- return (
77
- <FixedDialog
78
- open
79
- disableGutters
80
- onClose={onClose}
81
- title={title}
82
- classes={{ paper: 'u-ov-visible' }}
83
- componentsProps={{
84
- dialogContent: { className: 'u-ov-visible' }
85
- }}
86
- content={
87
- <div>
88
- <div className="u-ph-2">
89
- <AntivirusAlert document={document} />
90
- {showNameField && handleFolderNameChange && (
91
- <TextField
92
- required
93
- label={nameLabel}
94
- variant="outlined"
95
- size="small"
96
- className="u-w-100 u-mt-1-half"
97
- value={folderName ?? ''}
98
- onChange={handleFolderNameChange}
99
- />
100
- )}
101
- <Typography variant="h6" className="u-mt-1-half u-mb-half">
102
- {t('Share.contacts.addUsers')}
103
- </Typography>
104
- {showShareByEmail && (
105
- <DumbShareByEmail
106
- currentRecipients={currentRecipients}
107
- document={document}
108
- documentType="Files"
109
- pendingRecipients={pendingRecipients}
110
- onPendingRecipientsChange={onPendingRecipientsChange}
111
- selectedOption={selectedOption}
112
- onSelectedOptionChange={onSelectedOptionChange}
113
- />
114
- )}
115
- </div>
116
- <WhoHasAccess
117
- isOwner
118
- isSharedDrive
119
- recipients={recipients}
120
- document={document}
121
- documentType="Files"
122
- className="u-w-100"
123
- onRevoke={onRevoke}
124
- link={sharingLink}
125
- />
126
- </div>
127
- }
128
- actions={actionButtons}
129
- />
130
- )
131
- }
132
- )
133
-
134
- DumbBatchSharedFolderModal.propTypes = {
135
- title: PropTypes.string,
136
- document: PropTypes.object,
137
- folderName: PropTypes.string,
138
- handleFolderNameChange: PropTypes.func,
139
- recipients: PropTypes.array,
140
- currentRecipients: PropTypes.array,
141
- onRevoke: PropTypes.func.isRequired,
142
- onCreate: PropTypes.func,
143
- onSend: PropTypes.func,
144
- onClose: PropTypes.func.isRequired,
145
- onRename: PropTypes.func,
146
- showNameField: PropTypes.bool,
147
- sharingLink: PropTypes.string,
148
- nameLabel: PropTypes.string,
149
- addPeopleLabel: PropTypes.string,
150
- cancelLabel: PropTypes.string,
151
- createLabel: PropTypes.string,
152
- shareLabel: PropTypes.string,
153
- saveLabel: PropTypes.string,
154
- showShareByEmail: PropTypes.bool,
155
- autoOpenShareRestriction: PropTypes.bool,
156
- showGenerateLinkButton: PropTypes.bool,
157
- pendingRecipients: PropTypes.array,
158
- onPendingRecipientsChange: PropTypes.func,
159
- selectedOption: PropTypes.oneOf(['readWrite', 'readOnly']),
160
- onSelectedOptionChange: PropTypes.func
161
- }