cozy-sharing 28.3.4 → 28.4.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 +10 -0
- package/dist/components/FederatedFolder/DumbFederatedFolderModal.js +56 -0
- package/dist/components/FederatedFolder/FederatedFolderModal.js +150 -0
- package/dist/components/FederatedFolder/FederatedFolderModal.spec.js +543 -0
- package/dist/components/Recipient/LinkRecipient.js +1 -1
- package/dist/components/ShareAutosuggest.js +4 -1
- package/dist/components/ShareByEmail.js +105 -33
- package/dist/components/ShareByEmail.spec.js +111 -9
- package/dist/components/ShareByLink.js +3 -3
- package/dist/components/ShareModal/ShareModal.js +18 -2
- package/dist/components/ShareModal.js +1 -1
- package/dist/components/ShareRecipientsInput.js +5 -2
- package/dist/components/SharedDrive/DumbSharedDriveModal.js +39 -72
- package/dist/components/SharedDrive/SharedDriveModal.js +11 -5
- package/dist/components/SharedDrive/helpers.js +28 -2
- package/dist/components/SharedFolder/DumbBatchSharedFolderModal.js +159 -0
- package/dist/components/WhoHasAccess.js +1 -1
- package/dist/index.js +1 -0
- package/locales/en.json +13 -1
- package/locales/fr.json +15 -3
- package/locales/ru.json +13 -1
- package/locales/vi.json +13 -1
- package/package.json +3 -3
- package/src/components/FederatedFolder/DumbFederatedFolderModal.jsx +62 -0
- package/src/components/FederatedFolder/FederatedFolderModal.jsx +119 -0
- package/src/components/FederatedFolder/FederatedFolderModal.spec.jsx +376 -0
- package/src/components/Recipient/LinkRecipient.jsx +1 -1
- package/src/components/ShareAutosuggest.jsx +4 -1
- package/src/components/ShareByEmail.jsx +47 -8
- package/src/components/ShareByEmail.spec.jsx +96 -6
- package/src/components/ShareByLink.jsx +7 -3
- package/src/components/ShareModal/ShareModal.jsx +16 -1
- package/src/components/ShareModal.jsx +1 -1
- package/src/components/ShareRecipientsInput.jsx +5 -2
- package/src/components/SharedDrive/DumbSharedDriveModal.jsx +38 -88
- package/src/components/SharedDrive/SharedDriveModal.jsx +14 -4
- package/src/components/SharedDrive/helpers.js +33 -2
- package/src/components/SharedFolder/DumbBatchSharedFolderModal.jsx +174 -0
- package/src/components/WhoHasAccess.jsx +1 -1
- package/src/index.jsx +1 -0
|
@@ -0,0 +1,174 @@
|
|
|
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
|
+
|
|
9
|
+
import withLocales from '../../hoc/withLocales'
|
|
10
|
+
import AntivirusAlert from '../AntivirusAlert'
|
|
11
|
+
import { default as DumbShareByEmail } from '../ShareByEmail'
|
|
12
|
+
import ShareByLink from '../ShareByLink'
|
|
13
|
+
import WhoHasAccess from '../WhoHasAccess'
|
|
14
|
+
|
|
15
|
+
export const DumbBatchSharedFolderModal = withLocales(
|
|
16
|
+
({
|
|
17
|
+
title,
|
|
18
|
+
document,
|
|
19
|
+
folderName,
|
|
20
|
+
handleFolderNameChange,
|
|
21
|
+
createContact,
|
|
22
|
+
recipients,
|
|
23
|
+
currentRecipients,
|
|
24
|
+
onRevoke,
|
|
25
|
+
onSetType,
|
|
26
|
+
onCreate,
|
|
27
|
+
onSend,
|
|
28
|
+
onClose,
|
|
29
|
+
onShare,
|
|
30
|
+
onRename,
|
|
31
|
+
showNameField = false,
|
|
32
|
+
sharingLink,
|
|
33
|
+
nameLabel,
|
|
34
|
+
addPeopleLabel,
|
|
35
|
+
addButtonLabel,
|
|
36
|
+
cancelLabel,
|
|
37
|
+
createLabel,
|
|
38
|
+
shareLabel,
|
|
39
|
+
saveLabel,
|
|
40
|
+
sharingDesc
|
|
41
|
+
}) => {
|
|
42
|
+
const hasRecipients = Boolean(recipients?.length)
|
|
43
|
+
|
|
44
|
+
// Determine action buttons based on modal mode
|
|
45
|
+
const actionButtons = (() => {
|
|
46
|
+
if (showNameField && onCreate) {
|
|
47
|
+
return (
|
|
48
|
+
<>
|
|
49
|
+
<Button variant="secondary" label={cancelLabel} onClick={onClose} />
|
|
50
|
+
<Button variant="primary" label={createLabel} onClick={onCreate} />
|
|
51
|
+
</>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!showNameField) {
|
|
56
|
+
return (
|
|
57
|
+
<>
|
|
58
|
+
<ShareByLink
|
|
59
|
+
link={sharingLink}
|
|
60
|
+
document={document}
|
|
61
|
+
documentType="Files"
|
|
62
|
+
/>
|
|
63
|
+
<Button
|
|
64
|
+
variant="primary"
|
|
65
|
+
label={shareLabel}
|
|
66
|
+
disabled={!hasRecipients || !onSend}
|
|
67
|
+
onClick={onSend}
|
|
68
|
+
/>
|
|
69
|
+
</>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (onRename) {
|
|
74
|
+
return (
|
|
75
|
+
<Button
|
|
76
|
+
variant="primary"
|
|
77
|
+
label={saveLabel}
|
|
78
|
+
onClick={() => onRename(folderName)}
|
|
79
|
+
/>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return null
|
|
84
|
+
})()
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<FixedDialog
|
|
88
|
+
open
|
|
89
|
+
disableGutters
|
|
90
|
+
onClose={onClose}
|
|
91
|
+
title={title}
|
|
92
|
+
classes={{ paper: 'u-ov-visible' }}
|
|
93
|
+
componentsProps={{
|
|
94
|
+
dialogContent: { className: 'u-ov-visible' }
|
|
95
|
+
}}
|
|
96
|
+
content={
|
|
97
|
+
<div>
|
|
98
|
+
<div className="u-ph-2">
|
|
99
|
+
<AntivirusAlert document={document} />
|
|
100
|
+
{showNameField && handleFolderNameChange && (
|
|
101
|
+
<TextField
|
|
102
|
+
required
|
|
103
|
+
label={nameLabel}
|
|
104
|
+
variant="outlined"
|
|
105
|
+
size="small"
|
|
106
|
+
className="u-w-100 u-mt-1-half"
|
|
107
|
+
value={folderName ?? ''}
|
|
108
|
+
onChange={handleFolderNameChange}
|
|
109
|
+
/>
|
|
110
|
+
)}
|
|
111
|
+
<Typography variant="h6" className="u-mt-1-half u-mb-half">
|
|
112
|
+
{addPeopleLabel}
|
|
113
|
+
</Typography>
|
|
114
|
+
<DumbShareByEmail
|
|
115
|
+
createContact={createContact}
|
|
116
|
+
currentRecipients={currentRecipients}
|
|
117
|
+
document={document}
|
|
118
|
+
documentType="Files"
|
|
119
|
+
sharedDrive
|
|
120
|
+
sharingDesc={sharingDesc}
|
|
121
|
+
onShare={params => {
|
|
122
|
+
onShare(params)
|
|
123
|
+
}}
|
|
124
|
+
submitLabel={addButtonLabel}
|
|
125
|
+
showNotifications={false}
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
<WhoHasAccess
|
|
129
|
+
isOwner
|
|
130
|
+
isSharedDrive
|
|
131
|
+
recipients={recipients}
|
|
132
|
+
document={document}
|
|
133
|
+
documentType="Files"
|
|
134
|
+
className="u-w-100"
|
|
135
|
+
onRevoke={onRevoke}
|
|
136
|
+
onSetType={onSetType}
|
|
137
|
+
link={sharingLink}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
}
|
|
141
|
+
actions={actionButtons}
|
|
142
|
+
/>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
DumbBatchSharedFolderModal.propTypes = {
|
|
148
|
+
title: PropTypes.string,
|
|
149
|
+
document: PropTypes.object,
|
|
150
|
+
folderName: PropTypes.string,
|
|
151
|
+
handleFolderNameChange: PropTypes.func,
|
|
152
|
+
createContact: PropTypes.func.isRequired,
|
|
153
|
+
recipients: PropTypes.array,
|
|
154
|
+
currentRecipients: PropTypes.array,
|
|
155
|
+
onRevoke: PropTypes.func.isRequired,
|
|
156
|
+
onSetType: PropTypes.func.isRequired,
|
|
157
|
+
onCreate: PropTypes.func,
|
|
158
|
+
onSend: PropTypes.func,
|
|
159
|
+
onClose: PropTypes.func.isRequired,
|
|
160
|
+
onShare: PropTypes.func.isRequired,
|
|
161
|
+
onRename: PropTypes.func,
|
|
162
|
+
showNameField: PropTypes.bool,
|
|
163
|
+
sharingLink: PropTypes.string,
|
|
164
|
+
nameLabel: PropTypes.string,
|
|
165
|
+
addPeopleLabel: PropTypes.string,
|
|
166
|
+
addButtonLabel: PropTypes.string,
|
|
167
|
+
cancelLabel: PropTypes.string,
|
|
168
|
+
createLabel: PropTypes.string,
|
|
169
|
+
shareLabel: PropTypes.string,
|
|
170
|
+
saveLabel: PropTypes.string,
|
|
171
|
+
sharingDesc: PropTypes.string.isRequired
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export default DumbBatchSharedFolderModal
|
|
@@ -89,7 +89,7 @@ WhoHasAccess.propTypes = {
|
|
|
89
89
|
email: PropTypes.string.isRequired
|
|
90
90
|
})
|
|
91
91
|
),
|
|
92
|
-
document: PropTypes.object
|
|
92
|
+
document: PropTypes.object,
|
|
93
93
|
documentType: PropTypes.string.isRequired,
|
|
94
94
|
onRevoke: PropTypes.func.isRequired,
|
|
95
95
|
onRevokeSelf: PropTypes.func,
|
package/src/index.jsx
CHANGED
|
@@ -20,6 +20,7 @@ export { default as OwnerRecipientDefaultLite } from './components/Recipient/Own
|
|
|
20
20
|
export { SharedRecipientsList } from './SharedRecipientsList'
|
|
21
21
|
export { ShareButton } from './ShareButton'
|
|
22
22
|
export { SharedDriveModal } from './components/SharedDrive/SharedDriveModal'
|
|
23
|
+
export { FederatedFolderModal } from './components/FederatedFolder/FederatedFolderModal'
|
|
23
24
|
export { ShareModal } from './components/ShareModal/ShareModal'
|
|
24
25
|
export { RefreshableSharings } from './RefreshableSharings'
|
|
25
26
|
export { CozyPassFingerprintDialogContent } from './components/CozyPassFingerprintDialogContent'
|