cozy-sharing 10.4.0 → 11.0.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/.storybook/fixtures/recipients.js +30 -0
- package/.storybook/main.js +18 -0
- package/.storybook/manager.js +6 -0
- package/.storybook/preview-head.html +21 -0
- package/.storybook/preview.jsx +64 -0
- package/.storybook/public/Lato-Bold.immutable.woff2 +0 -0
- package/.storybook/public/Lato-Regular.immutable.woff2 +0 -0
- package/CHANGELOG.md +38 -0
- package/dist/SharedRecipients.js +2 -2
- package/dist/SharedStatus.js +2 -2
- package/dist/SharingOwnerAvatar.js +2 -2
- package/dist/components/{Recipient/RecipientsAvatars.js → Avatar/AvatarList.js} +11 -11
- package/dist/components/{Recipient/RecipientsAvatars.spec.js → Avatar/AvatarList.spec.js} +10 -10
- package/dist/components/Avatar/AvatarList.stories.js +14 -0
- package/dist/components/{Recipient/AvatarPlusX.js → Avatar/ExtraAvatar.js} +4 -4
- package/dist/components/Avatar/ExtraAvatar.stories.js +10 -0
- package/dist/components/{Recipient/RecipientAvatar.js → Avatar/MemberAvatar.js} +2 -2
- package/dist/components/Avatar/MemberAvatar.stories.js +15 -0
- package/dist/components/ConfirmTrustedRecipientsDialog.js +2 -2
- package/dist/components/{Recipient/RecipientPlusX.js → Identity/ExtraIdentity.js} +5 -5
- package/dist/components/Identity/ExtraIdentity.stories.js +13 -0
- package/dist/components/Identity/Identity.stories.js +13 -0
- package/dist/components/{Recipient/RecipientWithoutStatus.js → Identity/MemberIdentity.js} +2 -2
- package/dist/components/Identity/MemberIdentity.stories.js +10 -0
- package/dist/components/Identity/OwnerIdentity.stories.js +10 -0
- package/dist/components/Recipient/LinkRecipient.stories.js +16 -0
- package/dist/components/Recipient/LinkRecipientPermissions.stories.js +10 -0
- package/dist/components/Recipient/{Recipient.js → MemberRecipient.js} +9 -9
- package/dist/components/Recipient/{Recipient.spec.js → MemberRecipient.spec.js} +3 -3
- package/dist/components/Recipient/MemberRecipient.stories.js +39 -0
- package/dist/components/Recipient/{RecipientPermissions.js → MemberRecipientPermissions.js} +2 -2
- package/dist/components/Recipient/MemberRecipientPermissions.stories.js +10 -0
- package/dist/components/Recipient/{RecipientStatus.js → MemberRecipientStatus.js} +2 -2
- package/dist/components/Recipient/MemberRecipientStatus.stories.js +10 -0
- package/dist/components/Recipient/OwnerRecipient.js +2 -2
- package/dist/components/Recipient/OwnerRecipient.stories.js +13 -0
- package/dist/components/Recipient/OwnerRecipientDefault.js +2 -2
- package/dist/components/Recipient/OwnerRecipientDefault.stories.js +10 -0
- package/dist/components/Recipient/RecipientConfirm.js +2 -2
- package/dist/components/Recipient/RecipientConfirm.stories.js +10 -0
- package/dist/components/Recipient/RecipientList.js +2 -2
- package/dist/components/Recipient/RecipientList.stories.js +26 -0
- package/dist/components/ShareModal/SharingDetailsModal.js +1 -1
- package/dist/components/WhoHasAccessLight.js +4 -4
- package/dist/helpers/files.js +10 -0
- package/dist/hooks/useFetchDocumentPath.js +18 -8
- package/dist/stylesheet.css +10 -10
- package/package.json +16 -5
- package/src/SharedRecipients.jsx +2 -2
- package/src/SharedStatus.jsx +2 -2
- package/src/SharingOwnerAvatar.jsx +2 -2
- package/src/components/{Recipient/RecipientsAvatars.jsx → Avatar/AvatarList.jsx} +12 -11
- package/src/components/{Recipient/RecipientsAvatars.spec.jsx → Avatar/AvatarList.spec.jsx} +12 -11
- package/src/components/Avatar/AvatarList.stories.jsx +16 -0
- package/src/components/{Recipient/AvatarPlusX.jsx → Avatar/ExtraAvatar.jsx} +4 -4
- package/src/components/Avatar/ExtraAvatar.stories.jsx +13 -0
- package/src/components/{Recipient/RecipientAvatar.jsx → Avatar/MemberAvatar.jsx} +2 -2
- package/src/components/Avatar/MemberAvatar.stories.jsx +18 -0
- package/src/components/ConfirmTrustedRecipientsDialog.jsx +2 -2
- package/src/components/{Recipient/RecipientPlusX.jsx → Identity/ExtraIdentity.jsx} +5 -5
- package/src/components/Identity/ExtraIdentity.stories.jsx +16 -0
- package/src/components/Identity/Identity.stories.jsx +16 -0
- package/src/components/{Recipient/RecipientWithoutStatus.jsx → Identity/MemberIdentity.jsx} +2 -2
- package/src/components/Identity/MemberIdentity.stories.jsx +13 -0
- package/src/components/Identity/OwnerIdentity.stories.jsx +13 -0
- package/src/components/Recipient/LinkRecipient.stories.jsx +17 -0
- package/src/components/Recipient/LinkRecipientPermissions.stories.jsx +13 -0
- package/src/components/Recipient/{Recipient.jsx → MemberRecipient.jsx} +14 -10
- package/src/components/Recipient/{Recipient.spec.jsx → MemberRecipient.spec.jsx} +3 -3
- package/src/components/Recipient/MemberRecipient.stories.jsx +44 -0
- package/src/components/Recipient/{RecipientPermissions.jsx → MemberRecipientPermissions.jsx} +2 -2
- package/src/components/Recipient/MemberRecipientPermissions.stories.jsx +13 -0
- package/src/components/Recipient/{RecipientStatus.jsx → MemberRecipientStatus.jsx} +2 -2
- package/src/components/Recipient/MemberRecipientStatus.stories.jsx +13 -0
- package/src/components/Recipient/OwnerRecipient.jsx +2 -2
- package/src/components/Recipient/OwnerRecipient.stories.jsx +16 -0
- package/src/components/Recipient/OwnerRecipientDefault.jsx +2 -2
- package/src/components/Recipient/OwnerRecipientDefault.stories.jsx +13 -0
- package/src/components/Recipient/RecipientConfirm.jsx +7 -9
- package/src/components/Recipient/RecipientConfirm.stories.jsx +13 -0
- package/src/components/Recipient/RecipientList.jsx +2 -2
- package/src/components/Recipient/RecipientList.stories.jsx +28 -0
- package/src/components/ShareModal/SharingDetailsModal.jsx +1 -1
- package/src/components/WhoHasAccessLight.jsx +4 -4
- package/src/helpers/files.js +9 -0
- package/src/hooks/useFetchDocumentPath.jsx +4 -0
- /package/dist/components/{Recipient → Identity}/Identity.js +0 -0
- /package/dist/components/{Recipient → Identity}/OwnerIdentity.js +0 -0
- /package/src/components/{Recipient → Identity}/Identity.jsx +0 -0
- /package/src/components/{Recipient → Identity}/OwnerIdentity.jsx +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RecipientList } from './RecipientList'
|
|
2
|
+
import { recipients } from '../../../.storybook/fixtures/recipients'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
component: RecipientList,
|
|
6
|
+
args: {
|
|
7
|
+
recipients,
|
|
8
|
+
recipientsToBeConfirmed: [],
|
|
9
|
+
isOwner: false,
|
|
10
|
+
onRevoke: () => {},
|
|
11
|
+
onRevokeSelf: () => {},
|
|
12
|
+
verifyRecipient: () => true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default meta
|
|
17
|
+
|
|
18
|
+
export const Default = {
|
|
19
|
+
name: 'Default',
|
|
20
|
+
args: {}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const Owner = {
|
|
24
|
+
name: 'Owner',
|
|
25
|
+
args: {
|
|
26
|
+
isOwner: true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -7,7 +7,7 @@ import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
|
7
7
|
|
|
8
8
|
import { getDisplayName } from '../../models'
|
|
9
9
|
import styles from '../../styles/share.styl'
|
|
10
|
-
import OwnerIdentity from '../
|
|
10
|
+
import OwnerIdentity from '../Identity/OwnerIdentity'
|
|
11
11
|
import WhoHasAccess from '../WhoHasAccess'
|
|
12
12
|
|
|
13
13
|
export const SharingDetailsModal = ({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import cx from 'classnames'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { ExtraIdentity } from './Identity/ExtraIdentity'
|
|
5
|
+
import { MemberIdentity } from './Identity/MemberIdentity'
|
|
6
6
|
import styles from '../styles/recipient.styl'
|
|
7
7
|
|
|
8
8
|
const MAX_DISPLAYED_RECIPIENTS = 2
|
|
@@ -10,10 +10,10 @@ const MAX_DISPLAYED_RECIPIENTS = 2
|
|
|
10
10
|
const WhoHasAccessLight = ({ recipients, className }) => (
|
|
11
11
|
<div className={cx(styles['recipients-list-light'], className)}>
|
|
12
12
|
{recipients.slice(0, MAX_DISPLAYED_RECIPIENTS).map((recipient, index) => (
|
|
13
|
-
<
|
|
13
|
+
<MemberIdentity {...recipient} key={`key_recipient__${index}`} />
|
|
14
14
|
))}
|
|
15
15
|
{recipients.length > MAX_DISPLAYED_RECIPIENTS && (
|
|
16
|
-
<
|
|
16
|
+
<ExtraIdentity
|
|
17
17
|
extraRecipients={recipients.slice(MAX_DISPLAYED_RECIPIENTS)}
|
|
18
18
|
/>
|
|
19
19
|
)}
|
package/src/helpers/files.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetches the file paths for the given files.
|
|
3
|
+
* Should not be used for directories.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} client - The cozy-client instance.
|
|
6
|
+
* @param {string} doctype - The type of document.
|
|
7
|
+
* @param {Array} files - The array of files.
|
|
8
|
+
* @returns {Promise<Array>} - The array of file paths.
|
|
9
|
+
*/
|
|
1
10
|
export const fetchFilesPaths = async (client, doctype, files) => {
|
|
2
11
|
const parentDirIds = files
|
|
3
12
|
.map(f => f.dir_id)
|
|
@@ -9,6 +9,10 @@ export const useFetchDocumentPath = (client, document) => {
|
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
;(async () => {
|
|
11
11
|
try {
|
|
12
|
+
const isDirectory = document.type === 'directory'
|
|
13
|
+
|
|
14
|
+
if (isDirectory) return setDocumentPath(document.path)
|
|
15
|
+
|
|
12
16
|
const path = await fetchFilesPaths(client, document._type, [document])
|
|
13
17
|
setDocumentPath(path[0])
|
|
14
18
|
// eslint-disable-next-line
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|