cozy-sharing 32.1.2 → 32.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/components/FederatedFolder/FederatedFolderModal.js +96 -22
  3. package/dist/components/FederatedFolder/FederatedFolderModal.spec.js +137 -219
  4. package/dist/components/Recipient/RecipientList.js +0 -15
  5. package/dist/components/ShareAutosuggest.js +1 -0
  6. package/dist/components/ShareAutosuggest.spec.js +12 -4
  7. package/dist/components/ShareDialogCozyToCozy.spec.js +55 -8
  8. package/dist/components/ShareDiscardChangesModal.js +35 -0
  9. package/dist/components/ShareModal/ShareModal.js +8 -8
  10. package/dist/components/ShareRecipientsInput.js +13 -3
  11. package/dist/components/ShareRecipientsInput.spec.js +63 -4
  12. package/dist/state.js +6 -1
  13. package/locales/en.json +10 -5
  14. package/locales/fr.json +10 -5
  15. package/locales/ru.json +10 -5
  16. package/locales/vi.json +10 -5
  17. package/package.json +2 -2
  18. package/src/components/FederatedFolder/FederatedFolderModal.jsx +230 -138
  19. package/src/components/FederatedFolder/FederatedFolderModal.spec.jsx +59 -134
  20. package/src/components/Recipient/RecipientList.jsx +0 -18
  21. package/src/components/ShareAutosuggest.jsx +1 -0
  22. package/src/components/ShareAutosuggest.spec.jsx +10 -5
  23. package/src/components/ShareDialogCozyToCozy.spec.jsx +50 -4
  24. package/src/components/ShareDiscardChangesModal.jsx +40 -0
  25. package/src/components/ShareModal/ShareModal.jsx +5 -5
  26. package/src/components/ShareRecipientsInput.jsx +11 -6
  27. package/src/components/ShareRecipientsInput.spec.jsx +59 -0
  28. package/src/state.js +5 -1
  29. package/dist/components/SharedDrive/SharedDriveRecipient.js +0 -61
  30. package/dist/components/SharedDrive/SharedDriveRecipientPermissions.js +0 -109
  31. package/dist/components/SharedDrive/SharedDriveRecipientStatus.js +0 -22
  32. package/dist/components/SharedFolder/DumbBatchSharedFolderModal.js +0 -145
  33. package/src/components/SharedDrive/SharedDriveRecipient.jsx +0 -62
  34. package/src/components/SharedDrive/SharedDriveRecipientPermissions.jsx +0 -78
  35. package/src/components/SharedDrive/SharedDriveRecipientStatus.jsx +0 -23
  36. package/src/components/SharedFolder/DumbBatchSharedFolderModal.jsx +0 -161
