cozy-sharing 31.2.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 +20 -0
- package/dist/assets/icons/shared-drive.svg +1 -0
- package/dist/components/FederatedFolder/FederatedFolderModal.js +3 -2
- package/dist/components/FederatedFolder/FederatedFolderModal.spec.js +3 -3
- package/dist/components/ShareDialogCozyToCozy.js +2 -2
- package/dist/components/SharedDrive/EditSharedDriveModal.js +209 -0
- package/dist/components/SharedDrive/SharedDriveForm.js +7 -4
- package/dist/components/SharedDrive/SharedDriveHeader.js +60 -0
- package/dist/components/SharedFolder/DumbBatchSharedFolderModal.js +5 -29
- package/dist/index.js +1 -0
- package/dist/stylesheet.css +0 -8
- package/locales/en.json +7 -5
- package/locales/fr.json +7 -5
- package/locales/ru.json +7 -5
- package/locales/vi.json +7 -5
- package/package.json +4 -5
- package/src/assets/icons/shared-drive.svg +1 -0
- package/src/components/FederatedFolder/FederatedFolderModal.jsx +3 -2
- package/src/components/FederatedFolder/FederatedFolderModal.spec.jsx +3 -3
- package/src/components/ShareDialogCozyToCozy.jsx +2 -2
- package/src/components/SharedDrive/EditSharedDriveModal.jsx +160 -0
- package/src/components/SharedDrive/SharedDriveForm.jsx +5 -3
- package/src/components/SharedDrive/SharedDriveHeader.jsx +19 -0
- package/src/components/SharedFolder/DumbBatchSharedFolderModal.jsx +3 -26
- package/src/index.jsx +1 -0
- package/dist/components/FederatedFolder/DumbFederatedFolderModal.js +0 -64
- package/dist/components/SharedStatus.js +0 -61
- package/dist/components/SharedStatus.spec.js +0 -44
- package/dist/components/__snapshots__/SharedStatus.spec.js.snap +0 -94
- package/dist/propTypes.js +0 -26
- package/src/components/FederatedFolder/DumbFederatedFolderModal.jsx +0 -71
- package/src/components/SharedStatus.jsx +0 -50
- package/src/components/SharedStatus.spec.js +0 -48
- package/src/components/__snapshots__/SharedStatus.spec.js.snap +0 -94
- package/src/propTypes.js +0 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "32.1.0",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@cozy/minilog": "^1.0.0",
|
|
32
32
|
"classnames": "^2.5.1",
|
|
33
|
-
"cozy-device-helper": "^4.0.3",
|
|
34
33
|
"cozy-doctypes": "^1.99.1",
|
|
35
34
|
"date-fns": "2.30.0",
|
|
36
35
|
"lodash": "^4.17.21",
|
|
@@ -55,7 +54,7 @@
|
|
|
55
54
|
"babel-plugin-css-modules-transform": "1.6.2",
|
|
56
55
|
"babel-plugin-inline-react-svg": "1.1.2",
|
|
57
56
|
"cozy-client": "^60.24.0",
|
|
58
|
-
"cozy-device-helper": "^
|
|
57
|
+
"cozy-device-helper": "^4.0.0",
|
|
59
58
|
"cozy-intent": "^2.31.1",
|
|
60
59
|
"cozy-minilog": "^3.10.1",
|
|
61
60
|
"cozy-ui": "^138.1.0",
|
|
@@ -70,7 +69,7 @@
|
|
|
70
69
|
},
|
|
71
70
|
"peerDependencies": {
|
|
72
71
|
"cozy-client": ">=60.24.0",
|
|
73
|
-
"cozy-device-helper": ">=
|
|
72
|
+
"cozy-device-helper": ">=4.0.0",
|
|
74
73
|
"cozy-flags": ">=4.8.1",
|
|
75
74
|
"cozy-intent": ">=2.29.1",
|
|
76
75
|
"cozy-minilog": ">=3.9.1",
|
|
@@ -84,5 +83,5 @@
|
|
|
84
83
|
"sideEffects": [
|
|
85
84
|
"*.css"
|
|
86
85
|
],
|
|
87
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "1ad45fcf02b511f01376ac0d5e2f2f7bb4b39fc0"
|
|
88
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
|
-
<
|
|
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('
|
|
45
|
-
|
|
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
|
|
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-
|
|
70
|
-
{t('Share.contacts.
|
|
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-
|
|
38
|
-
{t('
|
|
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
|
-
{
|
|
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,61 +0,0 @@
|
|
|
1
|
-
import cx from 'classnames';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { useI18n } from 'twake-i18n';
|
|
4
|
-
import { SharingTooltip, TooltipRecipientList } from './Tooltip';
|
|
5
|
-
|
|
6
|
-
var LinkIcon = function LinkIcon(props) {
|
|
7
|
-
return /*#__PURE__*/React.createElement("svg", props, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("path", {
|
|
8
|
-
d: "M8.88 3.88a1 1 0 1 1-1.415-1.415L9.053.877A2.998 2.998 0 0 1 13.29.876l1.18 1.18a2.998 2.998 0 0 1-.007 4.24L10.999 9.76c-1.535 1.535-4.07 1.583-5.534.12A1 1 0 1 1 6.88 8.465c.67.67 1.94.646 2.705-.119l3.465-3.464a.998.998 0 0 0 .006-1.413l-1.18-1.18a.998.998 0 0 0-1.408.003L8.88 3.88zm-2.415 7.585A1 1 0 1 1 7.88 12.88l-1.587 1.587a2.998 2.998 0 0 1-4.237.002l-1.18-1.18a2.998 2.998 0 0 1 .007-4.24l3.464-3.464c1.534-1.535 4.07-1.583 5.533-.12A1 1 0 1 1 8.465 6.88c-.67-.67-1.94-.646-2.705.119l-3.464 3.464a.998.998 0 0 0-.006 1.413l1.18 1.18a.998.998 0 0 0 1.407-.003l1.588-1.588z",
|
|
9
|
-
id: "link-1-path-1"
|
|
10
|
-
})), /*#__PURE__*/React.createElement("use", {
|
|
11
|
-
fillRule: "nonzero",
|
|
12
|
-
xlinkHref: "#link-1-path-1"
|
|
13
|
-
}));
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
LinkIcon.defaultProps = {
|
|
17
|
-
width: "16",
|
|
18
|
-
height: "16",
|
|
19
|
-
viewBox: "0 0 16 16",
|
|
20
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
21
|
-
xmlnsXlink: "http://www.w3.org/1999/xlink"
|
|
22
|
-
};
|
|
23
|
-
import { getDisplayName } from '../models';
|
|
24
|
-
var styles = {
|
|
25
|
-
"shared-status": "status__shared-status___2HpyL",
|
|
26
|
-
"shared-status-label": "status__shared-status-label___1-jvS"
|
|
27
|
-
};
|
|
28
|
-
export var SharedStatus = function SharedStatus(_ref) {
|
|
29
|
-
var className = _ref.className,
|
|
30
|
-
docId = _ref.docId,
|
|
31
|
-
recipients = _ref.recipients,
|
|
32
|
-
link = _ref.link;
|
|
33
|
-
|
|
34
|
-
var _useI18n = useI18n(),
|
|
35
|
-
t = _useI18n.t;
|
|
36
|
-
|
|
37
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
38
|
-
className: cx(className, styles['shared-status'])
|
|
39
|
-
}, recipients.length > 1 && /*#__PURE__*/React.createElement("a", {
|
|
40
|
-
"data-tip": true,
|
|
41
|
-
"data-for": "members".concat(docId),
|
|
42
|
-
className: styles['shared-status-label']
|
|
43
|
-
}, t('Share.members.count', {
|
|
44
|
-
smart_count: recipients.length
|
|
45
|
-
})), recipients.length > 1 && /*#__PURE__*/React.createElement(SharingTooltip, {
|
|
46
|
-
id: "members".concat(docId)
|
|
47
|
-
}, /*#__PURE__*/React.createElement(TooltipRecipientList, {
|
|
48
|
-
recipientNames: recipients.map(function (recipient) {
|
|
49
|
-
return getDisplayName(recipient);
|
|
50
|
-
})
|
|
51
|
-
})), link && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LinkIcon, {
|
|
52
|
-
style: {
|
|
53
|
-
fill: 'var(--iconTextColor)'
|
|
54
|
-
},
|
|
55
|
-
"data-tip": true,
|
|
56
|
-
"data-for": "linkfor".concat(docId)
|
|
57
|
-
}), /*#__PURE__*/React.createElement(SharingTooltip, {
|
|
58
|
-
id: "linkfor".concat(docId)
|
|
59
|
-
}, /*#__PURE__*/React.createElement("span", null, t('Files.share.sharedByLink')))));
|
|
60
|
-
};
|
|
61
|
-
export default SharedStatus;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { SharedStatus } from './SharedStatus';
|
|
4
|
-
import AppLike from '../../test/AppLike';
|
|
5
|
-
describe('SharedStatus component', function () {
|
|
6
|
-
it('should just render a span if no sharing', function () {
|
|
7
|
-
var _render = render( /*#__PURE__*/React.createElement(AppLike, null, /*#__PURE__*/React.createElement(SharedStatus, {
|
|
8
|
-
docId: "1",
|
|
9
|
-
recipients: []
|
|
10
|
-
}))),
|
|
11
|
-
container = _render.container;
|
|
12
|
-
|
|
13
|
-
expect(container).toMatchSnapshot();
|
|
14
|
-
});
|
|
15
|
-
it('should have the right display if there is several recipients', function () {
|
|
16
|
-
var _render2 = render( /*#__PURE__*/React.createElement(AppLike, null, /*#__PURE__*/React.createElement(SharedStatus, {
|
|
17
|
-
docId: "1",
|
|
18
|
-
recipients: [{
|
|
19
|
-
_id: 1,
|
|
20
|
-
name: '1'
|
|
21
|
-
}, {
|
|
22
|
-
_id: 2,
|
|
23
|
-
name: '2'
|
|
24
|
-
}]
|
|
25
|
-
}))),
|
|
26
|
-
container = _render2.container,
|
|
27
|
-
getByText = _render2.getByText;
|
|
28
|
-
|
|
29
|
-
expect(container).toMatchSnapshot();
|
|
30
|
-
expect(getByText('2 members')).toBeTruthy();
|
|
31
|
-
});
|
|
32
|
-
it('should display the link if there is a link', function () {
|
|
33
|
-
var _render3 = render( /*#__PURE__*/React.createElement(AppLike, null, /*#__PURE__*/React.createElement(SharedStatus, {
|
|
34
|
-
docId: "1",
|
|
35
|
-
recipients: [],
|
|
36
|
-
link: true
|
|
37
|
-
}))),
|
|
38
|
-
container = _render3.container,
|
|
39
|
-
getByText = _render3.getByText;
|
|
40
|
-
|
|
41
|
-
expect(container).toMatchSnapshot();
|
|
42
|
-
expect(getByText('Shared by link')).toBeTruthy();
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
-
|
|
3
|
-
exports[`SharedStatus component should display the link if there is a link 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<div
|
|
6
|
-
class="TwakeTheme--light u-dc"
|
|
7
|
-
>
|
|
8
|
-
<span
|
|
9
|
-
class="shared-status"
|
|
10
|
-
>
|
|
11
|
-
<svg
|
|
12
|
-
currentItem="false"
|
|
13
|
-
data-for="linkfor1"
|
|
14
|
-
data-tip="true"
|
|
15
|
-
height="16"
|
|
16
|
-
style="fill: var(--iconTextColor);"
|
|
17
|
-
viewBox="0 0 16 16"
|
|
18
|
-
width="16"
|
|
19
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
-
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
21
|
-
>
|
|
22
|
-
<defs>
|
|
23
|
-
<path
|
|
24
|
-
d="M8.88 3.88a1 1 0 1 1-1.415-1.415L9.053.877A2.998 2.998 0 0 1 13.29.876l1.18 1.18a2.998 2.998 0 0 1-.007 4.24L10.999 9.76c-1.535 1.535-4.07 1.583-5.534.12A1 1 0 1 1 6.88 8.465c.67.67 1.94.646 2.705-.119l3.465-3.464a.998.998 0 0 0 .006-1.413l-1.18-1.18a.998.998 0 0 0-1.408.003L8.88 3.88zm-2.415 7.585A1 1 0 1 1 7.88 12.88l-1.587 1.587a2.998 2.998 0 0 1-4.237.002l-1.18-1.18a2.998 2.998 0 0 1 .007-4.24l3.464-3.464c1.534-1.535 4.07-1.583 5.533-.12A1 1 0 1 1 8.465 6.88c-.67-.67-1.94-.646-2.705.119l-3.464 3.464a.998.998 0 0 0-.006 1.413l1.18 1.18a.998.998 0 0 0 1.407-.003l1.588-1.588z"
|
|
25
|
-
id="link-1-path-1"
|
|
26
|
-
/>
|
|
27
|
-
</defs>
|
|
28
|
-
<use
|
|
29
|
-
fill-rule="nonzero"
|
|
30
|
-
xlink:href="#link-1-path-1"
|
|
31
|
-
/>
|
|
32
|
-
</svg>
|
|
33
|
-
<div
|
|
34
|
-
class="__react_component_tooltip place-bottom type-dark "
|
|
35
|
-
data-id="tooltip"
|
|
36
|
-
id="linkfor1"
|
|
37
|
-
>
|
|
38
|
-
<span>
|
|
39
|
-
Shared by link
|
|
40
|
-
</span>
|
|
41
|
-
</div>
|
|
42
|
-
</span>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
exports[`SharedStatus component should have the right display if there is several recipients 1`] = `
|
|
48
|
-
<div>
|
|
49
|
-
<div
|
|
50
|
-
class="TwakeTheme--light u-dc"
|
|
51
|
-
>
|
|
52
|
-
<span
|
|
53
|
-
class="shared-status"
|
|
54
|
-
>
|
|
55
|
-
<a
|
|
56
|
-
class="shared-status-label"
|
|
57
|
-
currentitem="false"
|
|
58
|
-
data-for="members1"
|
|
59
|
-
data-tip="true"
|
|
60
|
-
>
|
|
61
|
-
2 members
|
|
62
|
-
</a>
|
|
63
|
-
<div
|
|
64
|
-
class="__react_component_tooltip place-bottom type-dark "
|
|
65
|
-
data-id="tooltip"
|
|
66
|
-
id="members1"
|
|
67
|
-
>
|
|
68
|
-
<ul
|
|
69
|
-
class="shared-tooltip-list"
|
|
70
|
-
>
|
|
71
|
-
<li>
|
|
72
|
-
1
|
|
73
|
-
</li>
|
|
74
|
-
<li>
|
|
75
|
-
2
|
|
76
|
-
</li>
|
|
77
|
-
</ul>
|
|
78
|
-
</div>
|
|
79
|
-
</span>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
`;
|
|
83
|
-
|
|
84
|
-
exports[`SharedStatus component should just render a span if no sharing 1`] = `
|
|
85
|
-
<div>
|
|
86
|
-
<div
|
|
87
|
-
class="TwakeTheme--light u-dc"
|
|
88
|
-
>
|
|
89
|
-
<span
|
|
90
|
-
class="shared-status"
|
|
91
|
-
/>
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
`;
|