box-ui-elements 23.1.0 → 23.2.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/dist/explorer.css +1 -1
- package/dist/explorer.js +1 -1
- package/dist/openwith.js +1 -1
- package/dist/picker.js +1 -1
- package/dist/preview.css +1 -1
- package/dist/preview.js +1 -1
- package/dist/sharing.css +1 -1
- package/dist/sharing.js +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/uploader.js +1 -1
- package/es/elements/common/content-answers/ContentAnswersOpenButton.scss +1 -1
- package/es/features/collaborator-avatars/CollaboratorList.js +5 -1
- package/es/features/collaborator-avatars/CollaboratorList.js.flow +12 -1
- package/es/features/collaborator-avatars/CollaboratorList.js.map +1 -1
- package/es/features/collaborator-avatars/CollaboratorList.scss +3 -0
- package/es/features/collaborator-avatars/CollaboratorListItem.js +26 -5
- package/es/features/collaborator-avatars/CollaboratorListItem.js.flow +33 -9
- package/es/features/collaborator-avatars/CollaboratorListItem.js.map +1 -1
- package/es/features/collaborator-avatars/CollaboratorListItem.scss +23 -0
- package/es/features/message-center/components/MessageCenter.js +1 -0
- package/es/features/message-center/components/MessageCenter.js.flow +2 -1
- package/es/features/message-center/components/MessageCenter.js.map +1 -1
- package/es/features/unified-share-modal/RemoveCollaboratorConfirmModal.js +44 -0
- package/es/features/unified-share-modal/RemoveCollaboratorConfirmModal.js.flow +67 -0
- package/es/features/unified-share-modal/RemoveCollaboratorConfirmModal.js.map +1 -0
- package/es/features/unified-share-modal/UnifiedShareForm.js +8 -3
- package/es/features/unified-share-modal/UnifiedShareForm.js.flow +5 -1
- package/es/features/unified-share-modal/UnifiedShareForm.js.map +1 -1
- package/es/features/unified-share-modal/UnifiedShareModal.js +54 -10
- package/es/features/unified-share-modal/UnifiedShareModal.js.flow +59 -11
- package/es/features/unified-share-modal/UnifiedShareModal.js.map +1 -1
- package/es/features/unified-share-modal/UnifiedShareModal.scss +9 -2
- package/es/features/unified-share-modal/flowTypes.js.flow +13 -0
- package/es/features/unified-share-modal/flowTypes.js.map +1 -1
- package/es/features/unified-share-modal/messages.js +8 -0
- package/es/features/unified-share-modal/messages.js.flow +10 -0
- package/es/features/unified-share-modal/messages.js.map +1 -1
- package/es/features/unified-share-modal/stories/UnifiedShareModal.stories.js +221 -4
- package/es/features/unified-share-modal/stories/UnifiedShareModal.stories.js.flow +208 -3
- package/es/features/unified-share-modal/stories/UnifiedShareModal.stories.js.map +1 -1
- package/es/src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.d.ts +4 -4
- package/i18n/bn-IN.js +2 -0
- package/i18n/bn-IN.properties +4 -0
- package/i18n/da-DK.js +2 -0
- package/i18n/da-DK.properties +4 -0
- package/i18n/de-DE.js +2 -0
- package/i18n/de-DE.properties +4 -0
- package/i18n/en-AU.js +2 -0
- package/i18n/en-AU.properties +4 -0
- package/i18n/en-CA.js +2 -0
- package/i18n/en-CA.properties +4 -0
- package/i18n/en-GB.js +2 -0
- package/i18n/en-GB.properties +4 -0
- package/i18n/en-US.js +2 -0
- package/i18n/en-US.properties +4 -0
- package/i18n/en-x-pseudo.js +1010 -1008
- package/i18n/en-x-pseudo.properties +1012 -1008
- package/i18n/es-419.js +2 -0
- package/i18n/es-419.properties +4 -0
- package/i18n/es-ES.js +2 -0
- package/i18n/es-ES.properties +4 -0
- package/i18n/fi-FI.js +2 -0
- package/i18n/fi-FI.properties +4 -0
- package/i18n/fr-CA.js +2 -0
- package/i18n/fr-CA.properties +4 -0
- package/i18n/fr-FR.js +2 -0
- package/i18n/fr-FR.properties +4 -0
- package/i18n/hi-IN.js +2 -0
- package/i18n/hi-IN.properties +4 -0
- package/i18n/it-IT.js +2 -0
- package/i18n/it-IT.properties +4 -0
- package/i18n/ja-JP.js +2 -0
- package/i18n/ja-JP.properties +4 -0
- package/i18n/ko-KR.js +2 -0
- package/i18n/ko-KR.properties +4 -0
- package/i18n/nb-NO.js +2 -0
- package/i18n/nb-NO.properties +4 -0
- package/i18n/nl-NL.js +2 -0
- package/i18n/nl-NL.properties +4 -0
- package/i18n/pl-PL.js +2 -0
- package/i18n/pl-PL.properties +4 -0
- package/i18n/pt-BR.js +2 -0
- package/i18n/pt-BR.properties +4 -0
- package/i18n/ru-RU.js +2 -0
- package/i18n/ru-RU.properties +4 -0
- package/i18n/sv-SE.js +2 -0
- package/i18n/sv-SE.properties +4 -0
- package/i18n/tr-TR.js +2 -0
- package/i18n/tr-TR.properties +4 -0
- package/i18n/zh-CN.js +2 -0
- package/i18n/zh-CN.properties +4 -0
- package/i18n/zh-TW.js +2 -0
- package/i18n/zh-TW.properties +4 -0
- package/package.json +18 -18
- package/src/elements/common/content-answers/ContentAnswersOpenButton.scss +1 -1
- package/src/features/collaborator-avatars/CollaboratorList.js +12 -1
- package/src/features/collaborator-avatars/CollaboratorList.scss +3 -0
- package/src/features/collaborator-avatars/CollaboratorListItem.js +33 -9
- package/src/features/collaborator-avatars/CollaboratorListItem.scss +23 -0
- package/src/features/collaborator-avatars/__tests__/CollaboratorList.test.js +11 -0
- package/src/features/collaborator-avatars/__tests__/CollaboratorListItem.test.js +51 -0
- package/src/features/collaborator-avatars/__tests__/__snapshots__/CollaboratorList.test.js.snap +110 -0
- package/src/features/collaborator-avatars/__tests__/__snapshots__/CollaboratorListItem.test.js.snap +310 -0
- package/src/features/message-center/__tests__/MessageCenter.integration.test.js +10 -0
- package/src/features/message-center/components/MessageCenter.js +2 -1
- package/src/features/unified-share-modal/README.md +12 -1
- package/src/features/unified-share-modal/RemoveCollaboratorConfirmModal.js +67 -0
- package/src/features/unified-share-modal/UnifiedShareForm.js +5 -1
- package/src/features/unified-share-modal/UnifiedShareModal.js +59 -11
- package/src/features/unified-share-modal/UnifiedShareModal.scss +9 -2
- package/src/features/unified-share-modal/__tests__/RemoveCollaboratorConfirmModal.test.js +64 -0
- package/src/features/unified-share-modal/__tests__/UnifiedShareForm.test.js +34 -1
- package/src/features/unified-share-modal/__tests__/UnifiedShareModal.test.js +74 -4
- package/src/features/unified-share-modal/__tests__/__snapshots__/UnifiedShareModal.test.js.snap +258 -0
- package/src/features/unified-share-modal/flowTypes.js +13 -0
- package/src/features/unified-share-modal/messages.js +10 -0
- package/src/features/unified-share-modal/stories/UnifiedShareModal.stories.js +208 -3
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
@mixin BackgroundGradientHover {
|
|
7
7
|
background: linear-gradient(0deg, #2223, #2223), linear-gradient(135deg, #fe01da 0%, var(--light-blue-100) 100%);
|
|
8
|
-
border: var(--border-1 solid #2222224d
|
|
8
|
+
border: var(--border-1) solid #2222224d;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.be-ContentAnswersOpenButton {
|
|
@@ -31,9 +31,11 @@ class CollaboratorList extends React.Component {
|
|
|
31
31
|
}
|
|
32
32
|
render() {
|
|
33
33
|
const {
|
|
34
|
+
canRemoveCollaborators,
|
|
34
35
|
collaborators,
|
|
35
36
|
onDoneClick,
|
|
36
37
|
maxCollaboratorListSize,
|
|
38
|
+
onRemoveCollaboratorClick,
|
|
37
39
|
trackingProps
|
|
38
40
|
} = this.props;
|
|
39
41
|
const {
|
|
@@ -65,7 +67,9 @@ class CollaboratorList extends React.Component {
|
|
|
65
67
|
trackingProps: {
|
|
66
68
|
usernameProps,
|
|
67
69
|
emailProps
|
|
68
|
-
}
|
|
70
|
+
},
|
|
71
|
+
canRemoveCollaborators: canRemoveCollaborators,
|
|
72
|
+
onRemoveCollaborator: onRemoveCollaboratorClick
|
|
69
73
|
});
|
|
70
74
|
}), collaborators.length > maxListSizeToRender && /*#__PURE__*/React.createElement("li", {
|
|
71
75
|
className: "collaborator-list-item more"
|
|
@@ -21,11 +21,13 @@ import './CollaboratorList.scss';
|
|
|
21
21
|
const MAX_COLLABORATOR_LIST_SIZE = 90;
|
|
22
22
|
|
|
23
23
|
type Props = {
|
|
24
|
+
canRemoveCollaborators?: boolean,
|
|
24
25
|
collaborators: Array<collaboratorType>,
|
|
25
26
|
doneButtonProps?: Object,
|
|
26
27
|
item: ItemType,
|
|
27
28
|
maxCollaboratorListSize: number,
|
|
28
29
|
onDoneClick: Function,
|
|
30
|
+
onRemoveCollaboratorClick?: (collaborator: collaboratorType) => void,
|
|
29
31
|
trackingProps: collaboratorListTrackingType,
|
|
30
32
|
};
|
|
31
33
|
|
|
@@ -47,7 +49,14 @@ class CollaboratorList extends React.Component<Props> {
|
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
render() {
|
|
50
|
-
const {
|
|
52
|
+
const {
|
|
53
|
+
canRemoveCollaborators,
|
|
54
|
+
collaborators,
|
|
55
|
+
onDoneClick,
|
|
56
|
+
maxCollaboratorListSize,
|
|
57
|
+
onRemoveCollaboratorClick,
|
|
58
|
+
trackingProps,
|
|
59
|
+
} = this.props;
|
|
51
60
|
const { usernameProps, emailProps, manageLinkProps, viewAdditionalProps, doneButtonProps } = trackingProps;
|
|
52
61
|
const manageAllBtn = (
|
|
53
62
|
<span className="manage-all-btn">
|
|
@@ -73,6 +82,8 @@ class CollaboratorList extends React.Component<Props> {
|
|
|
73
82
|
usernameProps,
|
|
74
83
|
emailProps,
|
|
75
84
|
}}
|
|
85
|
+
canRemoveCollaborators={canRemoveCollaborators}
|
|
86
|
+
onRemoveCollaborator={onRemoveCollaboratorClick}
|
|
76
87
|
/>
|
|
77
88
|
);
|
|
78
89
|
})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollaboratorList.js","names":["React","FormattedMessage","ModalActions","Button","Link","CollaborationBadge","commonMessages","CollaboratorListItem","messages","MAX_COLLABORATOR_LIST_SIZE","CollaboratorList","Component","createCollaboratorPageLink","children","trackingProp","item","props","type","id","collaboratorsPageLink","createElement","_extends","href","rel","target","render","collaborators","onDoneClick","maxCollaboratorListSize","trackingProps","usernameProps","emailProps","manageLinkProps","viewAdditionalProps","doneButtonProps","manageAllBtn","className","manageAllLinkText","maxListSizeToRender","Math","min","slice","map","collaborator","index","collabID","key","length","height","width","viewAdditionalPeopleText","onClick","done","_defineProperty"],"sources":["../../../src/features/collaborator-avatars/CollaboratorList.js"],"sourcesContent":["// @flow\nimport * as React from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nimport { ModalActions } from '../../components/modal';\nimport Button from '../../components/button';\nimport { Link } from '../../components/link';\nimport CollaborationBadge from '../../icons/badges/CollaborationBadge';\nimport type {\n collaboratorListTrackingType,\n item as ItemType,\n collaboratorType,\n} from '../unified-share-modal/flowTypes';\n\nimport commonMessages from '../../common/messages';\n\nimport CollaboratorListItem from './CollaboratorListItem';\nimport messages from './messages';\nimport './CollaboratorList.scss';\n\nconst MAX_COLLABORATOR_LIST_SIZE = 90;\n\ntype Props = {\n collaborators: Array<collaboratorType>,\n doneButtonProps?: Object,\n item: ItemType,\n maxCollaboratorListSize: number,\n onDoneClick: Function,\n trackingProps: collaboratorListTrackingType,\n};\n\nclass CollaboratorList extends React.Component<Props> {\n static defaultProps = {\n maxCollaboratorListSize: MAX_COLLABORATOR_LIST_SIZE,\n };\n\n createCollaboratorPageLink(children: React.Node, trackingProp: ?Object) {\n const { item } = this.props;\n const { type, id } = item;\n const collaboratorsPageLink = `/${type}/${id}/collaborators/`;\n\n return (\n <Link href={collaboratorsPageLink} rel=\"noopener\" target=\"_blank\" {...trackingProp}>\n {children}\n </Link>\n );\n }\n\n render() {\n const {
|
|
1
|
+
{"version":3,"file":"CollaboratorList.js","names":["React","FormattedMessage","ModalActions","Button","Link","CollaborationBadge","commonMessages","CollaboratorListItem","messages","MAX_COLLABORATOR_LIST_SIZE","CollaboratorList","Component","createCollaboratorPageLink","children","trackingProp","item","props","type","id","collaboratorsPageLink","createElement","_extends","href","rel","target","render","canRemoveCollaborators","collaborators","onDoneClick","maxCollaboratorListSize","onRemoveCollaboratorClick","trackingProps","usernameProps","emailProps","manageLinkProps","viewAdditionalProps","doneButtonProps","manageAllBtn","className","manageAllLinkText","maxListSizeToRender","Math","min","slice","map","collaborator","index","collabID","key","onRemoveCollaborator","length","height","width","viewAdditionalPeopleText","onClick","done","_defineProperty"],"sources":["../../../src/features/collaborator-avatars/CollaboratorList.js"],"sourcesContent":["// @flow\nimport * as React from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nimport { ModalActions } from '../../components/modal';\nimport Button from '../../components/button';\nimport { Link } from '../../components/link';\nimport CollaborationBadge from '../../icons/badges/CollaborationBadge';\nimport type {\n collaboratorListTrackingType,\n item as ItemType,\n collaboratorType,\n} from '../unified-share-modal/flowTypes';\n\nimport commonMessages from '../../common/messages';\n\nimport CollaboratorListItem from './CollaboratorListItem';\nimport messages from './messages';\nimport './CollaboratorList.scss';\n\nconst MAX_COLLABORATOR_LIST_SIZE = 90;\n\ntype Props = {\n canRemoveCollaborators?: boolean,\n collaborators: Array<collaboratorType>,\n doneButtonProps?: Object,\n item: ItemType,\n maxCollaboratorListSize: number,\n onDoneClick: Function,\n onRemoveCollaboratorClick?: (collaborator: collaboratorType) => void,\n trackingProps: collaboratorListTrackingType,\n};\n\nclass CollaboratorList extends React.Component<Props> {\n static defaultProps = {\n maxCollaboratorListSize: MAX_COLLABORATOR_LIST_SIZE,\n };\n\n createCollaboratorPageLink(children: React.Node, trackingProp: ?Object) {\n const { item } = this.props;\n const { type, id } = item;\n const collaboratorsPageLink = `/${type}/${id}/collaborators/`;\n\n return (\n <Link href={collaboratorsPageLink} rel=\"noopener\" target=\"_blank\" {...trackingProp}>\n {children}\n </Link>\n );\n }\n\n render() {\n const {\n canRemoveCollaborators,\n collaborators,\n onDoneClick,\n maxCollaboratorListSize,\n onRemoveCollaboratorClick,\n trackingProps,\n } = this.props;\n const { usernameProps, emailProps, manageLinkProps, viewAdditionalProps, doneButtonProps } = trackingProps;\n const manageAllBtn = (\n <span className=\"manage-all-btn\">\n <FormattedMessage {...messages.manageAllLinkText} />\n </span>\n );\n const maxListSizeToRender = Math.min(maxCollaboratorListSize, MAX_COLLABORATOR_LIST_SIZE);\n\n return (\n <div className=\"usm-collaborator-list\">\n <div className=\"manage-all-btn-container\">\n {this.createCollaboratorPageLink(manageAllBtn, manageLinkProps)}\n </div>\n <ul className=\"be collaborator-list\">\n {collaborators.slice(0, maxListSizeToRender).map((collaborator, index) => {\n const { collabID, type } = collaborator;\n return (\n <CollaboratorListItem\n key={`${collabID}-${type}`}\n collaborator={collaborator}\n index={index}\n trackingProps={{\n usernameProps,\n emailProps,\n }}\n canRemoveCollaborators={canRemoveCollaborators}\n onRemoveCollaborator={onRemoveCollaboratorClick}\n />\n );\n })}\n {collaborators.length > maxListSizeToRender && (\n <li className=\"collaborator-list-item more\">\n <div>\n <CollaborationBadge height={32} width={32} />\n </div>\n <div>\n {this.createCollaboratorPageLink(\n <FormattedMessage {...messages.viewAdditionalPeopleText} />,\n viewAdditionalProps,\n )}\n </div>\n </li>\n )}\n </ul>\n <ModalActions>\n <Button className=\"btn-done\" onClick={onDoneClick} type=\"button\" {...doneButtonProps}>\n <FormattedMessage {...commonMessages.done} />\n </Button>\n </ModalActions>\n </div>\n );\n }\n}\n\nexport default CollaboratorList;\n"],"mappings":";;;;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,SAASC,YAAY,QAAQ,wBAAwB;AACrD,OAAOC,MAAM,MAAM,yBAAyB;AAC5C,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,OAAOC,kBAAkB,MAAM,uCAAuC;AAOtE,OAAOC,cAAc,MAAM,uBAAuB;AAElD,OAAOC,oBAAoB,MAAM,wBAAwB;AACzD,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAO,yBAAyB;AAEhC,MAAMC,0BAA0B,GAAG,EAAE;AAarC,MAAMC,gBAAgB,SAASV,KAAK,CAACW,SAAS,CAAQ;EAKlDC,0BAA0BA,CAACC,QAAoB,EAAEC,YAAqB,EAAE;IACpE,MAAM;MAAEC;IAAK,CAAC,GAAG,IAAI,CAACC,KAAK;IAC3B,MAAM;MAAEC,IAAI;MAAEC;IAAG,CAAC,GAAGH,IA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AAGD,QAAQ,IAAI9B,IAAI,EAAG;QAC3B4B,YAAY,EAAEA,YAAa;QAC3BC,KAAK,EAAEA,KAAM;QACbf,aAAa,EAAE;UACXC,aAAa;UACbC;QACJ,CAAE;QACFP,sBAAsB,EAAEA,sBAAuB;QAC/CuB,oBAAoB,EAAEnB;MAA0B,CACnD,CAAC;IAEV,CAAC,CAAC,EACDH,aAAa,CAACuB,MAAM,GAAGV,mBAAmB,iBACvCxC,KAAA,CAAAoB,aAAA;MAAIkB,SAAS,EAAC;IAA6B,gBACvCtC,KAAA,CAAAoB,aAAA,2BACIpB,KAAA,CAAAoB,aAAA,CAACf,kBAAkB;MAAC8C,MAAM,EAAE,EAAG;MAACC,KAAK,EAAE;IAAG,CAAE,CAC3C,CAAC,eACNpD,KAAA,CAAAoB,aAAA,cACK,IAAI,CAACR,0BAA0B,eAC5BZ,KAAA,CAAAoB,aAAA,CAACnB,gBAAgB,EAAKO,QAAQ,CAAC6C,wBAA2B,CAAC,EAC3DlB,mBACJ,CACC,CACL,CAER,CAAC,eACLnC,KAAA,CAAAoB,aAAA,CAAClB,YAAY,qBACTF,KAAA,CAAAoB,aAAA,CAACjB,MAAM,EAAAkB,QAAA;MAACiB,SAAS,EAAC,UAAU;MAACgB,OAAO,EAAE1B,WAAY;MAACX,IAAI,EAAC;IAAQ,GAAKmB,eAAe,gBAChFpC,KAAA,CAAAoB,aAAA,CAACnB,gBAAgB,EAAKK,cAAc,CAACiD,IAAO,CACxC,CACE,CACb,CAAC;EAEd;AACJ;AAACC,eAAA,CA9EK9C,gBAAgB,kBACI;EAClBmB,uBAAuB,EAAEpB;AAC7B,CAAC;AA6EL,eAAeC,gBAAgB","ignoreList":[]}
|
|
@@ -3,14 +3,20 @@ import * as React from 'react';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
import { Link } from '../../components/link';
|
|
6
|
+
import PlainButton from '../../components/plain-button';
|
|
7
|
+
import Tooltip from '../../components/tooltip';
|
|
8
|
+
import IconClose from '../../icon/fill/X16';
|
|
6
9
|
import { COLLAB_GROUP_TYPE, COLLAB_PENDING_TYPE } from './constants';
|
|
7
10
|
import messages from './messages';
|
|
11
|
+
import commonMessages from '../../elements/common/messages';
|
|
8
12
|
import CollaboratorAvatarItem from './CollaboratorAvatarItem';
|
|
9
13
|
import './CollaboratorListItem.scss';
|
|
10
14
|
const CollaboratorListItem = props => {
|
|
11
15
|
const {
|
|
12
16
|
index,
|
|
13
|
-
trackingProps
|
|
17
|
+
trackingProps,
|
|
18
|
+
canRemoveCollaborators = false,
|
|
19
|
+
onRemoveCollaborator
|
|
14
20
|
} = props;
|
|
15
21
|
const {
|
|
16
22
|
usernameProps,
|
|
@@ -26,7 +32,8 @@ const CollaboratorListItem = props => {
|
|
|
26
32
|
isExternalCollab,
|
|
27
33
|
profileURL,
|
|
28
34
|
translatedRole,
|
|
29
|
-
userID
|
|
35
|
+
userID,
|
|
36
|
+
isRemovable = false
|
|
30
37
|
} = props.collaborator;
|
|
31
38
|
const userOrGroupNameContent = type !== COLLAB_GROUP_TYPE ? /*#__PURE__*/React.createElement("div", {
|
|
32
39
|
className: classnames('name', type)
|
|
@@ -42,6 +49,9 @@ const CollaboratorListItem = props => {
|
|
|
42
49
|
}, /*#__PURE__*/React.createElement(Link, _extends({
|
|
43
50
|
href: `mailto:${email}`
|
|
44
51
|
}, emailProps), email)) : null;
|
|
52
|
+
const roleNodeContent = /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: "role"
|
|
54
|
+
}, type === COLLAB_PENDING_TYPE ? /*#__PURE__*/React.createElement(FormattedMessage, messages.pendingCollabText) : translatedRole);
|
|
45
55
|
return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("div", {
|
|
46
56
|
className: "collaborator-list-item"
|
|
47
57
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -57,9 +67,20 @@ const CollaboratorListItem = props => {
|
|
|
57
67
|
id: index,
|
|
58
68
|
isExternalCollab: isExternalCollab,
|
|
59
69
|
name: name
|
|
60
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
61
|
-
className: "
|
|
62
|
-
},
|
|
70
|
+
})), canRemoveCollaborators ? /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: "user-actions"
|
|
72
|
+
}, roleNodeContent, isRemovable && /*#__PURE__*/React.createElement(Tooltip, {
|
|
73
|
+
isTabbable: false,
|
|
74
|
+
text: /*#__PURE__*/React.createElement(FormattedMessage, commonMessages.remove)
|
|
75
|
+
}, /*#__PURE__*/React.createElement(PlainButton, {
|
|
76
|
+
className: "remove-button",
|
|
77
|
+
onClick: () => onRemoveCollaborator?.(props.collaborator),
|
|
78
|
+
type: "button"
|
|
79
|
+
}, /*#__PURE__*/React.createElement(IconClose, {
|
|
80
|
+
color: "##6f6f6f",
|
|
81
|
+
height: 16,
|
|
82
|
+
width: 16
|
|
83
|
+
})))) : roleNodeContent));
|
|
63
84
|
};
|
|
64
85
|
export default CollaboratorListItem;
|
|
65
86
|
//# sourceMappingURL=CollaboratorListItem.js.map
|
|
@@ -4,20 +4,26 @@ import classnames from 'classnames';
|
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
|
|
6
6
|
import { Link } from '../../components/link';
|
|
7
|
-
|
|
7
|
+
import PlainButton from '../../components/plain-button';
|
|
8
|
+
import Tooltip from '../../components/tooltip';
|
|
9
|
+
import IconClose from '../../icon/fill/X16';
|
|
8
10
|
import { COLLAB_GROUP_TYPE, COLLAB_PENDING_TYPE } from './constants';
|
|
9
11
|
import messages from './messages';
|
|
12
|
+
import commonMessages from '../../elements/common/messages';
|
|
10
13
|
import CollaboratorAvatarItem from './CollaboratorAvatarItem';
|
|
14
|
+
import type { collaboratorType } from '../unified-share-modal/flowTypes';
|
|
11
15
|
import './CollaboratorListItem.scss';
|
|
12
16
|
|
|
13
17
|
type Props = {
|
|
18
|
+
canRemoveCollaborators?: boolean,
|
|
14
19
|
collaborator: Object,
|
|
15
20
|
index: number,
|
|
21
|
+
onRemoveCollaborator?: (collaborator: collaboratorType) => void,
|
|
16
22
|
trackingProps: { emailProps: ?Object, usernameProps: ?Object },
|
|
17
23
|
};
|
|
18
24
|
|
|
19
25
|
const CollaboratorListItem = (props: Props) => {
|
|
20
|
-
const { index, trackingProps } = props;
|
|
26
|
+
const { index, trackingProps, canRemoveCollaborators = false, onRemoveCollaborator } = props;
|
|
21
27
|
const { usernameProps, emailProps } = trackingProps;
|
|
22
28
|
const {
|
|
23
29
|
email,
|
|
@@ -30,6 +36,7 @@ const CollaboratorListItem = (props: Props) => {
|
|
|
30
36
|
profileURL,
|
|
31
37
|
translatedRole,
|
|
32
38
|
userID,
|
|
39
|
+
isRemovable = false,
|
|
33
40
|
} = props.collaborator;
|
|
34
41
|
|
|
35
42
|
const userOrGroupNameContent =
|
|
@@ -52,6 +59,12 @@ const CollaboratorListItem = (props: Props) => {
|
|
|
52
59
|
</div>
|
|
53
60
|
) : null;
|
|
54
61
|
|
|
62
|
+
const roleNodeContent = (
|
|
63
|
+
<div className="role">
|
|
64
|
+
{type === COLLAB_PENDING_TYPE ? <FormattedMessage {...messages.pendingCollabText} /> : translatedRole}
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
|
|
55
68
|
return (
|
|
56
69
|
<li>
|
|
57
70
|
<div className="collaborator-list-item">
|
|
@@ -71,13 +84,24 @@ const CollaboratorListItem = (props: Props) => {
|
|
|
71
84
|
name={name}
|
|
72
85
|
/>
|
|
73
86
|
</div>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
87
|
+
{canRemoveCollaborators ? (
|
|
88
|
+
<div className="user-actions">
|
|
89
|
+
{roleNodeContent}
|
|
90
|
+
{isRemovable && (
|
|
91
|
+
<Tooltip isTabbable={false} text={<FormattedMessage {...commonMessages.remove} />}>
|
|
92
|
+
<PlainButton
|
|
93
|
+
className="remove-button"
|
|
94
|
+
onClick={() => onRemoveCollaborator?.(props.collaborator)}
|
|
95
|
+
type="button"
|
|
96
|
+
>
|
|
97
|
+
<IconClose color="##6f6f6f" height={16} width={16} />
|
|
98
|
+
</PlainButton>
|
|
99
|
+
</Tooltip>
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
) : (
|
|
103
|
+
roleNodeContent
|
|
104
|
+
)}
|
|
81
105
|
</div>
|
|
82
106
|
</li>
|
|
83
107
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollaboratorListItem.js","names":["React","classnames","FormattedMessage","Link","COLLAB_GROUP_TYPE","COLLAB_PENDING_TYPE","messages","CollaboratorAvatarItem","CollaboratorListItem","props","index","trackingProps","usernameProps","emailProps","email","expiration","hasCustomAvatar","name","type","imageURL","isExternalCollab","profileURL","translatedRole","userID","collaborator","userOrGroupNameContent","createElement","className","_extends","href","rel","target","emailContent","allowBadging","avatarUrl","id","
|
|
1
|
+
{"version":3,"file":"CollaboratorListItem.js","names":["React","classnames","FormattedMessage","Link","PlainButton","Tooltip","IconClose","COLLAB_GROUP_TYPE","COLLAB_PENDING_TYPE","messages","commonMessages","CollaboratorAvatarItem","CollaboratorListItem","props","index","trackingProps","canRemoveCollaborators","onRemoveCollaborator","usernameProps","emailProps","email","expiration","hasCustomAvatar","name","type","imageURL","isExternalCollab","profileURL","translatedRole","userID","isRemovable","collaborator","userOrGroupNameContent","createElement","className","_extends","href","rel","target","emailContent","roleNodeContent","pendingCollabText","allowBadging","avatarUrl","id","isTabbable","text","remove","onClick","color","height","width"],"sources":["../../../src/features/collaborator-avatars/CollaboratorListItem.js"],"sourcesContent":["// @flow\nimport * as React from 'react';\nimport classnames from 'classnames';\nimport { FormattedMessage } from 'react-intl';\n\nimport { Link } from '../../components/link';\nimport PlainButton from '../../components/plain-button';\nimport Tooltip from '../../components/tooltip';\nimport IconClose from '../../icon/fill/X16';\nimport { COLLAB_GROUP_TYPE, COLLAB_PENDING_TYPE } from './constants';\nimport messages from './messages';\nimport commonMessages from '../../elements/common/messages';\nimport CollaboratorAvatarItem from './CollaboratorAvatarItem';\nimport type { collaboratorType } from '../unified-share-modal/flowTypes';\nimport './CollaboratorListItem.scss';\n\ntype Props = {\n canRemoveCollaborators?: boolean,\n collaborator: Object,\n index: number,\n onRemoveCollaborator?: (collaborator: collaboratorType) => void,\n trackingProps: { emailProps: ?Object, usernameProps: ?Object },\n};\n\nconst CollaboratorListItem = (props: Props) => {\n const { index, trackingProps, canRemoveCollaborators = false, onRemoveCollaborator } = props;\n const { usernameProps, emailProps } = trackingProps;\n const {\n email,\n expiration,\n hasCustomAvatar,\n name,\n type,\n imageURL,\n isExternalCollab,\n profileURL,\n translatedRole,\n userID,\n isRemovable = false,\n } = props.collaborator;\n\n const userOrGroupNameContent =\n type !== COLLAB_GROUP_TYPE ? (\n <div className={classnames('name', type)}>\n <Link href={profileURL || `/profile/${userID}`} rel=\"noopener\" target=\"_blank\" {...usernameProps}>\n {name}\n </Link>\n </div>\n ) : (\n <div className={classnames('name', type)}>{name}</div>\n );\n\n const emailContent =\n type !== COLLAB_GROUP_TYPE && email ? (\n <div className=\"email\">\n <Link href={`mailto:${email}`} {...emailProps}>\n {email}\n </Link>\n </div>\n ) : null;\n\n const roleNodeContent = (\n <div className=\"role\">\n {type === COLLAB_PENDING_TYPE ? <FormattedMessage {...messages.pendingCollabText} /> : translatedRole}\n </div>\n );\n\n return (\n <li>\n <div className=\"collaborator-list-item\">\n <div className=\"bdl-CollaboratorListItem-user user\">\n <div className=\"info\">\n {userOrGroupNameContent}\n {emailContent}\n </div>\n <CollaboratorAvatarItem\n allowBadging\n avatarUrl={imageURL}\n email={email}\n expiration={expiration}\n hasCustomAvatar={hasCustomAvatar}\n id={index}\n isExternalCollab={isExternalCollab}\n name={name}\n />\n </div>\n {canRemoveCollaborators ? (\n <div className=\"user-actions\">\n {roleNodeContent}\n {isRemovable && (\n <Tooltip isTabbable={false} text={<FormattedMessage {...commonMessages.remove} />}>\n <PlainButton\n className=\"remove-button\"\n onClick={() => onRemoveCollaborator?.(props.collaborator)}\n type=\"button\"\n >\n <IconClose color=\"##6f6f6f\" height={16} width={16} />\n </PlainButton>\n </Tooltip>\n )}\n </div>\n ) : (\n roleNodeContent\n )}\n </div>\n </li>\n );\n};\n\nexport default CollaboratorListItem;\n"],"mappings":";AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,OAAOC,WAAW,MAAM,+BAA+B;AACvD,OAAOC,OAAO,MAAM,0BAA0B;AAC9C,OAAOC,SAAS,MAAM,qBAAqB;AAC3C,SAASC,iBAAiB,EAAEC,mBAAmB,QAAQ,aAAa;AACpE,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAOC,cAAc,MAAM,gCAAgC;AAC3D,OAAOC,sBAAsB,MAAM,0BAA0B;AAE7D,OAAO,6BAA6B;AAUpC,MAAMC,oBAAoB,GAAIC,KAAY,IAAK;EAC3C,MAAM;IAAEC,KAAK;IAAEC,aAAa;IAAEC,sBAAsB,GAAG,KAAK;IAAEC;EAAqB,CAAC,GAAGJ,KAAK;EAC5F,MAAM;IAAEK,aAAa;IAAEC;EAAW,CAAC,GAAGJ,aAAa;EACnD,MAAM;IACFK,KAAK;IACLC,UAAU;IACVC,eAAe;IACfC,IAAI;IACJC,IAAI;IACJC,QAAQ;IACRC,gBAAgB;IAChBC,UAAU;IACVC,cAAc;IACdC,MAAM;IACNC,WAAW,GAAG;EAClB,CAAC,GAAGjB,KAAK,CAACkB,YAAY;EAEtB,MAAMC,sBAAsB,GACxBR,IAAI,KAAKjB,iBAAiB,gBACtBP,KAAA,CAAAiC,aAAA;IAAKC,SAAS,EAAEjC,UAAU,CAAC,MAAM,EAAEuB,IAAI;EAAE,gBACrCxB,KAAA,CAAAiC,aAAA,CAAC9B,IAAI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LP,sBAAsB,gBACnBhB,KAAA,CAAAiC,aAAA;IAAKC,SAAS,EAAC;EAAc,GACxBM,eAAe,EACfV,WAAW,iBACR9B,KAAA,CAAAiC,aAAA,CAAC5B,OAAO;IAACwC,UAAU,EAAE,KAAM;IAACC,IAAI,eAAE9C,KAAA,CAAAiC,aAAA,CAAC/B,gBAAgB,EAAKQ,cAAc,CAACqC,MAAS;EAAE,gBAC9E/C,KAAA,CAAAiC,aAAA,CAAC7B,WAAW;IACR8B,SAAS,EAAC,eAAe;IACzBc,OAAO,EAAEA,CAAA,KAAM/B,oBAAoB,GAAGJ,KAAK,CAACkB,YAAY,CAAE;IAC1DP,IAAI,EAAC;EAAQ,gBAEbxB,KAAA,CAAAiC,aAAA,CAAC3B,SAAS;IAAC2C,KAAK,EAAC,UAAU;IAACC,MAAM,EAAE,EAAG;IAACC,KAAK,EAAE;EAAG,CAAE,CAC3C,CACR,CAEZ,CAAC,GAENX,eAEH,CACL,CAAC;AAEb,CAAC;AAED,eAAe5B,oBAAoB","ignoreList":[]}
|
|
@@ -54,10 +54,33 @@
|
|
|
54
54
|
text-overflow: ellipsis;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
.user-actions {
|
|
58
|
+
display: flex;
|
|
59
|
+
gap: 8px;
|
|
60
|
+
align-items: center;
|
|
61
|
+
margin-left: auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
57
64
|
.role {
|
|
58
65
|
color: $bdl-gray-65;
|
|
59
66
|
line-height: 32px;
|
|
60
67
|
}
|
|
68
|
+
|
|
69
|
+
.remove-button {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
width: $bdl-btn-height;
|
|
74
|
+
height: $bdl-btn-height;
|
|
75
|
+
background: none;
|
|
76
|
+
border: 0;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
|
|
79
|
+
&:hover {
|
|
80
|
+
background: $bdl-gray-05;
|
|
81
|
+
border-radius: $bdl-border-radius-size;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
61
84
|
}
|
|
62
85
|
|
|
63
86
|
.collaborator-list-item.more {
|
|
@@ -71,6 +71,7 @@ function MessageCenter({
|
|
|
71
71
|
setIsOpen(false);
|
|
72
72
|
}
|
|
73
73
|
const icon = /*#__PURE__*/React.createElement(ButtonComponent, {
|
|
74
|
+
badgeCount: unreadMessageCount,
|
|
74
75
|
"data-resin-target": "messageCenterOpenModal",
|
|
75
76
|
"data-testid": "message-center-unread-count",
|
|
76
77
|
onClick: handleOnClick,
|
|
@@ -16,7 +16,7 @@ import Internationalize from '../../../elements/common/Internationalize';
|
|
|
16
16
|
|
|
17
17
|
type Props = {|
|
|
18
18
|
apiHost: string,
|
|
19
|
-
buttonComponent: React.ComponentType<{ render: () => React.Node }>,
|
|
19
|
+
buttonComponent: React.ComponentType<{ render: () => React.Node, badgeCount: null | number }>,
|
|
20
20
|
contentPreviewProps?: ContentPreviewProps,
|
|
21
21
|
getEligibleMessages: () => Promise<GetEligibleMessageCenterMessages>,
|
|
22
22
|
getToken: (fileId: string) => Promise<Token>,
|
|
@@ -102,6 +102,7 @@ function MessageCenter({
|
|
|
102
102
|
|
|
103
103
|
const icon = (
|
|
104
104
|
<ButtonComponent
|
|
105
|
+
badgeCount={unreadMessageCount}
|
|
105
106
|
data-resin-target="messageCenterOpenModal"
|
|
106
107
|
data-testid="message-center-unread-count"
|
|
107
108
|
onClick={handleOnClick}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageCenter.js","names":["React","noop","Megaphone20","CountBadge","Badgeable","MessageCenterModal","Internationalize","MessageCenter","contentPreviewProps","getUnreadMessageCount","buttonComponent","ButtonComponent","getEligibleMessages","getToken","apiHost","postMarkAllMessagesAsSeen","overscanRowCount","language","messages","onMessageShown","isOpen","setIsOpen","useState","unreadMessageCount","setUnreadMessageCount","eligibleMessages","setEligibleMessages","isFetchingMessagesRef","useRef","useEffect","fetchUnreadMessageCount","count","err","fetchEligibleMessages","current","eligibleMessagesResponse","isOpenAndNoMessages","shouldPrefetch","handleOnClick","prevIsOpen","onRequestClose","icon","createElement","onClick","render","className","topRight","isVisible","shouldAnimate","value","Fragment"],"sources":["../../../../src/features/message-center/components/MessageCenter.js"],"sourcesContent":["// @flow\nimport * as React from 'react';\nimport noop from 'lodash/noop';\nimport Megaphone20 from '../../../icon/fill/Megaphone20';\nimport CountBadge from '../../../components/count-badge/CountBadge';\nimport Badgeable from '../../../components/badgeable/Badgeable';\nimport type { Token, StringMap } from '../../../common/types/core';\nimport MessageCenterModal from './message-center-modal/MessageCenterModal';\nimport type {\n GetEligibleMessageCenterMessages,\n UnreadEligibleMessageCenterMessageCount,\n EligibleMessageCenterMessage,\n} from '../types';\nimport type { ContentPreviewProps } from '../../message-preview-content/MessagePreviewContent';\nimport Internationalize from '../../../elements/common/Internationalize';\n\ntype Props = {|\n apiHost: string,\n buttonComponent: React.ComponentType<{ render: () => React.Node }>,\n contentPreviewProps?: ContentPreviewProps,\n getEligibleMessages: () => Promise<GetEligibleMessageCenterMessages>,\n getToken: (fileId: string) => Promise<Token>,\n getUnreadMessageCount: () => Promise<UnreadEligibleMessageCenterMessageCount>,\n language?: string,\n messages?: StringMap,\n onMessageShown?: EligibleMessageCenterMessage => void,\n overscanRowCount?: number,\n postMarkAllMessagesAsSeen: (messageArray: Array<EligibleMessageCenterMessage> | Error) => Promise<null>,\n|};\n\nfunction MessageCenter({\n contentPreviewProps,\n getUnreadMessageCount,\n buttonComponent: ButtonComponent,\n getEligibleMessages,\n getToken,\n apiHost,\n postMarkAllMessagesAsSeen,\n overscanRowCount,\n language,\n messages,\n onMessageShown = noop,\n}: Props) {\n const [isOpen, setIsOpen] = React.useState(false);\n const [unreadMessageCount, setUnreadMessageCount] = React.useState(null);\n // TODO: create hook for fetching, loading\n const [eligibleMessages, setEligibleMessages] = React.useState<GetEligibleMessageCenterMessages | null | Error>(\n null,\n );\n const isFetchingMessagesRef = React.useRef(false);\n\n React.useEffect(() => {\n async function fetchUnreadMessageCount() {\n try {\n const { count } = await getUnreadMessageCount();\n setUnreadMessageCount(count);\n } catch (err) {\n // TODO: add error handling\n }\n }\n\n fetchUnreadMessageCount();\n }, [getUnreadMessageCount]);\n\n React.useEffect(() => {\n async function fetchEligibleMessages() {\n if (!isFetchingMessagesRef.current) {\n isFetchingMessagesRef.current = true;\n try {\n const eligibleMessagesResponse = await getEligibleMessages();\n setEligibleMessages(eligibleMessagesResponse);\n } catch (err) {\n setEligibleMessages(err);\n }\n isFetchingMessagesRef.current = false;\n }\n }\n\n const isOpenAndNoMessages = isOpen && !eligibleMessages;\n // if there are unread messages, prefetch the data as the user is more likely to click on the message center\n const shouldPrefetch = !isOpen && !eligibleMessages && !!unreadMessageCount;\n if (isOpenAndNoMessages || shouldPrefetch) {\n fetchEligibleMessages();\n }\n }, [eligibleMessages, getEligibleMessages, isOpen, unreadMessageCount]);\n\n function handleOnClick() {\n setIsOpen(prevIsOpen => !prevIsOpen);\n if (unreadMessageCount && unreadMessageCount > 0 && eligibleMessages) {\n try {\n postMarkAllMessagesAsSeen(eligibleMessages);\n } catch (err) {\n // swallow\n }\n setUnreadMessageCount(0);\n }\n }\n\n function onRequestClose() {\n setIsOpen(false);\n }\n\n const icon = (\n <ButtonComponent\n data-resin-target=\"messageCenterOpenModal\"\n data-testid=\"message-center-unread-count\"\n onClick={handleOnClick}\n render={() => (\n <Badgeable\n className=\"icon-bell-badge\"\n topRight={\n <CountBadge isVisible={!!unreadMessageCount} shouldAnimate value={unreadMessageCount || 0} />\n }\n >\n <Megaphone20 className=\"bdl-MessageCenter-icon\" />\n </Badgeable>\n )}\n />\n );\n\n return (\n <Internationalize messages={messages} language={language}>\n <span className=\"bdl-MessageCenter\" data-resin-component=\"messageCenter\">\n {isOpen ? (\n <>\n {icon}\n <MessageCenterModal\n apiHost={apiHost}\n contentPreviewProps={contentPreviewProps}\n getToken={getToken}\n messages={eligibleMessages}\n onRequestClose={onRequestClose}\n overscanRowCount={overscanRowCount}\n onMessageShown={onMessageShown}\n />\n </>\n ) : (\n <>{icon}</>\n )}\n </span>\n </Internationalize>\n );\n}\n\nexport default MessageCenter;\n"],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,IAAI,MAAM,aAAa;AAC9B,OAAOC,WAAW,MAAM,gCAAgC;AACxD,OAAOC,UAAU,MAAM,4CAA4C;AACnE,OAAOC,SAAS,MAAM,yCAAyC;AAE/D,OAAOC,kBAAkB,MAAM,2CAA2C;AAO1E,OAAOC,gBAAgB,MAAM,2CAA2C;AAgBxE,SAASC,aAAaA,CAAC;EACnBC,mBAAmB;EACnBC,qBAAqB;EACrBC,eAAe,EAAEC,eAAe;EAChCC,mBAAmB;EACnBC,QAAQ;EACRC,OAAO;EACPC,yBAAyB;EACzBC,gBAAgB;EAChBC,QAAQ;EACRC,QAAQ;EACRC,cAAc,GAAGlB;AACd,CAAC,EAAE;EACN,MAAM,CAACmB,MAAM,EAAEC,SAAS,CAAC,GAAGrB,KAAK,CAACsB,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM,CAACC,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGxB,KAAK,CAACsB,QAAQ,CAAC,IAAI,CAAC;EACxE;EACA,MAAM,CAACG,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG1B,KAAK,CAACsB,QAAQ,CAC1D,IACJ,CAAC;EACD,MAAMK,qBAAqB,GAAG3B,KAAK,CAAC4B,MAAM,CAAC,KAAK,CAAC;EAEjD5B,KAAK,CAAC6B,SAAS,CAAC,MAAM;IAClB,eAAeC,uBAAuBA,CAAA,EAAG;MACrC,IAAI;QACA,MAAM;UAAEC;QAAM,CAAC,GAAG,MAAMtB,qBAAqB,CAAC,CAAC;QAC/Ce,qBAAqB,CAACO,KAAK,CAAC;MAChC,CAAC,CAAC,OAAOC,GAAG,EAAE;QACV;MAAA;IAER;IAEAF,uBAAuB,CAAC,CAAC;EAC7B,CAAC,EAAE,CAACr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","MessageCenterModal","Internationalize","MessageCenter","contentPreviewProps","getUnreadMessageCount","buttonComponent","ButtonComponent","getEligibleMessages","getToken","apiHost","postMarkAllMessagesAsSeen","overscanRowCount","language","messages","onMessageShown","isOpen","setIsOpen","useState","unreadMessageCount","setUnreadMessageCount","eligibleMessages","setEligibleMessages","isFetchingMessagesRef","useRef","useEffect","fetchUnreadMessageCount","count","err","fetchEligibleMessages","current","eligibleMessagesResponse","isOpenAndNoMessages","shouldPrefetch","handleOnClick","prevIsOpen","onRequestClose","icon","createElement","badgeCount","onClick","render","className","topRight","isVisible","shouldAnimate","value","Fragment"],"sources":["../../../../src/features/message-center/components/MessageCenter.js"],"sourcesContent":["// @flow\nimport * as React from 'react';\nimport noop from 'lodash/noop';\nimport Megaphone20 from '../../../icon/fill/Megaphone20';\nimport CountBadge from '../../../components/count-badge/CountBadge';\nimport Badgeable from '../../../components/badgeable/Badgeable';\nimport type { Token, StringMap } from '../../../common/types/core';\nimport MessageCenterModal from './message-center-modal/MessageCenterModal';\nimport type {\n GetEligibleMessageCenterMessages,\n UnreadEligibleMessageCenterMessageCount,\n EligibleMessageCenterMessage,\n} from '../types';\nimport type { ContentPreviewProps } from '../../message-preview-content/MessagePreviewContent';\nimport Internationalize from '../../../elements/common/Internationalize';\n\ntype Props = {|\n apiHost: string,\n buttonComponent: React.ComponentType<{ render: () => React.Node, badgeCount: null | number }>,\n contentPreviewProps?: ContentPreviewProps,\n getEligibleMessages: () => Promise<GetEligibleMessageCenterMessages>,\n getToken: (fileId: string) => Promise<Token>,\n getUnreadMessageCount: () => Promise<UnreadEligibleMessageCenterMessageCount>,\n language?: string,\n messages?: StringMap,\n onMessageShown?: EligibleMessageCenterMessage => void,\n overscanRowCount?: number,\n postMarkAllMessagesAsSeen: (messageArray: Array<EligibleMessageCenterMessage> | Error) => Promise<null>,\n|};\n\nfunction MessageCenter({\n contentPreviewProps,\n getUnreadMessageCount,\n buttonComponent: ButtonComponent,\n getEligibleMessages,\n getToken,\n apiHost,\n postMarkAllMessagesAsSeen,\n overscanRowCount,\n language,\n messages,\n onMessageShown = noop,\n}: Props) {\n const [isOpen, setIsOpen] = React.useState(false);\n const [unreadMessageCount, setUnreadMessageCount] = React.useState(null);\n // TODO: create hook for fetching, loading\n const [eligibleMessages, setEligibleMessages] = React.useState<GetEligibleMessageCenterMessages | null | Error>(\n null,\n );\n const isFetchingMessagesRef = React.useRef(false);\n\n React.useEffect(() => {\n async function fetchUnreadMessageCount() {\n try {\n const { count } = await getUnreadMessageCount();\n setUnreadMessageCount(count);\n } catch (err) {\n // TODO: add error handling\n }\n }\n\n fetchUnreadMessageCount();\n }, [getUnreadMessageCount]);\n\n React.useEffect(() => {\n async function fetchEligibleMessages() {\n if (!isFetchingMessagesRef.current) {\n isFetchingMessagesRef.current = true;\n try {\n const eligibleMessagesResponse = await getEligibleMessages();\n setEligibleMessages(eligibleMessagesResponse);\n } catch (err) {\n setEligibleMessages(err);\n }\n isFetchingMessagesRef.current = false;\n }\n }\n\n const isOpenAndNoMessages = isOpen && !eligibleMessages;\n // if there are unread messages, prefetch the data as the user is more likely to click on the message center\n const shouldPrefetch = !isOpen && !eligibleMessages && !!unreadMessageCount;\n if (isOpenAndNoMessages || shouldPrefetch) {\n fetchEligibleMessages();\n }\n }, [eligibleMessages, getEligibleMessages, isOpen, unreadMessageCount]);\n\n function handleOnClick() {\n setIsOpen(prevIsOpen => !prevIsOpen);\n if (unreadMessageCount && unreadMessageCount > 0 && eligibleMessages) {\n try {\n postMarkAllMessagesAsSeen(eligibleMessages);\n } catch (err) {\n // swallow\n }\n setUnreadMessageCount(0);\n }\n }\n\n function onRequestClose() {\n setIsOpen(false);\n }\n\n const icon = (\n <ButtonComponent\n badgeCount={unreadMessageCount}\n data-resin-target=\"messageCenterOpenModal\"\n data-testid=\"message-center-unread-count\"\n onClick={handleOnClick}\n render={() => (\n <Badgeable\n className=\"icon-bell-badge\"\n topRight={\n <CountBadge isVisible={!!unreadMessageCount} shouldAnimate value={unreadMessageCount || 0} />\n }\n >\n <Megaphone20 className=\"bdl-MessageCenter-icon\" />\n </Badgeable>\n )}\n />\n );\n\n return (\n <Internationalize messages={messages} language={language}>\n <span className=\"bdl-MessageCenter\" data-resin-component=\"messageCenter\">\n {isOpen ? (\n <>\n {icon}\n <MessageCenterModal\n apiHost={apiHost}\n contentPreviewProps={contentPreviewProps}\n getToken={getToken}\n messages={eligibleMessages}\n onRequestClose={onRequestClose}\n overscanRowCount={overscanRowCount}\n onMessageShown={onMessageShown}\n />\n </>\n ) : (\n <>{icon}</>\n )}\n </span>\n </Internationalize>\n );\n}\n\nexport default MessageCenter;\n"],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,IAAI,MAAM,aAAa;AAC9B,OAAOC,WAAW,MAAM,gCAAgC;AACxD,OAAOC,UAAU,MAAM,4CAA4C;AACnE,OAAOC,SAAS,MAAM,yCAAyC;AAE/D,OAAOC,kBAAkB,MAAM,2CAA2C;AAO1E,OAAOC,gBAAgB,MAAM,2CAA2C;AAgBxE,SAASC,aAAaA,CAAC;EACnBC,mBAAmB;EACnBC,qBAAqB;EACrBC,eAAe,EAAEC,eAAe;EAChCC,mBAAmB;EACnBC,QAAQ;EACRC,OAAO;EACPC,yBAAyB;EACzBC,gBAAgB;EAChBC,QAAQ;EACRC,QAAQ;EACRC,cAAc,GAAGlB;AACd,CAAC,EAAE;EACN,MAAM,CAACmB,MAAM,EAAEC,SAAS,CAAC,GAAGrB,KAAK,CAACsB,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM,CAACC,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGxB,KAAK,CAACsB,QAAQ,CAAC,IAAI,CAAC;EACxE;EACA,MAAM,CAACG,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG1B,KAAK,CAACsB,QAAQ,CAC1D,IACJ,CAAC;EACD,MAAMK,qBAAqB,GAAG3B,KAAK,CAAC4B,MAAM,CAAC,KAAK,CAAC;EAEjD5B,K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AA0C,aAAA,CAAA1C,KAAA,CAAAmD,QAAA,QAAGV,IAAO,CAEZ,CACQ,CAAC;AAE3B;AAEA,eAAelC,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
import { Modal, ModalActions } from '../../components/modal';
|
|
5
|
+
import Button from '../../components/button';
|
|
6
|
+
import PrimaryButton from '../../components/primary-button';
|
|
7
|
+
import commonMessages from '../../common/messages';
|
|
8
|
+
import messages from './messages';
|
|
9
|
+
const RemoveCollaboratorConfirmModal = ({
|
|
10
|
+
isOpen,
|
|
11
|
+
onRequestClose,
|
|
12
|
+
onSubmit,
|
|
13
|
+
submitting,
|
|
14
|
+
collaborator,
|
|
15
|
+
okayButtonProps,
|
|
16
|
+
modalProps,
|
|
17
|
+
cancelButtonProps,
|
|
18
|
+
onLoad
|
|
19
|
+
}) => {
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
onLoad?.();
|
|
22
|
+
}, [onLoad]);
|
|
23
|
+
return /*#__PURE__*/React.createElement(Modal, _extends({
|
|
24
|
+
className: "be-modal",
|
|
25
|
+
focusElementSelector: ".btn-primary",
|
|
26
|
+
isOpen: isOpen,
|
|
27
|
+
onRequestClose: submitting ? undefined : onRequestClose,
|
|
28
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, messages.removeCollaboratorConfirmationTitle),
|
|
29
|
+
type: "alert"
|
|
30
|
+
}, modalProps), /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.removeCollaboratorConfirmationDescription, {
|
|
31
|
+
values: {
|
|
32
|
+
name: collaborator?.email ?? collaborator?.name
|
|
33
|
+
}
|
|
34
|
+
})), /*#__PURE__*/React.createElement(ModalActions, null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
35
|
+
isDisabled: submitting,
|
|
36
|
+
onClick: onRequestClose
|
|
37
|
+
}, cancelButtonProps), /*#__PURE__*/React.createElement(FormattedMessage, commonMessages.cancel)), /*#__PURE__*/React.createElement(PrimaryButton, _extends({
|
|
38
|
+
isDisabled: submitting,
|
|
39
|
+
isLoading: submitting,
|
|
40
|
+
onClick: onSubmit
|
|
41
|
+
}, okayButtonProps), /*#__PURE__*/React.createElement(FormattedMessage, commonMessages.okay))));
|
|
42
|
+
};
|
|
43
|
+
export default RemoveCollaboratorConfirmModal;
|
|
44
|
+
//# sourceMappingURL=RemoveCollaboratorConfirmModal.js.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
|
|
5
|
+
import { Modal, ModalActions } from '../../components/modal';
|
|
6
|
+
import Button from '../../components/button';
|
|
7
|
+
import PrimaryButton from '../../components/primary-button';
|
|
8
|
+
import commonMessages from '../../common/messages';
|
|
9
|
+
import messages from './messages';
|
|
10
|
+
import type { collaboratorType } from './flowTypes';
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
cancelButtonProps?: Object,
|
|
14
|
+
collaborator: ?collaboratorType,
|
|
15
|
+
isOpen: boolean,
|
|
16
|
+
modalProps?: Object,
|
|
17
|
+
okayButtonProps?: Object,
|
|
18
|
+
onLoad?: Function,
|
|
19
|
+
onRequestClose: Function,
|
|
20
|
+
onSubmit: Function,
|
|
21
|
+
submitting: boolean,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const RemoveCollaboratorConfirmModal = ({
|
|
25
|
+
isOpen,
|
|
26
|
+
onRequestClose,
|
|
27
|
+
onSubmit,
|
|
28
|
+
submitting,
|
|
29
|
+
collaborator,
|
|
30
|
+
okayButtonProps,
|
|
31
|
+
modalProps,
|
|
32
|
+
cancelButtonProps,
|
|
33
|
+
onLoad,
|
|
34
|
+
}: Props) => {
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
onLoad?.();
|
|
37
|
+
}, [onLoad]);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Modal
|
|
41
|
+
className="be-modal"
|
|
42
|
+
focusElementSelector=".btn-primary"
|
|
43
|
+
isOpen={isOpen}
|
|
44
|
+
onRequestClose={submitting ? undefined : onRequestClose}
|
|
45
|
+
title={<FormattedMessage {...messages.removeCollaboratorConfirmationTitle} />}
|
|
46
|
+
type="alert"
|
|
47
|
+
{...modalProps}
|
|
48
|
+
>
|
|
49
|
+
<FormattedMessage
|
|
50
|
+
{...messages.removeCollaboratorConfirmationDescription}
|
|
51
|
+
values={{
|
|
52
|
+
name: collaborator?.email ?? collaborator?.name,
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
<ModalActions>
|
|
56
|
+
<Button isDisabled={submitting} onClick={onRequestClose} {...cancelButtonProps}>
|
|
57
|
+
<FormattedMessage {...commonMessages.cancel} />
|
|
58
|
+
</Button>
|
|
59
|
+
<PrimaryButton isDisabled={submitting} isLoading={submitting} onClick={onSubmit} {...okayButtonProps}>
|
|
60
|
+
<FormattedMessage {...commonMessages.okay} />
|
|
61
|
+
</PrimaryButton>
|
|
62
|
+
</ModalActions>
|
|
63
|
+
</Modal>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default RemoveCollaboratorConfirmModal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoveCollaboratorConfirmModal.js","names":["React","useEffect","FormattedMessage","Modal","ModalActions","Button","PrimaryButton","commonMessages","messages","RemoveCollaboratorConfirmModal","isOpen","onRequestClose","onSubmit","submitting","collaborator","okayButtonProps","modalProps","cancelButtonProps","onLoad","createElement","_extends","className","focusElementSelector","undefined","title","removeCollaboratorConfirmationTitle","type","removeCollaboratorConfirmationDescription","values","name","email","isDisabled","onClick","cancel","isLoading","okay"],"sources":["../../../src/features/unified-share-modal/RemoveCollaboratorConfirmModal.js"],"sourcesContent":["// @flow\nimport React, { useEffect } from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nimport { Modal, ModalActions } from '../../components/modal';\nimport Button from '../../components/button';\nimport PrimaryButton from '../../components/primary-button';\nimport commonMessages from '../../common/messages';\nimport messages from './messages';\nimport type { collaboratorType } from './flowTypes';\n\ntype Props = {\n cancelButtonProps?: Object,\n collaborator: ?collaboratorType,\n isOpen: boolean,\n modalProps?: Object,\n okayButtonProps?: Object,\n onLoad?: Function,\n onRequestClose: Function,\n onSubmit: Function,\n submitting: boolean,\n};\n\nconst RemoveCollaboratorConfirmModal = ({\n isOpen,\n onRequestClose,\n onSubmit,\n submitting,\n collaborator,\n okayButtonProps,\n modalProps,\n cancelButtonProps,\n onLoad,\n}: Props) => {\n useEffect(() => {\n onLoad?.();\n }, [onLoad]);\n\n return (\n <Modal\n className=\"be-modal\"\n focusElementSelector=\".btn-primary\"\n isOpen={isOpen}\n onRequestClose={submitting ? undefined : onRequestClose}\n title={<FormattedMessage {...messages.removeCollaboratorConfirmationTitle} />}\n type=\"alert\"\n {...modalProps}\n >\n <FormattedMessage\n {...messages.removeCollaboratorConfirmationDescription}\n values={{\n name: collaborator?.email ?? collaborator?.name,\n }}\n />\n <ModalActions>\n <Button isDisabled={submitting} onClick={onRequestClose} {...cancelButtonProps}>\n <FormattedMessage {...commonMessages.cancel} />\n </Button>\n <PrimaryButton isDisabled={submitting} isLoading={submitting} onClick={onSubmit} {...okayButtonProps}>\n <FormattedMessage {...commonMessages.okay} />\n </PrimaryButton>\n </ModalActions>\n </Modal>\n );\n};\n\nexport default RemoveCollaboratorConfirmModal;\n"],"mappings":";AACA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,SAASC,KAAK,EAAEC,YAAY,QAAQ,wBAAwB;AAC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W;IAACqB,SAAS,EAAErB,UAAW;IAACmB,OAAO,EAAEpB;EAAS,GAAKG,eAAe,gBAChGf,KAAA,CAAAmB,aAAA,CAACjB,gBAAgB,EAAKK,cAAc,CAAC4B,IAAO,CACjC,CACL,CACX,CAAC;AAEhB,CAAC;AAED,eAAe1B,8BAA8B","ignoreList":[]}
|
|
@@ -619,7 +619,9 @@ class UnifiedShareForm extends React.Component {
|
|
|
619
619
|
const {
|
|
620
620
|
item,
|
|
621
621
|
collaboratorsList,
|
|
622
|
-
trackingProps
|
|
622
|
+
trackingProps,
|
|
623
|
+
canRemoveCollaborators,
|
|
624
|
+
onRemoveCollaboratorClick
|
|
623
625
|
} = this.props;
|
|
624
626
|
const {
|
|
625
627
|
name,
|
|
@@ -639,7 +641,9 @@ class UnifiedShareForm extends React.Component {
|
|
|
639
641
|
onDoneClick: this.closeCollaboratorList,
|
|
640
642
|
item: item,
|
|
641
643
|
collaborators: collaborators,
|
|
642
|
-
trackingProps: collaboratorListTracking
|
|
644
|
+
trackingProps: collaboratorListTracking,
|
|
645
|
+
canRemoveCollaborators: canRemoveCollaborators,
|
|
646
|
+
onRemoveCollaboratorClick: onRemoveCollaboratorClick
|
|
643
647
|
});
|
|
644
648
|
}
|
|
645
649
|
return listContent;
|
|
@@ -768,7 +772,8 @@ _defineProperty(UnifiedShareForm, "defaultProps", {
|
|
|
768
772
|
modalTracking: {},
|
|
769
773
|
removeLinkConfirmModalTracking: {},
|
|
770
774
|
sharedLinkEmailTracking: {},
|
|
771
|
-
sharedLinkTracking: {}
|
|
775
|
+
sharedLinkTracking: {},
|
|
776
|
+
removeCollaboratorConfirmModalTracking: {}
|
|
772
777
|
}
|
|
773
778
|
});
|
|
774
779
|
export { UnifiedShareForm as UnifiedShareFormBase };
|
|
@@ -66,6 +66,7 @@ class UnifiedShareForm extends React.Component<USFProps, State> {
|
|
|
66
66
|
removeLinkConfirmModalTracking: {},
|
|
67
67
|
sharedLinkEmailTracking: {},
|
|
68
68
|
sharedLinkTracking: {},
|
|
69
|
+
removeCollaboratorConfirmModalTracking: {},
|
|
69
70
|
},
|
|
70
71
|
};
|
|
71
72
|
|
|
@@ -647,7 +648,8 @@ class UnifiedShareForm extends React.Component<USFProps, State> {
|
|
|
647
648
|
}
|
|
648
649
|
|
|
649
650
|
renderCollaboratorList() {
|
|
650
|
-
const { item, collaboratorsList, trackingProps } =
|
|
651
|
+
const { item, collaboratorsList, trackingProps, canRemoveCollaborators, onRemoveCollaboratorClick } =
|
|
652
|
+
this.props;
|
|
651
653
|
const { name, type } = item;
|
|
652
654
|
const { collaboratorListTracking } = trackingProps;
|
|
653
655
|
let listContent = null;
|
|
@@ -663,6 +665,8 @@ class UnifiedShareForm extends React.Component<USFProps, State> {
|
|
|
663
665
|
item={item}
|
|
664
666
|
collaborators={collaborators}
|
|
665
667
|
trackingProps={collaboratorListTracking}
|
|
668
|
+
canRemoveCollaborators={canRemoveCollaborators}
|
|
669
|
+
onRemoveCollaboratorClick={onRemoveCollaboratorClick}
|
|
666
670
|
/>
|
|
667
671
|
);
|
|
668
672
|
}
|