cozy-sharing 16.7.0 → 16.9.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 +22 -0
- package/dist/components/Recipient/LinkRecipientLite.js +61 -0
- package/dist/components/Recipient/MemberRecipientLite.js +56 -0
- package/dist/components/Recipient/MemberRecipientStatus.js +5 -3
- package/dist/components/SharingBanner/components/PublicBanner.js +8 -2
- package/dist/components/SharingBanner/components/PublicBanner.spec.js +2 -2
- package/dist/index.js +2 -0
- package/dist/styles/publicBanner.styl +0 -1
- package/dist/stylesheet.css +0 -1
- package/locales/en.json +1 -1
- package/locales/fr.json +1 -1
- package/package.json +2 -2
- package/src/components/Recipient/LinkRecipient.jsx +1 -1
- package/src/components/Recipient/LinkRecipientLite.jsx +49 -0
- package/src/components/Recipient/MemberRecipientLite.jsx +59 -0
- package/src/components/Recipient/MemberRecipientStatus.jsx +6 -2
- package/src/components/SharingBanner/components/PublicBanner.jsx +5 -3
- package/src/components/SharingBanner/components/PublicBanner.spec.jsx +2 -2
- package/src/index.jsx +2 -0
- package/src/styles/publicBanner.styl +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [16.9.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@16.8.0...cozy-sharing@16.9.0) (2024-12-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **Sharing:** Change style of PublicBanner wording ([ddc8ce3](https://github.com/cozy/cozy-libs/commit/ddc8ce3cfcb1e3cfbdf17f5a7b8d9c8da997b5b0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [16.8.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@16.7.0...cozy-sharing@16.8.0) (2024-12-02)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **Sharing:** Expose too new component to get recipients ([a5836f7](https://github.com/cozy/cozy-libs/commit/a5836f7ea3634de44689b4e6c34eeac9b5fcb731))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [16.7.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@16.6.1...cozy-sharing@16.7.0) (2024-11-26)
|
|
7
29
|
|
|
8
30
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Circle from 'cozy-ui/transpiled/react/Circle';
|
|
4
|
+
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
5
|
+
import LinkIcon from 'cozy-ui/transpiled/react/Icons/Link';
|
|
6
|
+
import ListItem from 'cozy-ui/transpiled/react/ListItem';
|
|
7
|
+
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
|
|
8
|
+
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
9
|
+
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
10
|
+
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
11
|
+
import { checkIsReadOnlyPermissions } from '../../helpers/permissions';
|
|
12
|
+
import withLocales from '../../hoc/withLocales';
|
|
13
|
+
var styles = {
|
|
14
|
+
"recipient": "recipient__recipient___2DmZI",
|
|
15
|
+
"recipients-list-light": "recipient__recipients-list-light___Vq4op",
|
|
16
|
+
"recipient-idents": "recipient__recipient-idents___3s7rw",
|
|
17
|
+
"recipient-status-icon": "recipient__recipient-status-icon___-liGw",
|
|
18
|
+
"recipient-user": "recipient__recipient-user___1THIU",
|
|
19
|
+
"recipient-details": "recipient__recipient-details___2fZfc",
|
|
20
|
+
"avatar": "recipient__avatar___2LnIV",
|
|
21
|
+
"link-recipient-icon-circle": "recipient__link-recipient-icon-circle___3ZTU-",
|
|
22
|
+
"recipients-avatars": "recipient__recipients-avatars___1npjD",
|
|
23
|
+
"--interactive": "recipient__--interactive___160Bp",
|
|
24
|
+
"recipients-avatars--link": "recipient__recipients-avatars--link___1qeON",
|
|
25
|
+
"recipients-avatars--plusX": "recipient__recipients-avatars--plusX___3-6_l",
|
|
26
|
+
"recipients-avatars--avatar": "recipient__recipients-avatars--avatar___-owjC",
|
|
27
|
+
"spin": "recipient__spin___2tYv3",
|
|
28
|
+
"shake": "recipient__shake___TGyPp"
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var LinkRecipientLite = function LinkRecipientLite(_ref) {
|
|
32
|
+
var permissions = _ref.permissions,
|
|
33
|
+
link = _ref.link;
|
|
34
|
+
|
|
35
|
+
var _useI18n = useI18n(),
|
|
36
|
+
t = _useI18n.t;
|
|
37
|
+
|
|
38
|
+
if (!link) return null;
|
|
39
|
+
var isReadOnlyPermissions = checkIsReadOnlyPermissions(permissions);
|
|
40
|
+
return /*#__PURE__*/React.createElement(ListItem, {
|
|
41
|
+
size: "small",
|
|
42
|
+
ellipsis: true
|
|
43
|
+
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(Circle, {
|
|
44
|
+
size: "small",
|
|
45
|
+
className: styles['link-recipient-icon-circle']
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
47
|
+
icon: LinkIcon
|
|
48
|
+
}))), /*#__PURE__*/React.createElement(ListItemText, {
|
|
49
|
+
primary: t('Share.recipients.anyoneWithTheLink'),
|
|
50
|
+
secondary: link
|
|
51
|
+
}), /*#__PURE__*/React.createElement(Typography, {
|
|
52
|
+
className: "u-flex-shrink-0",
|
|
53
|
+
variant: "body2"
|
|
54
|
+
}, t("Share.type.".concat(isReadOnlyPermissions ? 'one-way' : 'two-way')).toLowerCase()));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
LinkRecipientLite.propTypes = {
|
|
58
|
+
permissions: PropTypes.array,
|
|
59
|
+
link: PropTypes.string
|
|
60
|
+
};
|
|
61
|
+
export default withLocales(LinkRecipientLite);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["recipient", "isOwner"];
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { useClient } from 'cozy-client';
|
|
7
|
+
import ListItem from 'cozy-ui/transpiled/react/ListItem';
|
|
8
|
+
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
|
|
9
|
+
import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
|
|
10
|
+
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
11
|
+
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
12
|
+
import MemberRecipientStatus from './MemberRecipientStatus';
|
|
13
|
+
import { DEFAULT_DISPLAY_NAME } from '../../helpers/recipients';
|
|
14
|
+
import withLocales from '../../hoc/withLocales';
|
|
15
|
+
import { getDisplayName } from '../../models';
|
|
16
|
+
import { MemberAvatar } from '../Avatar/MemberAvatar';
|
|
17
|
+
|
|
18
|
+
var MemberRecipientLite = function MemberRecipientLite(_ref) {
|
|
19
|
+
var _recipient$type;
|
|
20
|
+
|
|
21
|
+
var recipient = _ref.recipient,
|
|
22
|
+
isOwner = _ref.isOwner,
|
|
23
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
+
|
|
25
|
+
var _useI18n = useI18n(),
|
|
26
|
+
t = _useI18n.t;
|
|
27
|
+
|
|
28
|
+
var client = useClient();
|
|
29
|
+
var isMe = isOwner && recipient.status === 'owner' || recipient.instance === client.options.uri;
|
|
30
|
+
return /*#__PURE__*/React.createElement(ListItem, {
|
|
31
|
+
size: "small",
|
|
32
|
+
ellipsis: true
|
|
33
|
+
}, /*#__PURE__*/React.createElement(ListItemIcon, null, /*#__PURE__*/React.createElement(MemberAvatar, _extends({
|
|
34
|
+
size: "small",
|
|
35
|
+
recipient: recipient
|
|
36
|
+
}, props))), /*#__PURE__*/React.createElement(ListItemText, {
|
|
37
|
+
primary: isMe ? t('Share.recipients.you') : getDisplayName(recipient, t(DEFAULT_DISPLAY_NAME)),
|
|
38
|
+
secondary: /*#__PURE__*/React.createElement(MemberRecipientStatus, {
|
|
39
|
+
status: recipient.status,
|
|
40
|
+
isMe: isMe,
|
|
41
|
+
instance: recipient.instance,
|
|
42
|
+
typographyProps: {
|
|
43
|
+
noWrap: true
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
}), /*#__PURE__*/React.createElement(Typography, {
|
|
47
|
+
className: "u-flex-shrink-0",
|
|
48
|
+
variant: "body2"
|
|
49
|
+
}, isMe ? t("Share.status.".concat(recipient.status)).toLowerCase() : t("Share.type.".concat((_recipient$type = recipient.type) !== null && _recipient$type !== void 0 ? _recipient$type : 'one-way')).toLowerCase()));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
MemberRecipientLite.propTypes = {
|
|
53
|
+
recipient: PropTypes.object,
|
|
54
|
+
isOwner: PropTypes.bool
|
|
55
|
+
};
|
|
56
|
+
export default withLocales(MemberRecipientLite);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
3
4
|
import EyeIcon from 'cozy-ui/transpiled/react/Icons/Eye';
|
|
@@ -27,7 +28,8 @@ var styles = {
|
|
|
27
28
|
var MemberRecipientStatus = function MemberRecipientStatus(_ref) {
|
|
28
29
|
var status = _ref.status,
|
|
29
30
|
isMe = _ref.isMe,
|
|
30
|
-
instance = _ref.instance
|
|
31
|
+
instance = _ref.instance,
|
|
32
|
+
typographyProps = _ref.typographyProps;
|
|
31
33
|
|
|
32
34
|
var _useI18n = useI18n(),
|
|
33
35
|
t = _useI18n.t;
|
|
@@ -53,10 +55,10 @@ var MemberRecipientStatus = function MemberRecipientStatus(_ref) {
|
|
|
53
55
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
54
56
|
icon: icon,
|
|
55
57
|
size: 10
|
|
56
|
-
})), /*#__PURE__*/React.createElement(Bd, null, /*#__PURE__*/React.createElement(Typography, {
|
|
58
|
+
})), /*#__PURE__*/React.createElement(Bd, null, /*#__PURE__*/React.createElement(Typography, _extends({
|
|
57
59
|
variant: "caption",
|
|
58
60
|
color: "textSecondary"
|
|
59
|
-
}, text)));
|
|
61
|
+
}, typographyProps), text)));
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
export default MemberRecipientStatus;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import snarkdown from 'snarkdown';
|
|
@@ -29,13 +30,18 @@ var PublicBannerCozyToCozyContent = function PublicBannerCozyToCozyContent(_ref)
|
|
|
29
30
|
image: avatarURL
|
|
30
31
|
}));
|
|
31
32
|
var beginning = withAvatar.split('<img src');
|
|
32
|
-
|
|
33
|
+
|
|
34
|
+
var _beginning$1$split$1$ = beginning[1].split('<strong>')[1].split('</strong>'),
|
|
35
|
+
_beginning$1$split$1$2 = _slicedToArray(_beginning$1$split$1$, 2),
|
|
36
|
+
userBoldName = _beginning$1$split$1$2[0],
|
|
37
|
+
ending = _beginning$1$split$1$2[1];
|
|
38
|
+
|
|
33
39
|
return /*#__PURE__*/React.createElement("span", {
|
|
34
40
|
className: styles['bannermarkdown']
|
|
35
41
|
}, beginning[0], /*#__PURE__*/React.createElement("img", {
|
|
36
42
|
src: avatarURL,
|
|
37
43
|
alt: "avatar"
|
|
38
|
-
}),
|
|
44
|
+
}), " ", /*#__PURE__*/React.createElement("strong", null, userBoldName), ending);
|
|
39
45
|
};
|
|
40
46
|
|
|
41
47
|
PublicBannerCozyToCozyContent.propTypes = {
|
|
@@ -18,7 +18,7 @@ describe('PublicBanner', function () {
|
|
|
18
18
|
useI18n.mockReturnValue({
|
|
19
19
|
t: function t(localeToTranslate, options) {
|
|
20
20
|
if (localeToTranslate === 'Share.banner.shared_from') {
|
|
21
|
-
return "Shared from  ").concat(options.name, "'s cozy.");
|
|
21
|
+
return "Shared from  <strong>").concat(options.name, "</strong>'s cozy.");
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
return localeToTranslate;
|
|
@@ -42,6 +42,6 @@ describe('PublicBanner', function () {
|
|
|
42
42
|
container = _render.container; // Then
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
expect(container.querySelector('.bannermarkdown').innerHTML).toEqual("Shared from <img src=\"http://cozy.localhost:8080/public/avatar?fallback=initials\" alt=\"avatar\">
|
|
45
|
+
expect(container.querySelector('.bannermarkdown').innerHTML).toEqual("Shared from <img src=\"http://cozy.localhost:8080/public/avatar?fallback=initials\" alt=\"avatar\"> <strong><a href=\"https://evil.com\">Click me!</a></strong>'s cozy.");
|
|
46
46
|
});
|
|
47
47
|
});
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,8 @@ export { SharedStatus } from './SharedStatus';
|
|
|
10
10
|
export { SharedBadge } from './SharedBadge';
|
|
11
11
|
export { SharingOwnerAvatar } from './SharingOwnerAvatar';
|
|
12
12
|
export { SharedRecipients } from './SharedRecipients';
|
|
13
|
+
export { default as MemberRecipientLite } from './components/Recipient/MemberRecipientLite';
|
|
14
|
+
export { default as LinkRecipientLite } from './components/Recipient/LinkRecipientLite';
|
|
13
15
|
export { SharedRecipientsList } from './SharedRecipientsList';
|
|
14
16
|
export { ShareButton } from './ShareButton';
|
|
15
17
|
export { ShareModal } from './components/ShareModal/ShareModal';
|
package/dist/stylesheet.css
CHANGED
package/locales/en.json
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"loadingError": "Loading error",
|
|
58
58
|
"banner": {
|
|
59
|
-
"shared_from": "The items below are displayed from 
|
|
59
|
+
"shared_from": "The items below are displayed from  **%{name}**'s Cozy. You can add a link to this share in your Cozy",
|
|
60
60
|
"whats_cozy": "Cozy is a secure digital home for all your data, hosted in France - ",
|
|
61
61
|
"know_more": "More information",
|
|
62
62
|
"sync_to_mine": "Synchronise in my Cozy",
|
package/locales/fr.json
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"loadingError": "Erreur de chargement",
|
|
58
58
|
"banner": {
|
|
59
|
-
"shared_from": "Les éléments ci-dessous sont affichés depuis le Cozy de 
|
|
59
|
+
"shared_from": "Les éléments ci-dessous sont affichés depuis le Cozy de  **%{name}**. Vous pouvez ajouter un lien vers ce partage dans votre Cozy.",
|
|
60
60
|
"whats_cozy": "Cozy est un domicile numérique sécurisé pour toutes vos données, hébergé en France - ",
|
|
61
61
|
"know_more": "En savoir plus",
|
|
62
62
|
"sync_to_mine": "Synchroniser dans mon Cozy",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.9.0",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"sideEffects": [
|
|
72
72
|
"*.css"
|
|
73
73
|
],
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "8b0b03c7978ff9bff74635d31a8e4ec259294200"
|
|
75
75
|
}
|
|
@@ -27,7 +27,7 @@ const LinkRecipient = props => {
|
|
|
27
27
|
<RecipientConfirm
|
|
28
28
|
recipientConfirmationData={recipientConfirmationData}
|
|
29
29
|
verifyRecipient={verifyRecipient}
|
|
30
|
-
|
|
30
|
+
/>
|
|
31
31
|
) : (
|
|
32
32
|
<LinkRecipientPermissions {...props} className="u-flex-shrink-0" />
|
|
33
33
|
)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import PropTypes from 'prop-types'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import Circle from 'cozy-ui/transpiled/react/Circle'
|
|
5
|
+
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
6
|
+
import LinkIcon from 'cozy-ui/transpiled/react/Icons/Link'
|
|
7
|
+
import ListItem from 'cozy-ui/transpiled/react/ListItem'
|
|
8
|
+
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
|
|
9
|
+
import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
|
|
10
|
+
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
11
|
+
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
12
|
+
|
|
13
|
+
import { checkIsReadOnlyPermissions } from '../../helpers/permissions'
|
|
14
|
+
import withLocales from '../../hoc/withLocales'
|
|
15
|
+
import styles from '../../styles/recipient.styl'
|
|
16
|
+
|
|
17
|
+
const LinkRecipientLite = ({ permissions, link }) => {
|
|
18
|
+
const { t } = useI18n()
|
|
19
|
+
|
|
20
|
+
if (!link) return null
|
|
21
|
+
|
|
22
|
+
const isReadOnlyPermissions = checkIsReadOnlyPermissions(permissions)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<ListItem size="small" ellipsis>
|
|
26
|
+
<ListItemIcon>
|
|
27
|
+
<Circle size="small" className={styles['link-recipient-icon-circle']}>
|
|
28
|
+
<Icon icon={LinkIcon} />
|
|
29
|
+
</Circle>
|
|
30
|
+
</ListItemIcon>
|
|
31
|
+
<ListItemText
|
|
32
|
+
primary={t('Share.recipients.anyoneWithTheLink')}
|
|
33
|
+
secondary={link}
|
|
34
|
+
/>
|
|
35
|
+
<Typography className="u-flex-shrink-0" variant="body2">
|
|
36
|
+
{t(
|
|
37
|
+
`Share.type.${isReadOnlyPermissions ? 'one-way' : 'two-way'}`
|
|
38
|
+
).toLowerCase()}
|
|
39
|
+
</Typography>
|
|
40
|
+
</ListItem>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
LinkRecipientLite.propTypes = {
|
|
45
|
+
permissions: PropTypes.array,
|
|
46
|
+
link: PropTypes.string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default withLocales(LinkRecipientLite)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import PropTypes from 'prop-types'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useClient } from 'cozy-client'
|
|
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 { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
10
|
+
|
|
11
|
+
import MemberRecipientStatus from './MemberRecipientStatus'
|
|
12
|
+
import { DEFAULT_DISPLAY_NAME } from '../../helpers/recipients'
|
|
13
|
+
import withLocales from '../../hoc/withLocales'
|
|
14
|
+
import { getDisplayName } from '../../models'
|
|
15
|
+
import { MemberAvatar } from '../Avatar/MemberAvatar'
|
|
16
|
+
|
|
17
|
+
const MemberRecipientLite = ({ recipient, isOwner, ...props }) => {
|
|
18
|
+
const { t } = useI18n()
|
|
19
|
+
const client = useClient()
|
|
20
|
+
|
|
21
|
+
const isMe =
|
|
22
|
+
(isOwner && recipient.status === 'owner') ||
|
|
23
|
+
recipient.instance === client.options.uri
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<ListItem size="small" ellipsis>
|
|
27
|
+
<ListItemIcon>
|
|
28
|
+
<MemberAvatar size="small" recipient={recipient} {...props} />
|
|
29
|
+
</ListItemIcon>
|
|
30
|
+
<ListItemText
|
|
31
|
+
primary={
|
|
32
|
+
isMe
|
|
33
|
+
? t('Share.recipients.you')
|
|
34
|
+
: getDisplayName(recipient, t(DEFAULT_DISPLAY_NAME))
|
|
35
|
+
}
|
|
36
|
+
secondary={
|
|
37
|
+
<MemberRecipientStatus
|
|
38
|
+
status={recipient.status}
|
|
39
|
+
isMe={isMe}
|
|
40
|
+
instance={recipient.instance}
|
|
41
|
+
typographyProps={{ noWrap: true }}
|
|
42
|
+
/>
|
|
43
|
+
}
|
|
44
|
+
/>
|
|
45
|
+
<Typography className="u-flex-shrink-0" variant="body2">
|
|
46
|
+
{isMe
|
|
47
|
+
? t(`Share.status.${recipient.status}`).toLowerCase()
|
|
48
|
+
: t(`Share.type.${recipient.type ?? 'one-way'}`).toLowerCase()}
|
|
49
|
+
</Typography>
|
|
50
|
+
</ListItem>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
MemberRecipientLite.propTypes = {
|
|
55
|
+
recipient: PropTypes.object,
|
|
56
|
+
isOwner: PropTypes.bool
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default withLocales(MemberRecipientLite)
|
|
@@ -10,7 +10,7 @@ import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
|
10
10
|
|
|
11
11
|
import styles from '../../styles/recipient.styl'
|
|
12
12
|
|
|
13
|
-
const MemberRecipientStatus = ({ status, isMe, instance }) => {
|
|
13
|
+
const MemberRecipientStatus = ({ status, isMe, instance, typographyProps }) => {
|
|
14
14
|
const { t } = useI18n()
|
|
15
15
|
|
|
16
16
|
const isSendingEmail = !isMe && status === 'mail-not-sent'
|
|
@@ -37,7 +37,11 @@ const MemberRecipientStatus = ({ status, isMe, instance }) => {
|
|
|
37
37
|
<Icon icon={icon} size={10} />
|
|
38
38
|
</Img>
|
|
39
39
|
<Bd>
|
|
40
|
-
<Typography
|
|
40
|
+
<Typography
|
|
41
|
+
variant="caption"
|
|
42
|
+
color="textSecondary"
|
|
43
|
+
{...typographyProps}
|
|
44
|
+
>
|
|
41
45
|
{text}
|
|
42
46
|
</Typography>
|
|
43
47
|
</Bd>
|
|
@@ -28,13 +28,15 @@ const PublicBannerCozyToCozyContent = ({ sharing }) => {
|
|
|
28
28
|
})
|
|
29
29
|
)
|
|
30
30
|
const beginning = withAvatar.split('<img src')
|
|
31
|
-
const
|
|
31
|
+
const [userBoldName, ending] = beginning[1]
|
|
32
|
+
.split('<strong>')[1]
|
|
33
|
+
.split('</strong>')
|
|
32
34
|
|
|
33
35
|
return (
|
|
34
36
|
<span className={styles['bannermarkdown']}>
|
|
35
37
|
{beginning[0]}
|
|
36
|
-
<img src={avatarURL} alt="avatar" />
|
|
37
|
-
{
|
|
38
|
+
<img src={avatarURL} alt="avatar" /> <strong>{userBoldName}</strong>
|
|
39
|
+
{ending}
|
|
38
40
|
</span>
|
|
39
41
|
)
|
|
40
42
|
}
|
|
@@ -21,7 +21,7 @@ describe('PublicBanner', () => {
|
|
|
21
21
|
useI18n.mockReturnValue({
|
|
22
22
|
t: (localeToTranslate, options) => {
|
|
23
23
|
if (localeToTranslate === 'Share.banner.shared_from') {
|
|
24
|
-
return `Shared from 
|
|
24
|
+
return `Shared from  <strong>${options.name}</strong>'s cozy.`
|
|
25
25
|
}
|
|
26
26
|
return localeToTranslate
|
|
27
27
|
}
|
|
@@ -41,7 +41,7 @@ describe('PublicBanner', () => {
|
|
|
41
41
|
|
|
42
42
|
// Then
|
|
43
43
|
expect(container.querySelector('.bannermarkdown').innerHTML).toEqual(
|
|
44
|
-
`Shared from <img src="http://cozy.localhost:8080/public/avatar?fallback=initials" alt="avatar">
|
|
44
|
+
`Shared from <img src="http://cozy.localhost:8080/public/avatar?fallback=initials" alt="avatar"> <strong><a href="https://evil.com">Click me!</a></strong>'s cozy.`
|
|
45
45
|
)
|
|
46
46
|
})
|
|
47
47
|
})
|
package/src/index.jsx
CHANGED
|
@@ -14,6 +14,8 @@ export { SharedStatus } from './SharedStatus'
|
|
|
14
14
|
export { SharedBadge } from './SharedBadge'
|
|
15
15
|
export { SharingOwnerAvatar } from './SharingOwnerAvatar'
|
|
16
16
|
export { SharedRecipients } from './SharedRecipients'
|
|
17
|
+
export { default as MemberRecipientLite } from './components/Recipient/MemberRecipientLite'
|
|
18
|
+
export { default as LinkRecipientLite } from './components/Recipient/LinkRecipientLite'
|
|
17
19
|
export { SharedRecipientsList } from './SharedRecipientsList'
|
|
18
20
|
export { ShareButton } from './ShareButton'
|
|
19
21
|
export { ShareModal } from './components/ShareModal/ShareModal'
|