Skip to content

Commit 9bce0a3

Browse files
authored
fix: remove deprecated feedback link (#493)
1 parent a22a260 commit 9bce0a3

File tree

3 files changed

+31
-142
lines changed

3 files changed

+31
-142
lines changed

src/editors/containers/EditorContainer/components/EditorFooter/__snapshots__/index.test.jsx.snap

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,6 @@ exports[`EditorFooter render snapshot: default args (disableSave: false, saveFai
88
className="shadow-sm"
99
>
1010
<ActionRow>
11-
<ActionRow.Spacer />
12-
<Button
13-
aria-label="Discard changes and return to learning context"
14-
onClick={[MockFunction args.onCancel]}
15-
variant="tertiary"
16-
>
17-
<FormattedMessage
18-
defaultMessage="Cancel"
19-
description="Label for cancel button"
20-
id="authoring.editorfooter.cancelButton.label"
21-
/>
22-
</Button>
23-
<Button
24-
aria-label="Save changes and return to learning context"
25-
disabled={false}
26-
onClick={[MockFunction args.onSave]}
27-
>
28-
<FormattedMessage
29-
defaultMessage="Save"
30-
description="Label for Save button"
31-
id="authoring.editorfooter.savebutton.label"
32-
/>
33-
</Button>
34-
</ActionRow>
35-
</ModalDialog.Footer>
36-
</div>
37-
`;
38-
39-
exports[`EditorFooter render snapshot: dont show feedback link 1`] = `
40-
<div
41-
className="editor-footer fixed-bottom"
42-
>
43-
<ModalDialog.Footer
44-
className="shadow-sm"
45-
>
46-
<ActionRow>
47-
<ActionRow.Spacer />
4811
<Button
4912
aria-label="Discard changes and return to learning context"
5013
onClick={[MockFunction args.onCancel]}
@@ -80,7 +43,6 @@ exports[`EditorFooter render snapshot: save disabled. Show button spinner 1`] =
8043
className="shadow-sm"
8144
>
8245
<ActionRow>
83-
<ActionRow.Spacer />
8446
<Button
8547
aria-label="Discard changes and return to learning context"
8648
onClick={[MockFunction args.onCancel]}
@@ -124,49 +86,6 @@ exports[`EditorFooter render snapshot: save failed. Show error message 1`] = `
12486
className="shadow-sm"
12587
>
12688
<ActionRow>
127-
<ActionRow.Spacer />
128-
<Button
129-
aria-label="Discard changes and return to learning context"
130-
onClick={[MockFunction args.onCancel]}
131-
variant="tertiary"
132-
>
133-
<FormattedMessage
134-
defaultMessage="Cancel"
135-
description="Label for cancel button"
136-
id="authoring.editorfooter.cancelButton.label"
137-
/>
138-
</Button>
139-
<Button
140-
aria-label="Save changes and return to learning context"
141-
disabled={false}
142-
onClick={[MockFunction args.onSave]}
143-
>
144-
<FormattedMessage
145-
defaultMessage="Save"
146-
description="Label for Save button"
147-
id="authoring.editorfooter.savebutton.label"
148-
/>
149-
</Button>
150-
</ActionRow>
151-
</ModalDialog.Footer>
152-
</div>
153-
`;
154-
155-
exports[`EditorFooter render snapshot: show feedback link 1`] = `
156-
<div
157-
className="editor-footer fixed-bottom"
158-
>
159-
<ModalDialog.Footer
160-
className="shadow-sm"
161-
>
162-
<ActionRow>
163-
<Hyperlink
164-
destination="https://docs.google.com/forms/d/e/1FAIpQLSdmtO5at9WWHLcWLrOgk1oMz97gYYYrUq4cvH8Vzd-WQwM0Cg/viewform?usp=sharing"
165-
target="_blank"
166-
>
167-
Share Feedback
168-
</Hyperlink>
169-
<ActionRow.Spacer />
17089
<Button
17190
aria-label="Discard changes and return to learning context"
17291
onClick={[MockFunction args.onCancel]}

src/editors/containers/EditorContainer/components/EditorFooter/index.jsx

Lines changed: 29 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
import { useSelector } from 'react-redux';
32
import PropTypes from 'prop-types';
43

54
import {
@@ -8,11 +7,8 @@ import {
87
Button,
98
ModalDialog,
109
Toast,
11-
Hyperlink,
1210
} from '@openedx/paragon';
1311
import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n';
14-
import { selectors } from '../../../../data/redux';
15-
import { blockTypes } from '../../../../data/constants/app';
1612

1713
import messages from './messages';
1814

@@ -24,50 +20,36 @@ export const EditorFooter = ({
2420
saveFailed,
2521
// injected
2622
intl,
27-
}) => {
28-
const blockType = useSelector(selectors.app.blockType);
23+
}) => (
24+
<div className="editor-footer fixed-bottom">
25+
{saveFailed && (
26+
<Toast show onClose={clearSaveFailed}>
27+
<FormattedMessage {...messages.contentSaveFailed} />
28+
</Toast>
29+
)}
30+
<ModalDialog.Footer className="shadow-sm">
31+
<ActionRow>
32+
<Button
33+
aria-label={intl.formatMessage(messages.cancelButtonAriaLabel)}
34+
variant="tertiary"
35+
onClick={onCancel}
36+
>
37+
<FormattedMessage {...messages.cancelButtonLabel} />
38+
</Button>
39+
<Button
40+
aria-label={intl.formatMessage(messages.saveButtonAriaLabel)}
41+
onClick={onSave}
42+
disabled={disableSave}
43+
>
44+
{disableSave
45+
? <Spinner animation="border" className="mr-3" />
46+
: <FormattedMessage {...messages.saveButtonLabel} />}
47+
</Button>
48+
</ActionRow>
49+
</ModalDialog.Footer>
50+
</div>
51+
);
2952

30-
return (
31-
<div className="editor-footer fixed-bottom">
32-
{saveFailed && (
33-
<Toast show onClose={clearSaveFailed}>
34-
<FormattedMessage {...messages.contentSaveFailed} />
35-
</Toast>
36-
)}
37-
38-
<ModalDialog.Footer className="shadow-sm">
39-
<ActionRow>
40-
{
41-
// TODO: Remove this code when the problem Editor Beta is complete.
42-
blockType === blockTypes.problem
43-
&& (
44-
<Hyperlink destination="https://docs.google.com/forms/d/e/1FAIpQLSdmtO5at9WWHLcWLrOgk1oMz97gYYYrUq4cvH8Vzd-WQwM0Cg/viewform?usp=sharing" target="_blank">
45-
Share Feedback
46-
</Hyperlink>
47-
)
48-
}
49-
<ActionRow.Spacer />
50-
<Button
51-
aria-label={intl.formatMessage(messages.cancelButtonAriaLabel)}
52-
variant="tertiary"
53-
onClick={onCancel}
54-
>
55-
<FormattedMessage {...messages.cancelButtonLabel} />
56-
</Button>
57-
<Button
58-
aria-label={intl.formatMessage(messages.saveButtonAriaLabel)}
59-
onClick={onSave}
60-
disabled={disableSave}
61-
>
62-
{disableSave
63-
? <Spinner animation="border" className="mr-3" />
64-
: <FormattedMessage {...messages.saveButtonLabel} />}
65-
</Button>
66-
</ActionRow>
67-
</ModalDialog.Footer>
68-
</div>
69-
);
70-
};
7153
EditorFooter.propTypes = {
7254
clearSaveFailed: PropTypes.func.isRequired,
7355
disableSave: PropTypes.bool.isRequired,
Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
import React from 'react';
22
import { shallow } from '@edx/react-unit-test-utils';
33

4-
import { useSelector } from 'react-redux';
54
import { formatMessage } from '../../../../../testUtils';
65
import { EditorFooter } from '.';
76

87
jest.mock('../../hooks', () => ({
98
nullMethod: jest.fn().mockName('hooks.nullMethod'),
109
}));
1110

12-
jest.mock('react-redux', () => ({
13-
useSelector: jest.fn(),
14-
}));
15-
1611
describe('EditorFooter', () => {
1712
const props = {
1813
intl: { formatMessage },
@@ -25,20 +20,13 @@ describe('EditorFooter', () => {
2520
test('snapshot: default args (disableSave: false, saveFailed: false)', () => {
2621
expect(shallow(<EditorFooter {...props} />).snapshot).toMatchSnapshot();
2722
});
23+
2824
test('snapshot: save disabled. Show button spinner', () => {
2925
expect(shallow(<EditorFooter {...props} disableSave />).snapshot).toMatchSnapshot();
3026
});
27+
3128
test('snapshot: save failed. Show error message', () => {
3229
expect(shallow(<EditorFooter {...props} saveFailed />).snapshot).toMatchSnapshot();
3330
});
34-
35-
test('snapshot: show feedback link', () => {
36-
useSelector.mockReturnValueOnce('problem');
37-
expect(shallow(<EditorFooter {...props} />).snapshot).toMatchSnapshot();
38-
});
39-
test('snapshot: dont show feedback link', () => {
40-
useSelector.mockReturnValueOnce('not a Problem');
41-
expect(shallow(<EditorFooter {...props} />).snapshot).toMatchSnapshot();
42-
});
4331
});
4432
});

0 commit comments

Comments
 (0)