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.
Files changed (35) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/assets/icons/shared-drive.svg +1 -0
  3. package/dist/components/FederatedFolder/FederatedFolderModal.js +3 -2
  4. package/dist/components/FederatedFolder/FederatedFolderModal.spec.js +3 -3
  5. package/dist/components/ShareDialogCozyToCozy.js +2 -2
  6. package/dist/components/SharedDrive/EditSharedDriveModal.js +209 -0
  7. package/dist/components/SharedDrive/SharedDriveForm.js +7 -4
  8. package/dist/components/SharedDrive/SharedDriveHeader.js +60 -0
  9. package/dist/components/SharedFolder/DumbBatchSharedFolderModal.js +5 -29
  10. package/dist/index.js +1 -0
  11. package/dist/stylesheet.css +0 -8
  12. package/locales/en.json +7 -5
  13. package/locales/fr.json +7 -5
  14. package/locales/ru.json +7 -5
  15. package/locales/vi.json +7 -5
  16. package/package.json +4 -5
  17. package/src/assets/icons/shared-drive.svg +1 -0
  18. package/src/components/FederatedFolder/FederatedFolderModal.jsx +3 -2
  19. package/src/components/FederatedFolder/FederatedFolderModal.spec.jsx +3 -3
  20. package/src/components/ShareDialogCozyToCozy.jsx +2 -2
  21. package/src/components/SharedDrive/EditSharedDriveModal.jsx +160 -0
  22. package/src/components/SharedDrive/SharedDriveForm.jsx +5 -3
  23. package/src/components/SharedDrive/SharedDriveHeader.jsx +19 -0
  24. package/src/components/SharedFolder/DumbBatchSharedFolderModal.jsx +3 -26
  25. package/src/index.jsx +1 -0
  26. package/dist/components/FederatedFolder/DumbFederatedFolderModal.js +0 -64
  27. package/dist/components/SharedStatus.js +0 -61
  28. package/dist/components/SharedStatus.spec.js +0 -44
  29. package/dist/components/__snapshots__/SharedStatus.spec.js.snap +0 -94
  30. package/dist/propTypes.js +0 -26
  31. package/src/components/FederatedFolder/DumbFederatedFolderModal.jsx +0 -71
  32. package/src/components/SharedStatus.jsx +0 -50
  33. package/src/components/SharedStatus.spec.js +0 -48
  34. package/src/components/__snapshots__/SharedStatus.spec.js.snap +0 -94
  35. package/src/propTypes.js +0 -29
