cozy-sharing 31.0.2 → 31.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 +14 -0
- package/dist/components/Recipient/GroupRecipientPermissions.js +15 -11
- package/dist/components/Recipient/LinkRecipient.js +15 -11
- package/dist/components/Recipient/LinkRecipientLite.js +1 -1
- package/dist/components/Recipient/LinkRecipientPermissions.js +2 -1
- package/dist/components/Recipient/MemberRecipient.spec.js +8 -10
- package/dist/components/Recipient/MemberRecipientLite.js +1 -1
- package/dist/components/Recipient/MemberRecipientPermissions.js +16 -12
- package/dist/components/Recipient/MemberRecipientPermissions.spec.js +62 -50
- package/dist/components/ShareDialogCozyToCozy.spec.js +1 -1
- package/dist/components/SharedDrive/SharedDriveForm.js +6 -2
- package/dist/components/SharedDrive/SharedDriveRecipientPermissions.js +15 -10
- package/locales/en.json +10 -36
- package/locales/fr.json +10 -36
- package/locales/ru.json +10 -36
- package/locales/vi.json +10 -34
- package/package.json +2 -2
- package/src/components/Recipient/GroupRecipientPermissions.jsx +15 -13
- package/src/components/Recipient/LinkRecipient.jsx +9 -9
- package/src/components/Recipient/LinkRecipientLite.jsx +1 -3
- package/src/components/Recipient/LinkRecipientPermissions.jsx +2 -1
- package/src/components/Recipient/MemberRecipient.spec.jsx +4 -6
- package/src/components/Recipient/MemberRecipientLite.jsx +2 -2
- package/src/components/Recipient/MemberRecipientPermissions.jsx +16 -21
- package/src/components/Recipient/MemberRecipientPermissions.spec.jsx +21 -23
- package/src/components/ShareDialogCozyToCozy.spec.jsx +1 -1
- package/src/components/SharedDrive/SharedDriveForm.jsx +6 -2
- package/src/components/SharedDrive/SharedDriveRecipientPermissions.jsx +15 -17
- package/dist/components/Recipient/actions/revokeGroup.js +0 -42
- package/dist/components/Recipient/actions/revokeMember.js +0 -42
- package/dist/components/Recipient/actions/revokeSharedDriveMember.js +0 -41
- package/src/components/Recipient/actions/revokeGroup.js +0 -42
- package/src/components/Recipient/actions/revokeMember.js +0 -42
- package/src/components/Recipient/actions/revokeSharedDriveMember.js +0 -41
|
@@ -3,17 +3,16 @@ import React, { useState, useRef, useCallback } from 'react'
|
|
|
3
3
|
import { useClient } from 'cozy-client'
|
|
4
4
|
import minilog from 'cozy-minilog'
|
|
5
5
|
import ActionsMenu from 'cozy-ui/transpiled/react/ActionsMenu'
|
|
6
|
-
import {
|
|
7
|
-
makeActions,
|
|
8
|
-
divider
|
|
9
|
-
} from 'cozy-ui/transpiled/react/ActionsMenu/Actions'
|
|
6
|
+
import { makeActions } from 'cozy-ui/transpiled/react/ActionsMenu/Actions'
|
|
10
7
|
import DropdownButton from 'cozy-ui/transpiled/react/DropdownButton'
|
|
8
|
+
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
9
|
+
import IconButton from 'cozy-ui/transpiled/react/IconButton'
|
|
10
|
+
import CrossCircleOutlineIcon from 'cozy-ui/transpiled/react/Icons/CrossCircleOutline'
|
|
11
11
|
import Spinner from 'cozy-ui/transpiled/react/Spinner'
|
|
12
12
|
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
13
13
|
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
|
|
14
14
|
import { useI18n } from 'twake-i18n'
|
|
15
15
|
|
|
16
|
-
import { revokeMember } from './actions/revokeMember'
|
|
17
16
|
import { setReadOnlySharedPermission } from './actions/setReadOnlySharedPermission'
|
|
18
17
|
import { setReadWriteSharedPermission } from './actions/setReadWriteSharedPermission'
|
|
19
18
|
import { useSharingContext } from '../../hooks/useSharingContext'
|
|
@@ -22,7 +21,6 @@ const log = minilog('MemberRecipientPermissions')
|
|
|
22
21
|
|
|
23
22
|
const MemberRecipientPermissions = ({
|
|
24
23
|
isOwner,
|
|
25
|
-
isSharedDrive,
|
|
26
24
|
status,
|
|
27
25
|
instance,
|
|
28
26
|
type,
|
|
@@ -100,20 +98,11 @@ const MemberRecipientPermissions = ({
|
|
|
100
98
|
)
|
|
101
99
|
|
|
102
100
|
const actions = makeActions(
|
|
103
|
-
[
|
|
104
|
-
setReadOnlySharedPermission,
|
|
105
|
-
setReadWriteSharedPermission,
|
|
106
|
-
divider,
|
|
107
|
-
revokeMember
|
|
108
|
-
],
|
|
101
|
+
[setReadOnlySharedPermission, setReadWriteSharedPermission],
|
|
109
102
|
{
|
|
110
|
-
client,
|
|
111
103
|
t,
|
|
112
104
|
type: type ?? 'one-way',
|
|
113
|
-
|
|
114
|
-
isSharedDrive,
|
|
115
|
-
setType,
|
|
116
|
-
handleRevocation
|
|
105
|
+
setType
|
|
117
106
|
}
|
|
118
107
|
)
|
|
119
108
|
|
|
@@ -121,9 +110,7 @@ const MemberRecipientPermissions = ({
|
|
|
121
110
|
<div className={className}>
|
|
122
111
|
{revoking && <Spinner />}
|
|
123
112
|
{!shouldShowMenu && !revoking && (
|
|
124
|
-
<Typography variant="body2">
|
|
125
|
-
{t(`Share.status.${status}`).toLowerCase()}
|
|
126
|
-
</Typography>
|
|
113
|
+
<Typography variant="body2">{t(`Share.status.${status}`)}</Typography>
|
|
127
114
|
)}
|
|
128
115
|
{shouldShowMenu && (
|
|
129
116
|
<>
|
|
@@ -134,7 +121,7 @@ const MemberRecipientPermissions = ({
|
|
|
134
121
|
onClick={toggleMenu}
|
|
135
122
|
textVariant="body2"
|
|
136
123
|
>
|
|
137
|
-
{t(`Share.type.${type}`)
|
|
124
|
+
{t(`Share.type.${type}`)}
|
|
138
125
|
</DropdownButton>
|
|
139
126
|
<ActionsMenu
|
|
140
127
|
ref={buttonRef}
|
|
@@ -143,6 +130,14 @@ const MemberRecipientPermissions = ({
|
|
|
143
130
|
autoClose
|
|
144
131
|
onClose={hideMenu}
|
|
145
132
|
/>
|
|
133
|
+
<IconButton
|
|
134
|
+
onClick={handleRevocation}
|
|
135
|
+
size="small"
|
|
136
|
+
className="u-ml-half"
|
|
137
|
+
aria-label={t('Share.members.revoke')}
|
|
138
|
+
>
|
|
139
|
+
<Icon icon={CrossCircleOutlineIcon} />
|
|
140
|
+
</IconButton>
|
|
146
141
|
</>
|
|
147
142
|
)}
|
|
148
143
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { render, fireEvent, screen,
|
|
1
|
+
import { render, fireEvent, screen, waitFor } from '@testing-library/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
import { createMockClient } from 'cozy-client'
|
|
@@ -74,16 +74,16 @@ describe('MemberRecipientPermissions component', () => {
|
|
|
74
74
|
|
|
75
75
|
it('should render the current permission type', () => {
|
|
76
76
|
setup()
|
|
77
|
-
expect(screen.
|
|
77
|
+
expect(screen.getByRole('button', { name: 'Editor' })).toBeInTheDocument()
|
|
78
78
|
})
|
|
79
79
|
|
|
80
80
|
it('should call updateSharingMemberType when changing to one-way', async () => {
|
|
81
81
|
mockUpdateSharingMemberType.mockResolvedValue(undefined)
|
|
82
82
|
|
|
83
|
-
const {
|
|
83
|
+
const { getByRole } = setup({ type: 'two-way' })
|
|
84
84
|
|
|
85
|
-
fireEvent.click(
|
|
86
|
-
fireEvent.click(
|
|
85
|
+
fireEvent.click(getByRole('button', { name: 'Editor' }))
|
|
86
|
+
fireEvent.click(getByRole('menuitem', { name: 'Viewer' }))
|
|
87
87
|
|
|
88
88
|
expect(mockUpdateSharingMemberType).toHaveBeenCalledWith(
|
|
89
89
|
'sharing-123',
|
|
@@ -95,10 +95,10 @@ describe('MemberRecipientPermissions component', () => {
|
|
|
95
95
|
it('should call updateSharingMemberType when changing to two-way', async () => {
|
|
96
96
|
mockUpdateSharingMemberType.mockResolvedValue(undefined)
|
|
97
97
|
|
|
98
|
-
const {
|
|
98
|
+
const { getByRole } = setup({ type: 'one-way' })
|
|
99
99
|
|
|
100
|
-
fireEvent.click(
|
|
101
|
-
fireEvent.click(
|
|
100
|
+
fireEvent.click(getByRole('button', { name: 'Viewer' }))
|
|
101
|
+
fireEvent.click(getByRole('menuitem', { name: 'Editor' }))
|
|
102
102
|
|
|
103
103
|
expect(mockUpdateSharingMemberType).toHaveBeenCalledWith(
|
|
104
104
|
'sharing-123',
|
|
@@ -110,12 +110,10 @@ describe('MemberRecipientPermissions component', () => {
|
|
|
110
110
|
it('should show error alert when updateSharingMemberType fails', async () => {
|
|
111
111
|
mockUpdateSharingMemberType.mockRejectedValue(new Error('Network error'))
|
|
112
112
|
|
|
113
|
-
const {
|
|
113
|
+
const { getByRole } = setup({ type: 'two-way' })
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
fireEvent.click(getByText('Can view'))
|
|
118
|
-
})
|
|
115
|
+
fireEvent.click(getByRole('button', { name: 'Editor' }))
|
|
116
|
+
fireEvent.click(getByRole('menuitem', { name: 'Viewer' }))
|
|
119
117
|
|
|
120
118
|
await waitFor(() => {
|
|
121
119
|
expect(mockShowAlert).toHaveBeenCalledWith({
|
|
@@ -130,36 +128,36 @@ describe('MemberRecipientPermissions component', () => {
|
|
|
130
128
|
it('should not call updateSharingMemberType when selecting same type', async () => {
|
|
131
129
|
mockUpdateSharingMemberType.mockResolvedValue(undefined)
|
|
132
130
|
|
|
133
|
-
const {
|
|
131
|
+
const { getByRole } = setup({ type: 'two-way' })
|
|
134
132
|
|
|
135
|
-
fireEvent.click(
|
|
136
|
-
fireEvent.click(
|
|
133
|
+
fireEvent.click(getByRole('button', { name: 'Editor' }))
|
|
134
|
+
fireEvent.click(getByRole('menuitem', { name: 'Editor' }))
|
|
137
135
|
|
|
138
136
|
expect(mockUpdateSharingMemberType).not.toHaveBeenCalled()
|
|
139
137
|
})
|
|
140
138
|
|
|
141
139
|
it('should not render menu when user is not owner and not the shared drive contact', () => {
|
|
142
|
-
const {
|
|
140
|
+
const { queryByRole } = setup({
|
|
143
141
|
isOwner: false,
|
|
144
142
|
instance: 'http://other-cozy.local:8080'
|
|
145
143
|
})
|
|
146
144
|
|
|
147
|
-
expect(
|
|
148
|
-
expect(
|
|
145
|
+
expect(queryByRole('button', { name: 'Editor' })).not.toBeInTheDocument()
|
|
146
|
+
expect(queryByRole('button', { name: 'Viewer' })).not.toBeInTheDocument()
|
|
149
147
|
})
|
|
150
148
|
|
|
151
149
|
it('should render menu for owner', () => {
|
|
152
|
-
const {
|
|
150
|
+
const { getByRole } = setup({ isOwner: true })
|
|
153
151
|
|
|
154
|
-
expect(
|
|
152
|
+
expect(getByRole('button', { name: 'Editor' })).toBeInTheDocument()
|
|
155
153
|
})
|
|
156
154
|
|
|
157
155
|
it('should render menu for the user themselves', () => {
|
|
158
|
-
const {
|
|
156
|
+
const { getByRole } = setup({
|
|
159
157
|
isOwner: false,
|
|
160
158
|
instance: 'http://cozy.local:8080'
|
|
161
159
|
})
|
|
162
160
|
|
|
163
|
-
expect(
|
|
161
|
+
expect(getByRole('button', { name: 'Editor' })).toBeInTheDocument()
|
|
164
162
|
})
|
|
165
163
|
})
|
|
@@ -42,7 +42,7 @@ describe('ShareDialogCozyToCozy', () => {
|
|
|
42
42
|
const { getByText } = setup(props)
|
|
43
43
|
|
|
44
44
|
expect(getByText('You')).toBeTruthy()
|
|
45
|
-
expect(getByText('
|
|
45
|
+
expect(getByText('Owner')).toBeTruthy()
|
|
46
46
|
})
|
|
47
47
|
|
|
48
48
|
it('should show loading while calling getRecipientsToBeConfirmed', async () => {
|
|
@@ -59,15 +59,19 @@ export const SharedDriveForm = withLocales(({ onSuccess, onCancel }) => {
|
|
|
59
59
|
onRevoke={onRevoke}
|
|
60
60
|
onSetType={onSetType}
|
|
61
61
|
/>
|
|
62
|
-
<div className="u-flex u-
|
|
62
|
+
<div className="u-flex u-ph-2 u-pv-1">
|
|
63
63
|
<Button
|
|
64
|
-
variant="
|
|
64
|
+
variant="text"
|
|
65
65
|
label={t('SharedDrive.sharedDriveModal.cancel')}
|
|
66
|
+
className="u-w-100 u-m-1"
|
|
67
|
+
size="large"
|
|
66
68
|
onClick={onCancel}
|
|
67
69
|
/>
|
|
68
70
|
<Button
|
|
69
71
|
variant="primary"
|
|
70
72
|
label={t('SharedDrive.sharedDriveModal.create')}
|
|
73
|
+
className="u-w-100 u-m-1"
|
|
74
|
+
size="large"
|
|
71
75
|
onClick={onCreate}
|
|
72
76
|
/>
|
|
73
77
|
</div>
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React, { useState, useRef } from 'react'
|
|
2
2
|
|
|
3
|
-
import { useClient } from 'cozy-client'
|
|
4
3
|
import ActionsMenu from 'cozy-ui/transpiled/react/ActionsMenu'
|
|
5
|
-
import {
|
|
6
|
-
makeActions,
|
|
7
|
-
divider
|
|
8
|
-
} from 'cozy-ui/transpiled/react/ActionsMenu/Actions'
|
|
4
|
+
import { makeActions } from 'cozy-ui/transpiled/react/ActionsMenu/Actions'
|
|
9
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'
|
|
10
9
|
import { useI18n } from 'twake-i18n'
|
|
11
10
|
|
|
12
|
-
import { revokeSharedDriveMember } from '../Recipient/actions/revokeSharedDriveMember'
|
|
13
11
|
import { setReadOnlySharedPermission } from '../Recipient/actions/setReadOnlySharedPermission'
|
|
14
12
|
import { setReadWriteSharedPermission } from '../Recipient/actions/setReadWriteSharedPermission'
|
|
15
13
|
|
|
@@ -21,7 +19,6 @@ const ShareDriveRecipientPermissions = ({
|
|
|
21
19
|
}) => {
|
|
22
20
|
const { t } = useI18n()
|
|
23
21
|
const buttonRef = useRef()
|
|
24
|
-
const client = useClient()
|
|
25
22
|
const [isMenuDisplayed, setMenuDisplayed] = useState(false)
|
|
26
23
|
|
|
27
24
|
const toggleMenu = () => setMenuDisplayed(!isMenuDisplayed)
|
|
@@ -40,18 +37,11 @@ const ShareDriveRecipientPermissions = ({
|
|
|
40
37
|
}
|
|
41
38
|
|
|
42
39
|
const actions = makeActions(
|
|
43
|
-
[
|
|
44
|
-
setReadOnlySharedPermission,
|
|
45
|
-
setReadWriteSharedPermission,
|
|
46
|
-
divider,
|
|
47
|
-
revokeSharedDriveMember
|
|
48
|
-
],
|
|
40
|
+
[setReadOnlySharedPermission, setReadWriteSharedPermission],
|
|
49
41
|
{
|
|
50
42
|
t,
|
|
51
|
-
client,
|
|
52
43
|
type,
|
|
53
|
-
setType
|
|
54
|
-
handleRevocation
|
|
44
|
+
setType
|
|
55
45
|
}
|
|
56
46
|
)
|
|
57
47
|
|
|
@@ -64,7 +54,7 @@ const ShareDriveRecipientPermissions = ({
|
|
|
64
54
|
onClick={toggleMenu}
|
|
65
55
|
textVariant="body2"
|
|
66
56
|
>
|
|
67
|
-
{t(`Share.type.${type}`)
|
|
57
|
+
{t(`Share.type.${type}`)}
|
|
68
58
|
</DropdownButton>
|
|
69
59
|
<ActionsMenu
|
|
70
60
|
ref={buttonRef}
|
|
@@ -73,6 +63,14 @@ const ShareDriveRecipientPermissions = ({
|
|
|
73
63
|
autoClose
|
|
74
64
|
onClose={hideMenu}
|
|
75
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>
|
|
76
74
|
</div>
|
|
77
75
|
)
|
|
78
76
|
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
3
|
-
import ActionsMenuItem from 'cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem';
|
|
4
|
-
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
5
|
-
import ForbiddenIcon from 'cozy-ui/transpiled/react/Icons/Forbidden';
|
|
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
|
-
|
|
10
|
-
var revokeGroup = function revokeGroup(_ref) {
|
|
11
|
-
var t = _ref.t,
|
|
12
|
-
isOwner = _ref.isOwner,
|
|
13
|
-
isSharedDrive = _ref.isSharedDrive,
|
|
14
|
-
handleRevocation = _ref.handleRevocation;
|
|
15
|
-
var revokeType = isOwner ? 'revoke' : 'revokeSelf';
|
|
16
|
-
var title = t("RevokeGroupItem.".concat(revokeType, ".title"));
|
|
17
|
-
var desc = isOwner && isSharedDrive ? t("RevokeGroupItem.revoke.sharedDriveDesc") : t("RevokeGroupItem.".concat(revokeType, ".desc"));
|
|
18
|
-
var icon = ForbiddenIcon;
|
|
19
|
-
return {
|
|
20
|
-
name: 'revokeMember',
|
|
21
|
-
label: title,
|
|
22
|
-
icon: icon,
|
|
23
|
-
action: function action() {
|
|
24
|
-
handleRevocation();
|
|
25
|
-
},
|
|
26
|
-
Component: /*#__PURE__*/forwardRef(function RevokeMemberItem(props, ref) {
|
|
27
|
-
return /*#__PURE__*/React.createElement(ActionsMenuItem, _extends({}, props, {
|
|
28
|
-
ref: ref
|
|
29
|
-
}), /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Icon, {
|
|
30
|
-
icon: icon,
|
|
31
|
-
color: "var(--errorColor)"
|
|
32
|
-
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
33
|
-
primary: /*#__PURE__*/React.createElement(Typography, {
|
|
34
|
-
color: "error"
|
|
35
|
-
}, title),
|
|
36
|
-
secondary: desc
|
|
37
|
-
}));
|
|
38
|
-
})
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export { revokeGroup };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
3
|
-
import ActionsMenuItem from 'cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem';
|
|
4
|
-
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
5
|
-
import TrashIcon from 'cozy-ui/transpiled/react/Icons/Trash';
|
|
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
|
-
|
|
10
|
-
var revokeMember = function revokeMember(_ref) {
|
|
11
|
-
var t = _ref.t,
|
|
12
|
-
isOwner = _ref.isOwner,
|
|
13
|
-
isSharedDrive = _ref.isSharedDrive,
|
|
14
|
-
handleRevocation = _ref.handleRevocation;
|
|
15
|
-
var revokeType = isOwner ? 'revoke' : 'revokeSelf';
|
|
16
|
-
var title = t("RevokeMemberItem.".concat(revokeType, ".title"));
|
|
17
|
-
var desc = isOwner && isSharedDrive ? t("RevokeMemberItem.revoke.sharedDriveDesc") : t("RevokeMemberItem.".concat(revokeType, ".desc"));
|
|
18
|
-
var icon = TrashIcon;
|
|
19
|
-
return {
|
|
20
|
-
name: 'revokeMember',
|
|
21
|
-
label: title,
|
|
22
|
-
icon: icon,
|
|
23
|
-
action: function action() {
|
|
24
|
-
handleRevocation();
|
|
25
|
-
},
|
|
26
|
-
Component: /*#__PURE__*/forwardRef(function RevokeMemberItem(props, ref) {
|
|
27
|
-
return /*#__PURE__*/React.createElement(ActionsMenuItem, _extends({}, props, {
|
|
28
|
-
ref: ref
|
|
29
|
-
}), /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Icon, {
|
|
30
|
-
icon: icon,
|
|
31
|
-
color: "var(--errorColor)"
|
|
32
|
-
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
33
|
-
primary: /*#__PURE__*/React.createElement(Typography, {
|
|
34
|
-
color: "error"
|
|
35
|
-
}, title),
|
|
36
|
-
secondary: desc
|
|
37
|
-
}));
|
|
38
|
-
})
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export { revokeMember };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
3
|
-
import ActionsMenuItem from 'cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem';
|
|
4
|
-
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
5
|
-
import TrashIcon from 'cozy-ui/transpiled/react/Icons/Trash';
|
|
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
|
-
|
|
10
|
-
var makeComponent = function makeComponent(title) {
|
|
11
|
-
var Component = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
12
|
-
return /*#__PURE__*/React.createElement(ActionsMenuItem, _extends({}, props, {
|
|
13
|
-
ref: ref
|
|
14
|
-
}), /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Icon, {
|
|
15
|
-
icon: TrashIcon,
|
|
16
|
-
color: "var(--errorColor)"
|
|
17
|
-
})), /*#__PURE__*/React.createElement(ListItemText, {
|
|
18
|
-
primary: /*#__PURE__*/React.createElement(Typography, {
|
|
19
|
-
color: "error"
|
|
20
|
-
}, title)
|
|
21
|
-
}));
|
|
22
|
-
});
|
|
23
|
-
Component.displayName = 'RevokeSharedDriveMember';
|
|
24
|
-
return Component;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
var revokeSharedDriveMember = function revokeSharedDriveMember(_ref) {
|
|
28
|
-
var t = _ref.t,
|
|
29
|
-
handleRevocation = _ref.handleRevocation;
|
|
30
|
-
var title = t("RevokeSharedDriveMemberItem.revoke.title");
|
|
31
|
-
return {
|
|
32
|
-
name: 'revokeSharedDriveMember',
|
|
33
|
-
label: title,
|
|
34
|
-
action: function action() {
|
|
35
|
-
handleRevocation();
|
|
36
|
-
},
|
|
37
|
-
Component: makeComponent(title)
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export { revokeSharedDriveMember };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react'
|
|
2
|
-
|
|
3
|
-
import ActionsMenuItem from 'cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem'
|
|
4
|
-
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
5
|
-
import ForbiddenIcon from 'cozy-ui/transpiled/react/Icons/Forbidden'
|
|
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
|
-
|
|
10
|
-
const revokeGroup = ({ t, isOwner, isSharedDrive, handleRevocation }) => {
|
|
11
|
-
const revokeType = isOwner ? 'revoke' : 'revokeSelf'
|
|
12
|
-
const title = t(`RevokeGroupItem.${revokeType}.title`)
|
|
13
|
-
const desc =
|
|
14
|
-
isOwner && isSharedDrive
|
|
15
|
-
? t(`RevokeGroupItem.revoke.sharedDriveDesc`)
|
|
16
|
-
: t(`RevokeGroupItem.${revokeType}.desc`)
|
|
17
|
-
|
|
18
|
-
const icon = ForbiddenIcon
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
name: 'revokeMember',
|
|
22
|
-
label: title,
|
|
23
|
-
icon,
|
|
24
|
-
action: () => {
|
|
25
|
-
handleRevocation()
|
|
26
|
-
},
|
|
27
|
-
Component: forwardRef(function RevokeMemberItem(props, ref) {
|
|
28
|
-
return (
|
|
29
|
-
<ActionsMenuItem {...props} ref={ref}>
|
|
30
|
-
<ListItemIcon>
|
|
31
|
-
<Icon icon={icon} color="var(--errorColor)" />
|
|
32
|
-
</ListItemIcon>
|
|
33
|
-
<ListItemText
|
|
34
|
-
primary={<Typography color="error">{title}</Typography>}
|
|
35
|
-
secondary={desc}
|
|
36
|
-
/>
|
|
37
|
-
</ActionsMenuItem>
|
|
38
|
-
)
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
export { revokeGroup }
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react'
|
|
2
|
-
|
|
3
|
-
import ActionsMenuItem from 'cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem'
|
|
4
|
-
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
5
|
-
import TrashIcon from 'cozy-ui/transpiled/react/Icons/Trash'
|
|
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
|
-
|
|
10
|
-
const revokeMember = ({ t, isOwner, isSharedDrive, handleRevocation }) => {
|
|
11
|
-
const revokeType = isOwner ? 'revoke' : 'revokeSelf'
|
|
12
|
-
const title = t(`RevokeMemberItem.${revokeType}.title`)
|
|
13
|
-
const desc =
|
|
14
|
-
isOwner && isSharedDrive
|
|
15
|
-
? t(`RevokeMemberItem.revoke.sharedDriveDesc`)
|
|
16
|
-
: t(`RevokeMemberItem.${revokeType}.desc`)
|
|
17
|
-
|
|
18
|
-
const icon = TrashIcon
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
name: 'revokeMember',
|
|
22
|
-
label: title,
|
|
23
|
-
icon,
|
|
24
|
-
action: () => {
|
|
25
|
-
handleRevocation()
|
|
26
|
-
},
|
|
27
|
-
Component: forwardRef(function RevokeMemberItem(props, ref) {
|
|
28
|
-
return (
|
|
29
|
-
<ActionsMenuItem {...props} ref={ref}>
|
|
30
|
-
<ListItemIcon>
|
|
31
|
-
<Icon icon={icon} color="var(--errorColor)" />
|
|
32
|
-
</ListItemIcon>
|
|
33
|
-
<ListItemText
|
|
34
|
-
primary={<Typography color="error">{title}</Typography>}
|
|
35
|
-
secondary={desc}
|
|
36
|
-
/>
|
|
37
|
-
</ActionsMenuItem>
|
|
38
|
-
)
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
export { revokeMember }
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react'
|
|
2
|
-
|
|
3
|
-
import ActionsMenuItem from 'cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem'
|
|
4
|
-
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
5
|
-
import TrashIcon from 'cozy-ui/transpiled/react/Icons/Trash'
|
|
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
|
-
|
|
10
|
-
const makeComponent = title => {
|
|
11
|
-
const Component = forwardRef((props, ref) => {
|
|
12
|
-
return (
|
|
13
|
-
<ActionsMenuItem {...props} ref={ref}>
|
|
14
|
-
<ListItemIcon>
|
|
15
|
-
<Icon icon={TrashIcon} color="var(--errorColor)" />
|
|
16
|
-
</ListItemIcon>
|
|
17
|
-
<ListItemText
|
|
18
|
-
primary={<Typography color="error">{title}</Typography>}
|
|
19
|
-
/>
|
|
20
|
-
</ActionsMenuItem>
|
|
21
|
-
)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
Component.displayName = 'RevokeSharedDriveMember'
|
|
25
|
-
|
|
26
|
-
return Component
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const revokeSharedDriveMember = ({ t, handleRevocation }) => {
|
|
30
|
-
const title = t(`RevokeSharedDriveMemberItem.revoke.title`)
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
name: 'revokeSharedDriveMember',
|
|
34
|
-
label: title,
|
|
35
|
-
action: () => {
|
|
36
|
-
handleRevocation()
|
|
37
|
-
},
|
|
38
|
-
Component: makeComponent(title)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export { revokeSharedDriveMember }
|