Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show modal if no highlights are configured & small improvements #4198

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions scripts/apps/authoring-react/authoring-integration-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import {CompareArticleVersionsModal} from './toolbar/compare-article-versions';
import {httpRequestJsonLocal} from 'core/helpers/network';
import {getArticleAdapter} from './article-adapter';
import {ui} from 'core/ui-utils';
import TranslateModal from './toolbar/translate-modal';
import {MarkForDesksModal} from './toolbar/mark-for-desks/mark-for-desks-modal';

function getAuthoringActionsFromExtensions(
Expand Down Expand Up @@ -185,16 +184,20 @@ const getExportModal = (
const getHighlightsAction = (getItem: () => IArticle): IAuthoringAction => {
return {
label: gettext('Highlights'),
onTrigger: () => (
showModal(({closeModal}) => {
return (
<HighlightsModal
article={getItem()}
closeModal={closeModal}
/>
);
})
),
onTrigger: () => {
sdApi.highlights.fetchHighlights().then((res) => {
if (res._items.length === 0) {
ui.alert(gettext('No highlights have been created yet.'));
} else {
showModal(({closeModal}) => (
<HighlightsModal
article={getItem()}
closeModal={closeModal}
/>
));
}
});
},
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class MarkForDesksModal extends React.PureComponent<IProps, IState> {
>
<Spacer v gap="8">
<MultiSelect
onChange={({value}) => {
onChange={(value) => {
this.setState({
...this.state,
selectedDesks: value.map((desk) => desk._id),
Expand Down
1 change: 1 addition & 0 deletions scripts/core/ui-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const ui = {
showModal(({closeModal}) => {
return (
<Modal
position="top"
visible
onHide={closeModal}
zIndex={1050}
Expand Down