package/dist/propTypes.js DELETED
@@ -1,26 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import { Contact, Group } from './models';
3
- export var contactsResponseType = PropTypes.shape({
4
- count: PropTypes.number,
5
- data: PropTypes.arrayOf(Contact.propType),
6
- definition: PropTypes.object,
7
- fetchMore: PropTypes.func,
8
- fetchStatus: PropTypes.string,
9
- hasMore: PropTypes.bool,
10
- id: PropTypes.string,
11
- lastError: PropTypes.string,
12
- lastFetch: PropTypes.number,
13
- lastUpdate: PropTypes.number
14
- });
15
- export var contactGroupsResponseType = PropTypes.shape({
16
- count: PropTypes.number,
17
- data: PropTypes.arrayOf(Group.propType),
18
- definition: PropTypes.object,
19
- fetchMore: PropTypes.func,
20
- fetchStatus: PropTypes.string,
21
- hasMore: PropTypes.bool,
22
- id: PropTypes.string,
23
- lastError: PropTypes.string,
24
- lastFetch: PropTypes.number,
25
- lastUpdate: PropTypes.number
26
- });
@@ -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
@@ -1,50 +0,0 @@
1
- import cx from 'classnames'
2
- import React from 'react'
3
-
4
- import { useI18n } from 'twake-i18n'
5
-
6
- import { SharingTooltip, TooltipRecipientList } from './Tooltip'
7
- import LinkIcon from '../assets/icons/icon-link.svg'
8
- import { getDisplayName } from '../models'
9
- import styles from '../styles/status.styl'
10
-
11
- export const SharedStatus = ({ className, docId, recipients, link }) => {
12
- const { t } = useI18n()
13
- return (
14
- <span className={cx(className, styles['shared-status'])}>
15
- {recipients.length > 1 && (
16
- <a
17
- data-tip
18
- data-for={`members${docId}`}
19
- className={styles['shared-status-label']}
20
- >
21
- {t('Share.members.count', { smart_count: recipients.length })}
22
- </a>
23
- )}
24
- {recipients.length > 1 && (
25
- <SharingTooltip id={`members${docId}`}>
26
- <TooltipRecipientList
27
- recipientNames={recipients.map(recipient =>
28
- getDisplayName(recipient)
29
- )}
30
- />
31
- </SharingTooltip>
32
- )}
33
- {link && (
34
- <>
35
- <LinkIcon
36
- style={{ fill: 'var(--iconTextColor)' }}
37
- data-tip
38
- data-for={`linkfor${docId}`}
39
- />
40
-
41
- <SharingTooltip id={`linkfor${docId}`}>
42
- <span>{t('Files.share.sharedByLink')}</span>
43
- </SharingTooltip>
44
- </>
45
- )}
46
- </span>
47
- )
48
- }
49
-
50
- export default SharedStatus
@@ -1,48 +0,0 @@
1
- import { render } from '@testing-library/react'
2
- import React from 'react'
3
-
4
- import { SharedStatus } from './SharedStatus'
5
- import AppLike from '../../test/AppLike'
6
-
7
- describe('SharedStatus component', () => {
8
- it('should just render a span if no sharing', () => {
9
- const { container } = render(
10
- <AppLike>
11
- <SharedStatus docId="1" recipients={[]} />
12
- </AppLike>
13
- )
14
- expect(container).toMatchSnapshot()
15
- })
16
-
17
- it('should have the right display if there is several recipients', () => {
18
- const { container, getByText } = render(
19
- <AppLike>
20
- <SharedStatus
21
- docId="1"
22
- recipients={[
23
- {
24
- _id: 1,
25
- name: '1'
26
- },
27
- {
28
- _id: 2,
29
- name: '2'
30
- }
31
- ]}
32
- />
33
- </AppLike>
34
- )
35
- expect(container).toMatchSnapshot()
36
- expect(getByText('2 members')).toBeTruthy()
37
- })
38
-
39
- it('should display the link if there is a link', () => {
40
- const { container, getByText } = render(
41
- <AppLike>
42
- <SharedStatus docId="1" recipients={[]} link={true} />
43
- </AppLike>
44
- )
45
- expect(container).toMatchSnapshot()
46
- expect(getByText('Shared by link')).toBeTruthy()
47
- })
48
- })
@@ -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
- `;
package/src/propTypes.js DELETED
@@ -1,29 +0,0 @@
1
- import PropTypes from 'prop-types'
2
-
3
- import { Contact, Group } from './models'
4
-
5
- export const contactsResponseType = PropTypes.shape({
6
- count: PropTypes.number,
7
- data: PropTypes.arrayOf(Contact.propType),
8
- definition: PropTypes.object,
9
- fetchMore: PropTypes.func,
10
- fetchStatus: PropTypes.string,
11
- hasMore: PropTypes.bool,
12
- id: PropTypes.string,
13
- lastError: PropTypes.string,
14
- lastFetch: PropTypes.number,
15
- lastUpdate: PropTypes.number
16
- })
17
-
18
- export const contactGroupsResponseType = PropTypes.shape({
19
- count: PropTypes.number,
20
- data: PropTypes.arrayOf(Group.propType),
21
- definition: PropTypes.object,
22
- fetchMore: PropTypes.func,
23
- fetchStatus: PropTypes.string,
24
- hasMore: PropTypes.bool,
25
- id: PropTypes.string,
26
- lastError: PropTypes.string,
27
- lastFetch: PropTypes.number,
28
- lastUpdate: PropTypes.number
29
- })