cozy-sharing 32.0.0 → 32.1.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 CHANGED
@@ -3,6 +3,14 @@
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
+ # [32.1.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@32.0.0...cozy-sharing@32.1.0) (2026-05-18)
7
+
8
+ ### Features
9
+
10
+ - Add EditSharedDriveModal ([042651b](https://github.com/cozy/cozy-libs/commit/042651b7debad197f57315f2b4c8c6d7a94a8230))
11
+ - Add SharedDriveHeader and use it in ShareDriveForm ([d47d62f](https://github.com/cozy/cozy-libs/commit/d47d62fcaf38c5673d76e1701f31f52ff198ed53))
12
+ - Uniformize "Add users" wording ([82b45f7](https://github.com/cozy/cozy-libs/commit/82b45f7d6f1ce0a6929beb02362e86034b4bd2b1))
13
+
6
14
  # [32.0.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@31.2.0...cozy-sharing@32.0.0) (2026-05-18)
7
15
 
8
16
  ### Features
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="102" height="102" fill="none" viewBox="0 0 102 102"><rect width="101.617" height="101.617" fill="#f6faff" rx="50.809"/><path fill="#dcedfd" fill-rule="evenodd" d="M51.742 33.838h22.994c3.162 0 5.748 2.627 5.748 5.838v29.192c0 3.212-2.586 5.838-5.748 5.838H28.748c-3.161 0-5.748-2.626-5.748-5.838l.029-35.03c0-3.212 2.558-5.838 5.72-5.838h17.245z" clip-rule="evenodd"/><path fill="#cfddee" stroke="#cfddee" stroke-width=".709" d="M45.977 44.398h2.381c.205 0 .349.066.44.158.091.09.158.234.158.44 0 .204-.067.348-.158.44-.091.09-.235.157-.44.157h-2.381c-2.006 0-3.689 1.683-3.689 3.688V59.76c0 2.005 1.683 3.687 3.689 3.687h10.477c2.005 0 3.688-1.682 3.689-3.687V58.33c0-.205.066-.35.157-.44.091-.092.235-.158.44-.158s.349.067.44.158c.09.09.158.235.158.44v1.429c0 2.661-2.223 4.883-4.884 4.884H45.977c-2.662 0-4.884-2.223-4.884-4.884V49.28c0-2.661 2.222-4.883 4.884-4.883Zm10.731.057c.226-.112.445-.069.638.124l5.715 5.715a.567.567 0 0 1 0 .832l-5.715 5.715c-.193.193-.412.236-.638.124l-.035-.018-.038-.01c-.163-.04-.303-.223-.303-.512v-3.212h-2.26c-2.728 0-5.056 1.721-5.863 4.346l-.002.008-.003.01a.56.56 0 0 1-.513.398c-.205 0-.47-.166-.62-.447a7.8 7.8 0 0 1-.263-2.055c0-3.995 3.27-7.266 7.264-7.266h2.26v-3.212c0-.29.14-.472.303-.513l.038-.01z"/><path fill="url(#a)" d="M56.454 64.4H45.977c-2.858 0-5.239-2.382-5.239-5.24V48.685c0-2.858 2.381-5.239 5.239-5.239h2.38c.572 0 .953.381.953.953 0 .571-.38.952-.952.952h-2.381c-1.81 0-3.334 1.524-3.334 3.334V59.16c0 1.81 1.524 3.333 3.334 3.333h10.477c1.81 0 3.333-1.524 3.333-3.333v-1.429c0-.571.381-.952.953-.952.571 0 .952.38.952.952v1.429c0 2.857-2.38 5.238-5.238 5.238m-8.763-6.668c-.38 0-.762-.286-.952-.667a8.1 8.1 0 0 1-.286-2.19c0-4.191 3.429-7.62 7.62-7.62h1.904v-2.857c0-.381.191-.762.572-.858.381-.19.762-.095 1.048.191l5.714 5.715a.92.92 0 0 1 0 1.333l-5.714 5.715c-.286.286-.667.38-1.048.19-.381-.095-.572-.476-.572-.857V52.97h-1.904c-2.572 0-4.763 1.619-5.525 4.095a.915.915 0 0 1-.857.667"/><defs><linearGradient id="a" x1="51.914" x2="52.127" y1="34.694" y2="68.833" gradientUnits="userSpaceOnUse"><stop stop-color="#76afff"/><stop offset=".781" stop-color="#1d7aff"/></linearGradient></defs></svg>
@@ -6,11 +6,11 @@ import React, { useEffect, useState } from 'react';
6
6
  import { useClient } from 'cozy-client';
7
7
  import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert';
8
8
  import { useI18n } from 'twake-i18n';
9
- import { DumbFederatedFolderModal } from './DumbFederatedFolderModal';
10
9
  import { getOrCreateFromArray } from '../../helpers/contacts';
11
10
  import withLocales from '../../hoc/withLocales';
12
11
  import { usePendingRecipients } from '../../hooks/usePendingRecipients';
13
12
  import { useSharingContext } from '../../hooks/useSharingContext';
13
+ import { DumbBatchSharedFolderModal } from '../SharedFolder/DumbBatchSharedFolderModal';
14
14
  export var FederatedFolderModal = withLocales(function (_ref) {
15
15
  var onClose = _ref.onClose,
16
16
  existingDocument = _ref.document,
@@ -194,7 +194,7 @@ export var FederatedFolderModal = withLocales(function (_ref) {
194
194
  name: folderName
195
195
  });
196
196
  var isSharedDrive = Boolean(existingDocument === null || existingDocument === void 0 ? void 0 : existingDocument.driveId);
197
- return /*#__PURE__*/React.createElement(DumbFederatedFolderModal, {
197
+ return /*#__PURE__*/React.createElement(DumbBatchSharedFolderModal, {
198
198
  title: modalTitle,
199
199
  document: isSending ? frozenDoc : existingDocument,
200
200
  recipients: isSending ? frozenRecipients : existingRecipients,
@@ -203,6 +203,7 @@ export var FederatedFolderModal = withLocales(function (_ref) {
203
203
  onSend: onSend,
204
204
  onClose: onClose,
205
205
  sharingLink: sharingLink,
206
+ shareLabel: t('FederatedFolder.share'),
206
207
  showShareByEmail: !isSharedDrive,
207
208
  autoOpenShareRestriction: autoOpenShareRestriction,
208
209
  showGenerateLinkButton: showGenerateLinkButton,
@@ -51,9 +51,9 @@ jest.mock('../../hooks/usePendingRecipients', function () {
51
51
  usePendingRecipients: jest.fn()
52
52
  };
53
53
  });
54
- jest.mock('./DumbFederatedFolderModal', function () {
54
+ jest.mock('../SharedFolder/DumbBatchSharedFolderModal', function () {
55
55
  return {
56
- DumbFederatedFolderModal: function DumbFederatedFolderModal(_ref) {
56
+ DumbBatchSharedFolderModal: function DumbBatchSharedFolderModal(_ref) {
57
57
  var title = _ref.title,
58
58
  recipients = _ref.recipients,
59
59
  onRevoke = _ref.onRevoke,
@@ -203,7 +203,7 @@ describe('FederatedFolderModal', function () {
203
203
  }
204
204
  }, _callee2);
205
205
  })));
206
- it('should pass sharing link to DumbFederatedFolderModal', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
206
+ it('should pass sharing link to DumbBatchSharedFolderModal', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
207
207
  var _setup3, getByTestId;
208
208
 
209
209
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -82,8 +82,8 @@ var SharingContent = function SharingContent(_ref) {
82
82
  type: t("".concat(documentType, ".share.shareByEmail.type.").concat(document.type === 'directory' ? 'folder' : 'file'))
83
83
  }), ' ', /*#__PURE__*/React.createElement("strong", null, t("".concat(documentType, ".share.shareByEmail.").concat(hasSharedParent ? 'hasSharedParent' : 'hasSharedChild')))), /*#__PURE__*/React.createElement(Typography, {
84
84
  variant: "h6",
85
- className: "u-mb-1-half"
86
- }, t('Share.contacts.whoHasAccess')), showShareByEmail && /*#__PURE__*/React.createElement(DumbShareByEmail, {
85
+ className: "u-mb-half"
86
+ }, t('Share.contacts.addUsers')), showShareByEmail && /*#__PURE__*/React.createElement(DumbShareByEmail, {
87
87
  currentRecipients: recipients,
88
88
  document: document,
89
89
  documentType: documentType,
@@ -0,0 +1,209 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
+
6
+ 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; }
7
+
8
+ 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; }
9
+
10
+ import PropTypes from 'prop-types';
11
+ import React, { useState } from 'react';
12
+ import { useClient } from 'cozy-client';
13
+ import Button from 'cozy-ui/transpiled/react/Buttons';
14
+ import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
15
+ import TextField from 'cozy-ui/transpiled/react/TextField';
16
+ import Typography from 'cozy-ui/transpiled/react/Typography';
17
+ import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert';
18
+ import { useI18n } from 'twake-i18n';
19
+ import SharedDriveHeader from './SharedDriveHeader';
20
+ import { getOrCreateFromArray } from '../../helpers/contacts';
21
+ import withLocales from '../../hoc/withLocales';
22
+ import { usePendingRecipients } from '../../hooks/usePendingRecipients';
23
+ import { useSharingContext } from '../../hooks/useSharingContext';
24
+ import { default as DumbShareByEmail } from '../ShareByEmail';
25
+ import WhoHasAccess from '../WhoHasAccess';
26
+ export var EditSharedDriveModal = withLocales(function (_ref) {
27
+ var onClose = _ref.onClose,
28
+ document = _ref.document;
29
+ var client = useClient();
30
+
31
+ var _useI18n = useI18n(),
32
+ t = _useI18n.t;
33
+
34
+ var _useSharingContext = useSharingContext(),
35
+ share = _useSharingContext.share,
36
+ getRecipients = _useSharingContext.getRecipients,
37
+ revoke = _useSharingContext.revoke;
38
+
39
+ var _useAlert = useAlert(),
40
+ showAlert = _useAlert.showAlert;
41
+
42
+ var _usePendingRecipients = usePendingRecipients(),
43
+ pendingRecipients = _usePendingRecipients.pendingRecipients,
44
+ setPendingRecipients = _usePendingRecipients.setPendingRecipients,
45
+ selectedOption = _usePendingRecipients.selectedOption,
46
+ setSelectedOption = _usePendingRecipients.setSelectedOption;
47
+
48
+ var _useState = useState(document.name),
49
+ _useState2 = _slicedToArray(_useState, 2),
50
+ driveName = _useState2[0],
51
+ setDriveName = _useState2[1];
52
+
53
+ var _useState3 = useState(false),
54
+ _useState4 = _slicedToArray(_useState3, 2),
55
+ isSaving = _useState4[0],
56
+ setIsSaving = _useState4[1];
57
+
58
+ var onSave = /*#__PURE__*/function () {
59
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
60
+ var contacts, readWriteRecipients, readOnlyRecipients;
61
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
62
+ while (1) switch (_context.prev = _context.next) {
63
+ case 0:
64
+ if (!isSaving) {
65
+ _context.next = 2;
66
+ break;
67
+ }
68
+
69
+ return _context.abrupt("return");
70
+
71
+ case 2:
72
+ setIsSaving(true);
73
+ _context.prev = 3;
74
+ _context.next = 6;
75
+ return getOrCreateFromArray(client, pendingRecipients, function (contact) {
76
+ return client.create('io.cozy.contacts', contact);
77
+ });
78
+
79
+ case 6:
80
+ contacts = _context.sent;
81
+ readWriteRecipients = selectedOption === 'readOnly' ? [] : contacts;
82
+ readOnlyRecipients = selectedOption === 'readOnly' ? contacts : [];
83
+ _context.next = 11;
84
+ return share({
85
+ document: document,
86
+ recipients: readWriteRecipients,
87
+ readOnlyRecipients: readOnlyRecipients,
88
+ sharedDrive: true,
89
+ openSharing: false
90
+ });
91
+
92
+ case 11:
93
+ if (!((document === null || document === void 0 ? void 0 : document.name) !== driveName)) {
94
+ _context.next = 14;
95
+ break;
96
+ }
97
+
98
+ _context.next = 14;
99
+ return client.collection('io.cozy.files').update(_objectSpread(_objectSpread({}, document), {}, {
100
+ name: driveName,
101
+ _rev: document._rev || document.meta.rev
102
+ }));
103
+
104
+ case 14:
105
+ showAlert({
106
+ message: t('SharedDrive.editSharedDriveModal.successNotification'),
107
+ severity: 'success',
108
+ variant: 'filled'
109
+ });
110
+ onClose();
111
+ _context.next = 21;
112
+ break;
113
+
114
+ case 18:
115
+ _context.prev = 18;
116
+ _context.t0 = _context["catch"](3);
117
+ showAlert({
118
+ message: t('SharedDrive.editSharedDriveModal.errorNotification'),
119
+ severity: 'error',
120
+ variant: 'filled'
121
+ });
122
+
123
+ case 21:
124
+ _context.prev = 21;
125
+ setIsSaving(false);
126
+ return _context.finish(21);
127
+
128
+ case 24:
129
+ case "end":
130
+ return _context.stop();
131
+ }
132
+ }, _callee, null, [[3, 18, 21, 24]]);
133
+ }));
134
+
135
+ return function onSave() {
136
+ return _ref2.apply(this, arguments);
137
+ };
138
+ }();
139
+
140
+ var existingRecipients = document ? getRecipients(document._id) : [];
141
+ return /*#__PURE__*/React.createElement(FixedDialog, {
142
+ open: true,
143
+ disableGutters: true,
144
+ onClose: onClose,
145
+ classes: {
146
+ paper: 'u-ov-visible'
147
+ },
148
+ componentsProps: {
149
+ dialogContent: {
150
+ className: 'u-ov-visible'
151
+ }
152
+ },
153
+ content: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
154
+ className: "u-ph-2 u-pt-2"
155
+ }, /*#__PURE__*/React.createElement(SharedDriveHeader, {
156
+ title: t('SharedDrive.editSharedDriveModal.title')
157
+ }), /*#__PURE__*/React.createElement(TextField, {
158
+ required: true,
159
+ label: t('SharedDrive.sharedDriveModal.nameLabel'),
160
+ variant: "outlined",
161
+ size: "small",
162
+ className: "u-w-100 u-mt-1-half u-mb-1-half",
163
+ value: driveName,
164
+ onChange: function onChange(event) {
165
+ return setDriveName(event.target.value);
166
+ }
167
+ }), /*#__PURE__*/React.createElement(Typography, {
168
+ variant: "h6",
169
+ className: "u-mb-half"
170
+ }, t('Share.contacts.addUsers')), /*#__PURE__*/React.createElement(DumbShareByEmail, {
171
+ currentRecipients: [],
172
+ documentType: "Files",
173
+ pendingRecipients: pendingRecipients,
174
+ onPendingRecipientsChange: setPendingRecipients,
175
+ selectedOption: selectedOption,
176
+ onSelectedOptionChange: setSelectedOption
177
+ })), /*#__PURE__*/React.createElement(WhoHasAccess, {
178
+ isOwner: true,
179
+ isSharedDrive: true,
180
+ recipients: existingRecipients,
181
+ document: document,
182
+ documentType: "Files",
183
+ className: "u-w-100",
184
+ onRevoke: revoke
185
+ }), /*#__PURE__*/React.createElement("div", {
186
+ className: "u-flex u-ph-2 u-pv-1"
187
+ }, /*#__PURE__*/React.createElement(Button, {
188
+ variant: "text",
189
+ label: t('SharedDrive.sharedDriveModal.cancel'),
190
+ className: "u-w-100 u-m-1",
191
+ size: "large",
192
+ onClick: onClose
193
+ }), /*#__PURE__*/React.createElement(Button, {
194
+ variant: "primary",
195
+ label: t('SharedDrive.sharedDriveModal.save'),
196
+ className: "u-w-100 u-m-1",
197
+ size: "large",
198
+ disabled: isSaving,
199
+ onClick: onSave
200
+ })))
201
+ });
202
+ });
203
+ EditSharedDriveModal.propTypes = {
204
+ onClose: PropTypes.func.isRequired,
205
+ document: PropTypes.object.isRequired,
206
+ autoOpenShareRestriction: PropTypes.bool,
207
+ showGenerateLinkButton: PropTypes.bool
208
+ };
209
+ export default EditSharedDriveModal;
@@ -6,6 +6,7 @@ import Typography from 'cozy-ui/transpiled/react/Typography';
6
6
  import { useI18n } from 'twake-i18n';
7
7
  import withLocales from '../../hoc/withLocales';
8
8
  import { default as DumbShareByEmail } from '../ShareByEmail';
9
+ import SharedDriveHeader from './SharedDriveHeader';
9
10
  import { useSharedDrive } from './useSharedDrive';
10
11
  export var SharedDriveForm = withLocales(function (_ref) {
11
12
  var onSuccess = _ref.onSuccess,
@@ -27,18 +28,20 @@ export var SharedDriveForm = withLocales(function (_ref) {
27
28
 
28
29
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
29
30
  className: "u-ph-2"
30
- }, /*#__PURE__*/React.createElement(TextField, {
31
+ }, /*#__PURE__*/React.createElement(SharedDriveHeader, {
32
+ title: t('SharedDrive.sharedDriveModal.title')
33
+ }), /*#__PURE__*/React.createElement(TextField, {
31
34
  required: true,
32
35
  label: t('SharedDrive.sharedDriveModal.nameLabel'),
33
36
  variant: "outlined",
34
37
  size: "small",
35
- className: "u-w-100 u-mt-1-half",
38
+ className: "u-w-100 u-mt-1-half u-mb-1-half",
36
39
  value: sharedDriveName,
37
40
  onChange: handleSharedDriveNameChange
38
41
  }), /*#__PURE__*/React.createElement(Typography, {
39
42
  variant: "h6",
40
- className: "u-mt-1-half u-mb-half"
41
- }, t('SharedDrive.sharedDriveModal.addPeople')), /*#__PURE__*/React.createElement(DumbShareByEmail, {
43
+ className: "u-mb-half"
44
+ }, t('Share.contacts.addUsers')), /*#__PURE__*/React.createElement(DumbShareByEmail, {
42
45
  currentRecipients: [],
43
46
  documentType: "Files",
44
47
  pendingRecipients: pendingRecipients,
@@ -0,0 +1,60 @@
1
+ import React from 'react';
2
+ import Icon from 'cozy-ui/transpiled/react/Icon';
3
+ import Typography from 'cozy-ui/transpiled/react/Typography';
4
+
5
+ var SharedDriveIcon = function SharedDriveIcon(props) {
6
+ return /*#__PURE__*/React.createElement("svg", props, /*#__PURE__*/React.createElement("rect", {
7
+ width: "101.617",
8
+ height: "101.617",
9
+ fill: "#f6faff",
10
+ rx: "50.809"
11
+ }), /*#__PURE__*/React.createElement("path", {
12
+ fill: "#dcedfd",
13
+ fillRule: "evenodd",
14
+ d: "M51.742 33.838h22.994c3.162 0 5.748 2.627 5.748 5.838v29.192c0 3.212-2.586 5.838-5.748 5.838H28.748c-3.161 0-5.748-2.626-5.748-5.838l.029-35.03c0-3.212 2.558-5.838 5.72-5.838h17.245z",
15
+ clipRule: "evenodd"
16
+ }), /*#__PURE__*/React.createElement("path", {
17
+ fill: "#cfddee",
18
+ stroke: "#cfddee",
19
+ strokeWidth: ".709",
20
+ d: "M45.977 44.398h2.381c.205 0 .349.066.44.158.091.09.158.234.158.44a.605.605 0 0 1-.158.44c-.091.09-.235.157-.44.157h-2.381c-2.006 0-3.689 1.683-3.689 3.688V59.76c0 2.005 1.683 3.687 3.689 3.687h10.477c2.005 0 3.688-1.682 3.689-3.687v-1.43c0-.205.066-.35.157-.44.091-.092.235-.158.44-.158s.349.067.44.158c.09.09.158.235.158.44v1.429c0 2.661-2.223 4.883-4.884 4.884H45.977c-2.662 0-4.884-2.223-4.884-4.884V49.28c0-2.661 2.222-4.883 4.884-4.883zm10.731.057c.226-.112.445-.069.638.124l5.715 5.715a.567.567 0 0 1 0 .832l-5.715 5.715c-.193.193-.412.236-.638.124l-.035-.018-.038-.01c-.163-.04-.303-.223-.303-.512v-3.212h-2.26c-2.728 0-5.056 1.721-5.863 4.346l-.002.008-.003.01a.56.56 0 0 1-.513.398c-.205 0-.47-.166-.62-.447a7.8 7.8 0 0 1-.263-2.055c0-3.995 3.27-7.266 7.264-7.266h2.26v-3.212c0-.29.14-.472.303-.513l.038-.01z"
21
+ }), /*#__PURE__*/React.createElement("path", {
22
+ fill: "url(#a)",
23
+ d: "M56.454 64.4H45.977c-2.858 0-5.239-2.382-5.239-5.24V48.685c0-2.858 2.381-5.239 5.239-5.239h2.38c.572 0 .953.381.953.953 0 .571-.38.952-.952.952h-2.381c-1.81 0-3.334 1.524-3.334 3.334V59.16c0 1.81 1.524 3.333 3.334 3.333h10.477c1.81 0 3.333-1.524 3.333-3.333v-1.429c0-.571.381-.952.953-.952.571 0 .952.38.952.952v1.429c0 2.857-2.38 5.238-5.238 5.238m-8.763-6.668c-.38 0-.762-.286-.952-.667a8.1 8.1 0 0 1-.286-2.19c0-4.191 3.429-7.62 7.62-7.62h1.904v-2.857c0-.381.191-.762.572-.858.381-.19.762-.095 1.048.191l5.714 5.715a.92.92 0 0 1 0 1.333l-5.714 5.715c-.286.286-.667.38-1.048.19-.381-.095-.572-.476-.572-.857V52.97h-1.904c-2.572 0-4.763 1.619-5.525 4.095a.915.915 0 0 1-.857.667"
24
+ }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
25
+ id: "a",
26
+ x1: "51.914",
27
+ x2: "52.127",
28
+ y1: "34.694",
29
+ y2: "68.833",
30
+ gradientUnits: "userSpaceOnUse"
31
+ }, /*#__PURE__*/React.createElement("stop", {
32
+ stopColor: "#76afff"
33
+ }), /*#__PURE__*/React.createElement("stop", {
34
+ offset: ".781",
35
+ stopColor: "#1d7aff"
36
+ }))));
37
+ };
38
+
39
+ SharedDriveIcon.defaultProps = {
40
+ xmlns: "http://www.w3.org/2000/svg",
41
+ width: "102",
42
+ height: "102",
43
+ fill: "none",
44
+ viewBox: "0 0 102 102"
45
+ };
46
+
47
+ var SharedDriveHeader = function SharedDriveHeader(_ref) {
48
+ var title = _ref.title;
49
+ return /*#__PURE__*/React.createElement("div", {
50
+ className: "u-ta-center"
51
+ }, /*#__PURE__*/React.createElement(Icon, {
52
+ icon: SharedDriveIcon,
53
+ size: 72
54
+ }), /*#__PURE__*/React.createElement(Typography, {
55
+ className: "u-mt-1",
56
+ variant: "h3"
57
+ }, title));
58
+ };
59
+
60
+ export default SharedDriveHeader;
@@ -4,6 +4,7 @@ import Button from 'cozy-ui/transpiled/react/Buttons';
4
4
  import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
5
5
  import TextField from 'cozy-ui/transpiled/react/TextField';
6
6
  import Typography from 'cozy-ui/transpiled/react/Typography';
7
+ import { useI18n } from 'twake-i18n';
7
8
  import withLocales from '../../hoc/withLocales';
8
9
  import AntivirusAlert from '../AntivirusAlert';
9
10
  import { default as DumbShareByEmail } from '../ShareByEmail';
@@ -17,19 +18,13 @@ export var DumbBatchSharedFolderModal = withLocales(function (_ref) {
17
18
  recipients = _ref.recipients,
18
19
  currentRecipients = _ref.currentRecipients,
19
20
  onRevoke = _ref.onRevoke,
20
- onCreate = _ref.onCreate,
21
21
  onSend = _ref.onSend,
22
22
  onClose = _ref.onClose,
23
- onRename = _ref.onRename,
24
23
  _ref$showNameField = _ref.showNameField,
25
24
  showNameField = _ref$showNameField === void 0 ? false : _ref$showNameField,
26
25
  sharingLink = _ref.sharingLink,
27
26
  nameLabel = _ref.nameLabel,
28
- addPeopleLabel = _ref.addPeopleLabel,
29
- cancelLabel = _ref.cancelLabel,
30
- createLabel = _ref.createLabel,
31
27
  shareLabel = _ref.shareLabel,
32
- saveLabel = _ref.saveLabel,
33
28
  _ref$showShareByEmail = _ref.showShareByEmail,
34
29
  showShareByEmail = _ref$showShareByEmail === void 0 ? true : _ref$showShareByEmail,
35
30
  autoOpenShareRestriction = _ref.autoOpenShareRestriction,
@@ -39,19 +34,10 @@ export var DumbBatchSharedFolderModal = withLocales(function (_ref) {
39
34
  selectedOption = _ref.selectedOption,
40
35
  onSelectedOptionChange = _ref.onSelectedOptionChange;
41
36
 
42
- var actionButtons = function () {
43
- if (showNameField && onCreate) {
44
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
45
- variant: "secondary",
46
- label: cancelLabel,
47
- onClick: onClose
48
- }), /*#__PURE__*/React.createElement(Button, {
49
- variant: "primary",
50
- label: createLabel,
51
- onClick: onCreate
52
- }));
53
- }
37
+ var _useI18n = useI18n(),
38
+ t = _useI18n.t;
54
39
 
40
+ var actionButtons = function () {
55
41
  if (!showShareByEmail) {
56
42
  return /*#__PURE__*/React.createElement(ShareByLink, {
57
43
  link: sharingLink,
@@ -77,16 +63,6 @@ export var DumbBatchSharedFolderModal = withLocales(function (_ref) {
77
63
  }));
78
64
  }
79
65
 
80
- if (onRename) {
81
- return /*#__PURE__*/React.createElement(Button, {
82
- variant: "primary",
83
- label: saveLabel,
84
- onClick: function onClick() {
85
- return onRename(folderName);
86
- }
87
- });
88
- }
89
-
90
66
  return null;
91
67
  }();
92
68
 
@@ -118,7 +94,7 @@ export var DumbBatchSharedFolderModal = withLocales(function (_ref) {
118
94
  }), /*#__PURE__*/React.createElement(Typography, {
119
95
  variant: "h6",
120
96
  className: "u-mt-1-half u-mb-half"
121
- }, addPeopleLabel), showShareByEmail && /*#__PURE__*/React.createElement(DumbShareByEmail, {
97
+ }, t('Share.contacts.addUsers')), showShareByEmail && /*#__PURE__*/React.createElement(DumbShareByEmail, {
122
98
  currentRecipients: currentRecipients,
123
99
  document: document,
124
100
  documentType: "Files",
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ export { default as LinkRecipientLite } from './components/Recipient/LinkRecipie
15
15
  export { default as OwnerRecipientDefaultLite } from './components/Recipient/OwnerRecipientDefaultLite';
16
16
  export { SharedRecipientsList } from './SharedRecipientsList';
17
17
  export { ShareButton } from './ShareButton';
18
+ export { EditSharedDriveModal } from './components/SharedDrive/EditSharedDriveModal';
18
19
  export { SharedDriveModal } from './components/SharedDrive/SharedDriveModal';
19
20
  export { SharedDriveForm } from './components/SharedDrive/SharedDriveForm';
20
21
  export { FederatedFolderModal } from './components/FederatedFolder/FederatedFolderModal';
package/locales/en.json CHANGED
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "contacts": {
40
40
  "whoHasAccess": "Who has access?",
41
+ "addUsers": "Add users",
41
42
  "permissionRequired": {
42
43
  "title": "Save your contacts in your Twake?",
43
44
  "desc": "Authorize the application to access to your Twake's contacts: you'll be able to select them next time.",
@@ -439,7 +440,6 @@
439
440
  "shareTitle": "Share \"%{name}\"",
440
441
  "successNotification": "Folder has been shared",
441
442
  "errorNotification": "Error while sharing folder",
442
- "addPeople": "Add people to the shared folder",
443
443
  "add": "Add"
444
444
  },
445
445
  "SharedDrive": {
@@ -450,11 +450,13 @@
450
450
  "cancel": "Cancel",
451
451
  "create": "Create",
452
452
  "save": "Save",
453
- "addPeople": "Add users",
454
453
  "successNotification": "Shared drive has been added",
455
- "errorNotification": "Error during shared drive creation",
456
- "successNotificationUpdate": "Your shared drive has been modified",
457
- "errorNotificationUpdate": "Error durring shared drive modification"
454
+ "errorNotification": "Error during shared drive creation"
455
+ },
456
+ "editSharedDriveModal": {
457
+ "title": "Edit shared drive",
458
+ "successNotification": "Shared drive has been modified",
459
+ "errorNotification": "Error during shared drive modification"
458
460
  }
459
461
  }
460
462
  }
package/locales/fr.json CHANGED
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "contacts": {
40
40
  "whoHasAccess": "Qui a accès ?",
41
+ "addUsers": "Ajouter des utilisateurs",
41
42
  "permissionRequired": {
42
43
  "title": "Enregistrer vos contacts dans votre Twake ?",
43
44
  "desc": "Autorisez l'application à accéder aux contacts de votre Twake : vous pourrez les sélectionner la prochaine fois.",
@@ -437,7 +438,6 @@
437
438
  "shareTitle": "Partager \"%{name}\"",
438
439
  "successNotification": "Le dossier a été partagé",
439
440
  "errorNotification": "Erreur lors du partage du dossier",
440
- "addPeople": "Ajouter des utilisateurs au dossier partagé",
441
441
  "add": "Ajouter"
442
442
  },
443
443
  "SharedDrive": {
@@ -448,11 +448,13 @@
448
448
  "cancel": "Annuler",
449
449
  "create": "Créer",
450
450
  "save": "Enregistrer",
451
- "addPeople": "Ajouter des utilisateurs",
452
451
  "successNotification": "Le drive partagé a été ajouté",
453
- "errorNotification": "Erreur lors de la création du drive partagé",
454
- "successNotificationUpdate": "Votre drive partagé a été modifié",
455
- "errorNotificationUpdate": "Erreur lors de la modification du drive partagé"
452
+ "errorNotification": "Erreur lors de la création du drive partagé"
453
+ },
454
+ "editSharedDriveModal": {
455
+ "title": "Modifier le drive partagé",
456
+ "successNotification": "Le drive partagé a été modifié",
457
+ "errorNotification": "Erreur lors de la modification du drive partagé"
456
458
  }
457
459
  }
458
460
  }
package/locales/ru.json CHANGED
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "contacts": {
40
40
  "whoHasAccess": "У кого есть доступ?",
41
+ "addUsers": "Добавить пользователей",
41
42
  "permissionRequired": {
42
43
  "title": "Сохранить контакты в вашем Twake?",
43
44
  "desc": "Разрешите приложению доступ к контактам вашего Twake: в следующий раз вы сможете выбирать их.",
@@ -439,7 +440,6 @@
439
440
  "shareTitle": "Поделиться \"%{name}\"",
440
441
  "successNotification": "Папка была расшарена",
441
442
  "errorNotification": "Ошибка при расшаривании папки",
442
- "addPeople": "Добавить людей в общую папку",
443
443
  "add": "Добавить"
444
444
  },
445
445
  "SharedDrive": {
@@ -450,11 +450,13 @@
450
450
  "cancel": "Отмена",
451
451
  "create": "Создать",
452
452
  "save": "Сохранить",
453
- "addPeople": "Добавить пользователей",
454
453
  "successNotification": "Общий диск добавлен",
455
- "errorNotification": "Ошибка при создании общего диска",
456
- "successNotificationUpdate": "Ваш общий диск был изменён",
457
- "errorNotificationUpdate": "Ошибка при модификации общего диска"
454
+ "errorNotification": "Ошибка при создании общего диска"
455
+ },
456
+ "editSharedDriveModal": {
457
+ "title": "Редактировать общий диск",
458
+ "successNotification": "Общий диск был изменён",
459
+ "errorNotification": "Ошибка при модификации общего диска"
458
460
  }
459
461
  }
460
462
  }
package/locales/vi.json CHANGED
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "contacts": {
40
40
  "whoHasAccess": "Ai có quyền truy cập?",
41
+ "addUsers": "Thêm người dùng",
41
42
  "permissionRequired": {
42
43
  "title": "Lưu danh bạ của bạn vào Twake của bạn?",
43
44
  "desc": "Cho phép ứng dụng truy cập vào danh bạ Twake của bạn: bạn sẽ có thể chọn họ vào lần sau.",
@@ -439,7 +440,6 @@
439
440
  "shareTitle": "Chia sẻ \"%{name}\"",
440
441
  "successNotification": "Thư mục đã được chia sẻ",
441
442
  "errorNotification": "Lỗi khi chia sẻ thư mục",
442
- "addPeople": "Thêm người vào thư mục được chia sẻ",
443
443
  "add": "Thêm"
444
444
  },
445
445
  "SharedDrive": {
@@ -450,11 +450,13 @@
450
450
  "cancel": "Hủy",
451
451
  "create": "Tạo",
452
452
  "save": "Lưu",
453
- "addPeople": "Thêm người dùng",
454
453
  "successNotification": "Ổ đĩa được chia sẻ đã được thêm",
455
- "errorNotification": "Lỗi trong quá trình tạo ổ đĩa được chia sẻ",
456
- "successNotificationUpdate": "Ổ đĩa được chia sẻ của bạn đã được sửa đổi",
457
- "errorNotificationUpdate": "Lỗi khi sửa đổi ổ đĩa được chia sẻ"
454
+ "errorNotification": "Lỗi trong quá trình tạo ổ đĩa được chia sẻ"
455
+ },
456
+ "editSharedDriveModal": {
457
+ "title": "Sửa ổ đĩa được chia sẻ",
458
+ "successNotification": "Ổ đĩa được chia sẻ đã được sửa đổi",
459
+ "errorNotification": "Lỗi khi sửa đổi ổ đĩa được chia sẻ"
458
460
  }
459
461
  }
460
462
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "32.0.0",
3
+ "version": "32.1.0",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -83,5 +83,5 @@
83
83
  "sideEffects": [
84
84
  "*.css"
85
85
  ],
86
- "gitHead": "53ee03b0d557f6092a4120a884ddc2e71888891a"
86
+ "gitHead": "1ad45fcf02b511f01376ac0d5e2f2f7bb4b39fc0"
87
87
  }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="102" height="102" fill="none" viewBox="0 0 102 102"><rect width="101.617" height="101.617" fill="#f6faff" rx="50.809"/><path fill="#dcedfd" fill-rule="evenodd" d="M51.742 33.838h22.994c3.162 0 5.748 2.627 5.748 5.838v29.192c0 3.212-2.586 5.838-5.748 5.838H28.748c-3.161 0-5.748-2.626-5.748-5.838l.029-35.03c0-3.212 2.558-5.838 5.72-5.838h17.245z" clip-rule="evenodd"/><path fill="#cfddee" stroke="#cfddee" stroke-width=".709" d="M45.977 44.398h2.381c.205 0 .349.066.44.158.091.09.158.234.158.44 0 .204-.067.348-.158.44-.091.09-.235.157-.44.157h-2.381c-2.006 0-3.689 1.683-3.689 3.688V59.76c0 2.005 1.683 3.687 3.689 3.687h10.477c2.005 0 3.688-1.682 3.689-3.687V58.33c0-.205.066-.35.157-.44.091-.092.235-.158.44-.158s.349.067.44.158c.09.09.158.235.158.44v1.429c0 2.661-2.223 4.883-4.884 4.884H45.977c-2.662 0-4.884-2.223-4.884-4.884V49.28c0-2.661 2.222-4.883 4.884-4.883Zm10.731.057c.226-.112.445-.069.638.124l5.715 5.715a.567.567 0 0 1 0 .832l-5.715 5.715c-.193.193-.412.236-.638.124l-.035-.018-.038-.01c-.163-.04-.303-.223-.303-.512v-3.212h-2.26c-2.728 0-5.056 1.721-5.863 4.346l-.002.008-.003.01a.56.56 0 0 1-.513.398c-.205 0-.47-.166-.62-.447a7.8 7.8 0 0 1-.263-2.055c0-3.995 3.27-7.266 7.264-7.266h2.26v-3.212c0-.29.14-.472.303-.513l.038-.01z"/><path fill="url(#a)" d="M56.454 64.4H45.977c-2.858 0-5.239-2.382-5.239-5.24V48.685c0-2.858 2.381-5.239 5.239-5.239h2.38c.572 0 .953.381.953.953 0 .571-.38.952-.952.952h-2.381c-1.81 0-3.334 1.524-3.334 3.334V59.16c0 1.81 1.524 3.333 3.334 3.333h10.477c1.81 0 3.333-1.524 3.333-3.333v-1.429c0-.571.381-.952.953-.952.571 0 .952.38.952.952v1.429c0 2.857-2.38 5.238-5.238 5.238m-8.763-6.668c-.38 0-.762-.286-.952-.667a8.1 8.1 0 0 1-.286-2.19c0-4.191 3.429-7.62 7.62-7.62h1.904v-2.857c0-.381.191-.762.572-.858.381-.19.762-.095 1.048.191l5.714 5.715a.92.92 0 0 1 0 1.333l-5.714 5.715c-.286.286-.667.38-1.048.19-.381-.095-.572-.476-.572-.857V52.97h-1.904c-2.572 0-4.763 1.619-5.525 4.095a.915.915 0 0 1-.857.667"/><defs><linearGradient id="a" x1="51.914" x2="52.127" y1="34.694" y2="68.833" gradientUnits="userSpaceOnUse"><stop stop-color="#76afff"/><stop offset=".781" stop-color="#1d7aff"/></linearGradient></defs></svg>
@@ -5,11 +5,11 @@ import { useClient } from 'cozy-client'
5
5
  import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
6
6
  import { useI18n } from 'twake-i18n'
7
7
 
8
- import { DumbFederatedFolderModal } from './DumbFederatedFolderModal'
9
8
  import { getOrCreateFromArray } from '../../helpers/contacts'
10
9
  import withLocales from '../../hoc/withLocales'
11
10
  import { usePendingRecipients } from '../../hooks/usePendingRecipients'
12
11
  import { useSharingContext } from '../../hooks/useSharingContext'
12
+ import { DumbBatchSharedFolderModal } from '../SharedFolder/DumbBatchSharedFolderModal'
13
13
 
14
14
  export const FederatedFolderModal = withLocales(
15
15
  ({
@@ -133,7 +133,7 @@ export const FederatedFolderModal = withLocales(
133
133
  const isSharedDrive = Boolean(existingDocument?.driveId)
134
134
 
135
135
  return (
136
- <DumbFederatedFolderModal
136
+ <DumbBatchSharedFolderModal
137
137
  title={modalTitle}
138
138
  document={isSending ? frozenDoc : existingDocument}
139
139
  recipients={isSending ? frozenRecipients : existingRecipients}
@@ -142,6 +142,7 @@ export const FederatedFolderModal = withLocales(
142
142
  onSend={onSend}
143
143
  onClose={onClose}
144
144
  sharingLink={sharingLink}
145
+ shareLabel={t('FederatedFolder.share')}
145
146
  showShareByEmail={!isSharedDrive}
146
147
  autoOpenShareRestriction={autoOpenShareRestriction}
147
148
  showGenerateLinkButton={showGenerateLinkButton}
@@ -41,8 +41,8 @@ jest.mock('../../hooks/usePendingRecipients', () => ({
41
41
  usePendingRecipients: jest.fn()
42
42
  }))
43
43
 
44
- jest.mock('./DumbFederatedFolderModal', () => ({
45
- DumbFederatedFolderModal: ({
44
+ jest.mock('../SharedFolder/DumbBatchSharedFolderModal', () => ({
45
+ DumbBatchSharedFolderModal: ({
46
46
  title,
47
47
  recipients,
48
48
  onRevoke,
@@ -161,7 +161,7 @@ describe('FederatedFolderModal', () => {
161
161
  })
162
162
  })
163
163
 
164
- it('should pass sharing link to DumbFederatedFolderModal', async () => {
164
+ it('should pass sharing link to DumbBatchSharedFolderModal', async () => {
165
165
  const { getByTestId } = setup()
166
166
 
167
167
  await waitFor(() => {
@@ -66,8 +66,8 @@ const SharingContent = ({
66
66
  </strong>
67
67
  </div>
68
68
  )}
69
- <Typography variant="h6" className="u-mb-1-half">
70
- {t('Share.contacts.whoHasAccess')}
69
+ <Typography variant="h6" className="u-mb-half">
70
+ {t('Share.contacts.addUsers')}
71
71
  </Typography>
72
72
  {showShareByEmail && (
73
73
  <DumbShareByEmail
@@ -0,0 +1,160 @@
1
+ import PropTypes from 'prop-types'
2
+ import React, { useState } from 'react'
3
+
4
+ import { useClient } from 'cozy-client'
5
+ import Button from 'cozy-ui/transpiled/react/Buttons'
6
+ import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
7
+ import TextField from 'cozy-ui/transpiled/react/TextField'
8
+ import Typography from 'cozy-ui/transpiled/react/Typography'
9
+ import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
10
+ import { useI18n } from 'twake-i18n'
11
+
12
+ import SharedDriveHeader from './SharedDriveHeader'
13
+ import { getOrCreateFromArray } from '../../helpers/contacts'
14
+ import withLocales from '../../hoc/withLocales'
15
+ import { usePendingRecipients } from '../../hooks/usePendingRecipients'
16
+ import { useSharingContext } from '../../hooks/useSharingContext'
17
+ import { default as DumbShareByEmail } from '../ShareByEmail'
18
+ import WhoHasAccess from '../WhoHasAccess'
19
+
20
+ export const EditSharedDriveModal = withLocales(({ onClose, document }) => {
21
+ const client = useClient()
22
+ const { t } = useI18n()
23
+ const { share, getRecipients, revoke } = useSharingContext()
24
+ const { showAlert } = useAlert()
25
+ const {
26
+ pendingRecipients,
27
+ setPendingRecipients,
28
+ selectedOption,
29
+ setSelectedOption
30
+ } = usePendingRecipients()
31
+
32
+ const [driveName, setDriveName] = useState(document.name)
33
+ const [isSaving, setIsSaving] = useState(false)
34
+
35
+ const onSave = async () => {
36
+ if (isSaving) return
37
+ setIsSaving(true)
38
+ try {
39
+ // We add contacts
40
+ const contacts = await getOrCreateFromArray(
41
+ client,
42
+ pendingRecipients,
43
+ contact => client.create('io.cozy.contacts', contact)
44
+ )
45
+ const readWriteRecipients = selectedOption === 'readOnly' ? [] : contacts
46
+ const readOnlyRecipients = selectedOption === 'readOnly' ? contacts : []
47
+
48
+ await share({
49
+ document: document,
50
+ recipients: readWriteRecipients,
51
+ readOnlyRecipients,
52
+ sharedDrive: true,
53
+ openSharing: false
54
+ })
55
+
56
+ // We rename the shared drive
57
+ if (document?.name !== driveName) {
58
+ await client.collection('io.cozy.files').update({
59
+ ...document,
60
+ name: driveName,
61
+ _rev: document._rev || document.meta.rev
62
+ })
63
+ }
64
+
65
+ showAlert({
66
+ message: t('SharedDrive.editSharedDriveModal.successNotification'),
67
+ severity: 'success',
68
+ variant: 'filled'
69
+ })
70
+
71
+ onClose()
72
+ } catch (_err) {
73
+ showAlert({
74
+ message: t('SharedDrive.editSharedDriveModal.errorNotification'),
75
+ severity: 'error',
76
+ variant: 'filled'
77
+ })
78
+ } finally {
79
+ setIsSaving(false)
80
+ }
81
+ }
82
+
83
+ const existingRecipients = document ? getRecipients(document._id) : []
84
+
85
+ return (
86
+ <FixedDialog
87
+ open
88
+ disableGutters
89
+ onClose={onClose}
90
+ classes={{ paper: 'u-ov-visible' }}
91
+ componentsProps={{
92
+ dialogContent: { className: 'u-ov-visible' }
93
+ }}
94
+ content={
95
+ <div>
96
+ <div className="u-ph-2 u-pt-2">
97
+ <SharedDriveHeader
98
+ title={t('SharedDrive.editSharedDriveModal.title')}
99
+ />
100
+ <TextField
101
+ required
102
+ label={t('SharedDrive.sharedDriveModal.nameLabel')}
103
+ variant="outlined"
104
+ size="small"
105
+ className="u-w-100 u-mt-1-half u-mb-1-half"
106
+ value={driveName}
107
+ onChange={event => setDriveName(event.target.value)}
108
+ />
109
+ <Typography variant="h6" className="u-mb-half">
110
+ {t('Share.contacts.addUsers')}
111
+ </Typography>
112
+ <DumbShareByEmail
113
+ currentRecipients={[]}
114
+ documentType="Files"
115
+ pendingRecipients={pendingRecipients}
116
+ onPendingRecipientsChange={setPendingRecipients}
117
+ selectedOption={selectedOption}
118
+ onSelectedOptionChange={setSelectedOption}
119
+ />
120
+ </div>
121
+ <WhoHasAccess
122
+ isOwner
123
+ isSharedDrive
124
+ recipients={existingRecipients}
125
+ document={document}
126
+ documentType="Files"
127
+ className="u-w-100"
128
+ onRevoke={revoke}
129
+ />
130
+ <div className="u-flex u-ph-2 u-pv-1">
131
+ <Button
132
+ variant="text"
133
+ label={t('SharedDrive.sharedDriveModal.cancel')}
134
+ className="u-w-100 u-m-1"
135
+ size="large"
136
+ onClick={onClose}
137
+ />
138
+ <Button
139
+ variant="primary"
140
+ label={t('SharedDrive.sharedDriveModal.save')}
141
+ className="u-w-100 u-m-1"
142
+ size="large"
143
+ disabled={isSaving}
144
+ onClick={onSave}
145
+ />
146
+ </div>
147
+ </div>
148
+ }
149
+ />
150
+ )
151
+ })
152
+
153
+ EditSharedDriveModal.propTypes = {
154
+ onClose: PropTypes.func.isRequired,
155
+ document: PropTypes.object.isRequired,
156
+ autoOpenShareRestriction: PropTypes.bool,
157
+ showGenerateLinkButton: PropTypes.bool
158
+ }
159
+
160
+ export default EditSharedDriveModal
@@ -8,6 +8,7 @@ import { useI18n } from 'twake-i18n'
8
8
 
9
9
  import withLocales from '../../hoc/withLocales'
10
10
  import { default as DumbShareByEmail } from '../ShareByEmail'
11
+ import SharedDriveHeader from './SharedDriveHeader'
11
12
  import { useSharedDrive } from './useSharedDrive'
12
13
 
13
14
  export const SharedDriveForm = withLocales(({ onSuccess, onCancel }) => {
@@ -25,17 +26,18 @@ export const SharedDriveForm = withLocales(({ onSuccess, onCancel }) => {
25
26
  return (
26
27
  <div>
27
28
  <div className="u-ph-2">
29
+ <SharedDriveHeader title={t('SharedDrive.sharedDriveModal.title')} />
28
30
  <TextField
29
31
  required
30
32
  label={t('SharedDrive.sharedDriveModal.nameLabel')}
31
33
  variant="outlined"
32
34
  size="small"
33
- className="u-w-100 u-mt-1-half"
35
+ className="u-w-100 u-mt-1-half u-mb-1-half"
34
36
  value={sharedDriveName}
35
37
  onChange={handleSharedDriveNameChange}
36
38
  />
37
- <Typography variant="h6" className="u-mt-1-half u-mb-half">
38
- {t('SharedDrive.sharedDriveModal.addPeople')}
39
+ <Typography variant="h6" className="u-mb-half">
40
+ {t('Share.contacts.addUsers')}
39
41
  </Typography>
40
42
  <DumbShareByEmail
41
43
  currentRecipients={[]}
@@ -0,0 +1,19 @@
1
+ import React from 'react'
2
+
3
+ import Icon from 'cozy-ui/transpiled/react/Icon'
4
+ import Typography from 'cozy-ui/transpiled/react/Typography'
5
+
6
+ import SharedDriveIcon from '../../assets/icons/shared-drive.svg'
7
+
8
+ const SharedDriveHeader = ({ title }) => {
9
+ return (
10
+ <div className="u-ta-center">
11
+ <Icon icon={SharedDriveIcon} size={72} />
12
+ <Typography className="u-mt-1" variant="h3">
13
+ {title}
14
+ </Typography>
15
+ </div>
16
+ )
17
+ }
18
+
19
+ export default SharedDriveHeader
@@ -5,6 +5,7 @@ import Button from 'cozy-ui/transpiled/react/Buttons'
5
5
  import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
6
6
  import TextField from 'cozy-ui/transpiled/react/TextField'
7
7
  import Typography from 'cozy-ui/transpiled/react/Typography'
8
+ import { useI18n } from 'twake-i18n'
8
9
 
9
10
  import withLocales from '../../hoc/withLocales'
10
11
  import AntivirusAlert from '../AntivirusAlert'
@@ -21,18 +22,12 @@ export const DumbBatchSharedFolderModal = withLocales(
21
22
  recipients,
22
23
  currentRecipients,
23
24
  onRevoke,
24
- onCreate,
25
25
  onSend,
26
26
  onClose,
27
- onRename,
28
27
  showNameField = false,
29
28
  sharingLink,
30
29
  nameLabel,
31
- addPeopleLabel,
32
- cancelLabel,
33
- createLabel,
34
30
  shareLabel,
35
- saveLabel,
36
31
  showShareByEmail = true,
37
32
  autoOpenShareRestriction,
38
33
  showGenerateLinkButton,
@@ -41,16 +36,8 @@ export const DumbBatchSharedFolderModal = withLocales(
41
36
  selectedOption,
42
37
  onSelectedOptionChange
43
38
  }) => {
39
+ const { t } = useI18n()
44
40
  const actionButtons = (() => {
45
- if (showNameField && onCreate) {
46
- return (
47
- <>
48
- <Button variant="secondary" label={cancelLabel} onClick={onClose} />
49
- <Button variant="primary" label={createLabel} onClick={onCreate} />
50
- </>
51
- )
52
- }
53
-
54
41
  if (!showShareByEmail) {
55
42
  return (
56
43
  <ShareByLink
@@ -83,16 +70,6 @@ export const DumbBatchSharedFolderModal = withLocales(
83
70
  )
84
71
  }
85
72
 
86
- if (onRename) {
87
- return (
88
- <Button
89
- variant="primary"
90
- label={saveLabel}
91
- onClick={() => onRename(folderName)}
92
- />
93
- )
94
- }
95
-
96
73
  return null
97
74
  })()
98
75
 
@@ -122,7 +99,7 @@ export const DumbBatchSharedFolderModal = withLocales(
122
99
  />
123
100
  )}
124
101
  <Typography variant="h6" className="u-mt-1-half u-mb-half">
125
- {addPeopleLabel}
102
+ {t('Share.contacts.addUsers')}
126
103
  </Typography>
127
104
  {showShareByEmail && (
128
105
  <DumbShareByEmail
package/src/index.jsx CHANGED
@@ -19,6 +19,7 @@ export { default as LinkRecipientLite } from './components/Recipient/LinkRecipie
19
19
  export { default as OwnerRecipientDefaultLite } from './components/Recipient/OwnerRecipientDefaultLite'
20
20
  export { SharedRecipientsList } from './SharedRecipientsList'
21
21
  export { ShareButton } from './ShareButton'
22
+ export { EditSharedDriveModal } from './components/SharedDrive/EditSharedDriveModal'
22
23
  export { SharedDriveModal } from './components/SharedDrive/SharedDriveModal'
23
24
  export { SharedDriveForm } from './components/SharedDrive/SharedDriveForm'
24
25
  export { FederatedFolderModal } from './components/FederatedFolder/FederatedFolderModal'
@@ -1,64 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import { useI18n } from 'twake-i18n';
4
- import withLocales from '../../hoc/withLocales';
5
- import { DumbBatchSharedFolderModal } from '../SharedFolder/DumbBatchSharedFolderModal';
6
- export var DumbFederatedFolderModal = withLocales(function (_ref) {
7
- var title = _ref.title,
8
- document = _ref.document,
9
- recipients = _ref.recipients,
10
- currentRecipients = _ref.currentRecipients,
11
- onRevoke = _ref.onRevoke,
12
- onSend = _ref.onSend,
13
- onClose = _ref.onClose,
14
- sharingLink = _ref.sharingLink,
15
- showShareByEmail = _ref.showShareByEmail,
16
- autoOpenShareRestriction = _ref.autoOpenShareRestriction,
17
- showGenerateLinkButton = _ref.showGenerateLinkButton,
18
- pendingRecipients = _ref.pendingRecipients,
19
- onPendingRecipientsChange = _ref.onPendingRecipientsChange,
20
- selectedOption = _ref.selectedOption,
21
- onSelectedOptionChange = _ref.onSelectedOptionChange;
22
-
23
- var _useI18n = useI18n(),
24
- t = _useI18n.t;
25
-
26
- return /*#__PURE__*/React.createElement(DumbBatchSharedFolderModal, {
27
- title: title,
28
- document: document,
29
- recipients: recipients,
30
- currentRecipients: currentRecipients,
31
- onRevoke: onRevoke,
32
- onSend: onSend,
33
- onClose: onClose,
34
- sharingLink: sharingLink,
35
- showNameField: false,
36
- addPeopleLabel: t('FederatedFolder.addPeople'),
37
- shareLabel: t('FederatedFolder.share'),
38
- showShareByEmail: showShareByEmail,
39
- autoOpenShareRestriction: autoOpenShareRestriction,
40
- showGenerateLinkButton: showGenerateLinkButton,
41
- pendingRecipients: pendingRecipients,
42
- onPendingRecipientsChange: onPendingRecipientsChange,
43
- selectedOption: selectedOption,
44
- onSelectedOptionChange: onSelectedOptionChange
45
- });
46
- });
47
- DumbFederatedFolderModal.propTypes = {
48
- title: PropTypes.string,
49
- document: PropTypes.object,
50
- recipients: PropTypes.array,
51
- currentRecipients: PropTypes.array,
52
- onRevoke: PropTypes.func.isRequired,
53
- onSend: PropTypes.func.isRequired,
54
- onClose: PropTypes.func.isRequired,
55
- sharingLink: PropTypes.string,
56
- showShareByEmail: PropTypes.bool,
57
- autoOpenShareRestriction: PropTypes.bool,
58
- showGenerateLinkButton: PropTypes.bool,
59
- pendingRecipients: PropTypes.array.isRequired,
60
- onPendingRecipientsChange: PropTypes.func.isRequired,
61
- selectedOption: PropTypes.oneOf(['readWrite', 'readOnly']).isRequired,
62
- onSelectedOptionChange: PropTypes.func.isRequired
63
- };
64
- export default DumbFederatedFolderModal;
@@ -1,71 +0,0 @@
1
- import PropTypes from 'prop-types'
2
- import React from 'react'
3
-
4
- import { useI18n } from 'twake-i18n'
5
-
6
- import withLocales from '../../hoc/withLocales'
7
- import { DumbBatchSharedFolderModal } from '../SharedFolder/DumbBatchSharedFolderModal'
8
-
9
- export const DumbFederatedFolderModal = withLocales(
10
- ({
11
- title,
12
- document,
13
- recipients,
14
- currentRecipients,
15
- onRevoke,
16
- onSend,
17
- onClose,
18
- sharingLink,
19
- showShareByEmail,
20
- autoOpenShareRestriction,
21
- showGenerateLinkButton,
22
- pendingRecipients,
23
- onPendingRecipientsChange,
24
- selectedOption,
25
- onSelectedOptionChange
26
- }) => {
27
- const { t } = useI18n()
28
- return (
29
- <DumbBatchSharedFolderModal
30
- title={title}
31
- document={document}
32
- recipients={recipients}
33
- currentRecipients={currentRecipients}
34
- onRevoke={onRevoke}
35
- onSend={onSend}
36
- onClose={onClose}
37
- sharingLink={sharingLink}
38
- showNameField={false}
39
- addPeopleLabel={t('FederatedFolder.addPeople')}
40
- shareLabel={t('FederatedFolder.share')}
41
- showShareByEmail={showShareByEmail}
42
- autoOpenShareRestriction={autoOpenShareRestriction}
43
- showGenerateLinkButton={showGenerateLinkButton}
44
- pendingRecipients={pendingRecipients}
45
- onPendingRecipientsChange={onPendingRecipientsChange}
46
- selectedOption={selectedOption}
47
- onSelectedOptionChange={onSelectedOptionChange}
48
- />
49
- )
50
- }
51
- )
52
-
53
- DumbFederatedFolderModal.propTypes = {
54
- title: PropTypes.string,
55
- document: PropTypes.object,
56
- recipients: PropTypes.array,
57
- currentRecipients: PropTypes.array,
58
- onRevoke: PropTypes.func.isRequired,
59
- onSend: PropTypes.func.isRequired,
60
- onClose: PropTypes.func.isRequired,
61
- sharingLink: PropTypes.string,
62
- showShareByEmail: PropTypes.bool,
63
- autoOpenShareRestriction: PropTypes.bool,
64
- showGenerateLinkButton: PropTypes.bool,
65
- pendingRecipients: PropTypes.array.isRequired,
66
- onPendingRecipientsChange: PropTypes.func.isRequired,
67
- selectedOption: PropTypes.oneOf(['readWrite', 'readOnly']).isRequired,
68
- onSelectedOptionChange: PropTypes.func.isRequired
69
- }
70
-
71
- export default DumbFederatedFolderModal