@@ -1,62 +0,0 @@
1
- import PropTypes from 'prop-types'
2
- import React from 'react'
3
-
4
- import Fade from 'cozy-ui/transpiled/react/Fade'
5
- import ListItem from 'cozy-ui/transpiled/react/ListItem'
6
- import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
7
- import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
8
- import Typography from 'cozy-ui/transpiled/react/Typography'
9
- import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
10
- import { useI18n } from 'twake-i18n'
11
-
12
- import SharedDriveRecipientPermissions from './SharedDriveRecipientPermissions'
13
- import SharedDriveRecipientStatus from './SharedDriveRecipientStatus'
14
- import {
15
- FADE_IN_DURATION,
16
- DEFAULT_DISPLAY_NAME
17
- } from '../../helpers/recipients'
18
- import { getDisplayName } from '../../models'
19
- import { GroupAvatar } from '../Avatar/GroupAvatar'
20
- import { MemberAvatar } from '../Avatar/MemberAvatar'
21
-
22
- const SharedDriveRecipient = props => {
23
- const { t } = useI18n()
24
- const { isMobile } = useBreakpoints()
25
-
26
- const { fadeIn, members, ...rest } = props
27
-
28
- const defaultDisplayName = t(DEFAULT_DISPLAY_NAME)
29
- const name = getDisplayName(rest, defaultDisplayName)
30
-
31
- return (
32
- <Fade in timeout={fadeIn ? FADE_IN_DURATION : 0}>
33
- <ListItem gutters={isMobile ? 'default' : 'double'} size="small">
34
- <ListItemIcon>
35
- {members ? (
36
- <GroupAvatar size="m" />
37
- ) : (
38
- <MemberAvatar size="m" recipient={props} />
39
- )}
40
- </ListItemIcon>
41
- <ListItemText
42
- primary={<Typography variant="body1">{name}</Typography>}
43
- secondary={<SharedDriveRecipientStatus {...props} />}
44
- />
45
- <SharedDriveRecipientPermissions
46
- {...props}
47
- className="u-flex-shrink-0"
48
- />
49
- </ListItem>
50
- </Fade>
51
- )
52
- }
53
-
54
- SharedDriveRecipient.propTypes = {
55
- instance: PropTypes.string,
56
- isOwner: PropTypes.bool,
57
- status: PropTypes.string,
58
- recipientConfirmationData: PropTypes.object,
59
- verifyRecipient: PropTypes.func
60
- }
61
-
62
- export default SharedDriveRecipient
@@ -1,78 +0,0 @@
1
- import React, { useState, useRef } from 'react'
2
-
3
- import ActionsMenu from 'cozy-ui/transpiled/react/ActionsMenu'
4
- import { makeActions } from 'cozy-ui/transpiled/react/ActionsMenu/Actions'
5
- import DropdownButton from 'cozy-ui/transpiled/react/DropdownButton'
6
- import Icon from 'cozy-ui/transpiled/react/Icon'
7
- import IconButton from 'cozy-ui/transpiled/react/IconButton'
8
- import CrossCircleOutlineIcon from 'cozy-ui/transpiled/react/Icons/CrossCircleOutline'
9
- import { useI18n } from 'twake-i18n'
10
-
11
- import { setReadOnlySharedPermission } from '../Recipient/actions/setReadOnlySharedPermission'
12
- import { setReadWriteSharedPermission } from '../Recipient/actions/setReadWriteSharedPermission'
13
-
14
- const ShareDriveRecipientPermissions = ({
15
- index,
16
- onSetType,
17
- type,
18
- onRevoke
19
- }) => {
20
- const { t } = useI18n()
21
- const buttonRef = useRef()
22
- const [isMenuDisplayed, setMenuDisplayed] = useState(false)
23
-
24
- const toggleMenu = () => setMenuDisplayed(!isMenuDisplayed)
25
- const hideMenu = () => setMenuDisplayed(false)
26
-
27
- const handleRevocation = async () => {
28
- onRevoke(index)
29
- hideMenu()
30
- }
31
-
32
- const setType = async newType => {
33
- if (newType !== type) {
34
- onSetType(index, newType)
35
- }
36
- hideMenu()
37
- }
38
-
39
- const actions = makeActions(
40
- [setReadOnlySharedPermission, setReadWriteSharedPermission],
41
- {
42
- t,
43
- type,
44
- setType
45
- }
46
- )
47
-
48
- return (
49
- <div>
50
- <DropdownButton
51
- ref={buttonRef}
52
- aria-controls="simple-menu"
53
- aria-haspopup="true"
54
- onClick={toggleMenu}
55
- textVariant="body2"
56
- >
57
- {t(`Share.type.${type}`)}
58
- </DropdownButton>
59
- <ActionsMenu
60
- ref={buttonRef}
61
- open={isMenuDisplayed}
62
- actions={actions}
63
- autoClose
64
- onClose={hideMenu}
65
- />
66
- <IconButton
67
- onClick={handleRevocation}
68
- size="small"
69
- className="u-ml-half"
70
- aria-label={t('Share.members.revoke')}
71
- >
72
- <Icon icon={CrossCircleOutlineIcon} />
73
- </IconButton>
74
- </div>
75
- )
76
- }
77
-
78
- export default ShareDriveRecipientPermissions
@@ -1,23 +0,0 @@
1
- import React from 'react'
2
-
3
- import Typography from 'cozy-ui/transpiled/react/Typography'
4
- import { useI18n } from 'twake-i18n'
5
-
6
- const SharedDriveRecipientStatus = ({ members, email }) => {
7
- const { t } = useI18n()
8
-
9
- const text = members
10
- ? t('GroupRecipient.secondary', {
11
- memberCount: members.length,
12
- smart_count: members.length
13
- })
14
- : email
15
-
16
- return (
17
- <Typography variant="caption" color="textSecondary">
18
- {text}
19
- </Typography>
20
- )
21
- }
22
-
23
- export default SharedDriveRecipientStatus
@@ -1,161 +0,0 @@
1
- import PropTypes from 'prop-types'
2
- import React from 'react'
3
-
4
- import Button from 'cozy-ui/transpiled/react/Buttons'
5
- import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
6
- import TextField from 'cozy-ui/transpiled/react/TextField'
7
- import Typography from 'cozy-ui/transpiled/react/Typography'
8
- import { useI18n } from 'twake-i18n'
9
-
10
- import withLocales from '../../hoc/withLocales'
11
- import AntivirusAlert from '../AntivirusAlert'
12
- import { default as DumbShareByEmail } from '../ShareByEmail'
13
- import ShareByLink from '../ShareByLink'
14
- import WhoHasAccess from '../WhoHasAccess'
15
-
16
- export const DumbBatchSharedFolderModal = withLocales(
17
- ({
18
- title,
19
- document,
20
- folderName,
21
- handleFolderNameChange,
22
- recipients,
23
- currentRecipients,
24
- onRevoke,
25
- onSend,
26
- onClose,
27
- showNameField = false,
28
- sharingLink,
29
- nameLabel,
30
- shareLabel,
31
- showShareByEmail = true,
32
- autoOpenShareRestriction,
33
- showGenerateLinkButton,
34
- pendingRecipients,
35
- onPendingRecipientsChange,
36
- selectedOption,
37
- onSelectedOptionChange
38
- }) => {
39
- const { t } = useI18n()
40
- const actionButtons = (() => {
41
- if (!showShareByEmail) {
42
- return (
43
- <ShareByLink
44
- link={sharingLink}
45
- document={document}
46
- documentType="Files"
47
- showGenerateLinkButton={showGenerateLinkButton}
48
- autoOpenShareRestriction={autoOpenShareRestriction}
49
- />
50
- )
51
- }
52
-
53
- if (!showNameField) {
54
- return (
55
- <>
56
- <ShareByLink
57
- link={sharingLink}
58
- document={document}
59
- documentType="Files"
60
- showGenerateLinkButton={showGenerateLinkButton}
61
- autoOpenShareRestriction={autoOpenShareRestriction}
62
- />
63
- <Button
64
- variant="primary"
65
- label={shareLabel}
66
- disabled={!onSend}
67
- onClick={onSend}
68
- />
69
- </>
70
- )
71
- }
72
-
73
- return null
74
- })()
75
-
76
- return (
77
- <FixedDialog
78
- open
79
- disableGutters
80
- onClose={onClose}
81
- title={title}
82
- classes={{ paper: 'u-ov-visible' }}
83
- componentsProps={{
84
- dialogContent: { className: 'u-ov-visible' }
85
- }}
86
- content={
87
- <div>
88
- <div className="u-ph-2">
89
- <AntivirusAlert document={document} />
90
- {showNameField && handleFolderNameChange && (
91
- <TextField
92
- required
93
- label={nameLabel}
94
- variant="outlined"
95
- size="small"
96
- className="u-w-100 u-mt-1-half"
97
- value={folderName ?? ''}
98
- onChange={handleFolderNameChange}
99
- />
100
- )}
101
- <Typography variant="h6" className="u-mt-1-half u-mb-half">
102
- {t('Share.contacts.addUsers')}
103
- </Typography>
104
- {showShareByEmail && (
105
- <DumbShareByEmail
106
- currentRecipients={currentRecipients}
107
- document={document}
108
- documentType="Files"
109
- pendingRecipients={pendingRecipients}
110
- onPendingRecipientsChange={onPendingRecipientsChange}
111
- selectedOption={selectedOption}
112
- onSelectedOptionChange={onSelectedOptionChange}
113
- />
114
- )}
115
- </div>
116
- <WhoHasAccess
117
- isOwner
118
- isSharedDrive
119
- recipients={recipients}
120
- document={document}
121
- documentType="Files"
122
- className="u-w-100"
123
- onRevoke={onRevoke}
124
- link={sharingLink}
125
- />
126
- </div>
127
- }
128
- actions={actionButtons}
129
- />
130
- )
131
- }
132
- )
133
-
134
- DumbBatchSharedFolderModal.propTypes = {
135
- title: PropTypes.string,
136
- document: PropTypes.object,
137
- folderName: PropTypes.string,
138
- handleFolderNameChange: PropTypes.func,
139
- recipients: PropTypes.array,
140
- currentRecipients: PropTypes.array,
141
- onRevoke: PropTypes.func.isRequired,
142
- onCreate: PropTypes.func,
143
- onSend: PropTypes.func,
144
- onClose: PropTypes.func.isRequired,
145
- onRename: PropTypes.func,
146
- showNameField: PropTypes.bool,
147
- sharingLink: PropTypes.string,
148
- nameLabel: PropTypes.string,
149
- addPeopleLabel: PropTypes.string,
150
- cancelLabel: PropTypes.string,
151
- createLabel: PropTypes.string,
152
- shareLabel: PropTypes.string,
153
- saveLabel: PropTypes.string,
154
- showShareByEmail: PropTypes.bool,
155
- autoOpenShareRestriction: PropTypes.bool,
156
- showGenerateLinkButton: PropTypes.bool,
157
- pendingRecipients: PropTypes.array,
158
- onPendingRecipientsChange: PropTypes.func,
159
- selectedOption: PropTypes.oneOf(['readWrite', 'readOnly']),
160
- onSelectedOptionChange: PropTypes.func
161
- }