refactor: update full screen modal
This commit is contained in:
committed by
Awais Jibran
parent
c85f82aba2
commit
efe6688e73
@@ -104,7 +104,7 @@ function DiscussionsSettings({ courseId, intl }) {
|
||||
>
|
||||
{intl.formatMessage(messages.backButton)}
|
||||
</Button>
|
||||
<AppConfigForm.ApplyButton />
|
||||
<AppConfigForm.SaveButton />
|
||||
</div>
|
||||
</Stepper.ActionRow>
|
||||
</>
|
||||
|
||||
@@ -16,7 +16,7 @@ import { saveAppConfig } from '../data/thunks';
|
||||
|
||||
import messages from './messages';
|
||||
import AppConfigFormProvider, { AppConfigFormContext } from './AppConfigFormProvider';
|
||||
import AppConfigFormApplyButton from './AppConfigFormApplyButton';
|
||||
import AppConfigFormSaveButton from './AppConfigFormSaveButton';
|
||||
import LegacyConfigForm from './apps/legacy';
|
||||
import LtiConfigForm from './apps/lti';
|
||||
import Loading from '../../../generic/Loading';
|
||||
@@ -100,6 +100,6 @@ AppConfigForm.propTypes = {
|
||||
const IntlAppConfigForm = injectIntl(AppConfigForm);
|
||||
|
||||
IntlAppConfigForm.Provider = AppConfigFormProvider;
|
||||
IntlAppConfigForm.ApplyButton = AppConfigFormApplyButton;
|
||||
IntlAppConfigForm.SaveButton = AppConfigFormSaveButton;
|
||||
|
||||
export default IntlAppConfigForm;
|
||||
|
||||
@@ -7,33 +7,33 @@ import messages from './messages';
|
||||
import { SAVING } from '../data/slice';
|
||||
import { AppConfigFormContext } from './AppConfigFormProvider';
|
||||
|
||||
function AppConfigFormApplyButton({ intl }) {
|
||||
function AppConfigFormSaveButton({ intl }) {
|
||||
const saveStatus = useSelector(state => state.discussions.saveStatus);
|
||||
const { formRef } = useContext(AppConfigFormContext);
|
||||
|
||||
const submitButtonState = saveStatus === SAVING ? 'pending' : 'default';
|
||||
|
||||
// This causes the form to be submitted from a button outside the form.
|
||||
const handleApply = useCallback(() => {
|
||||
const handleSave = useCallback(() => {
|
||||
formRef.current.requestSubmit();
|
||||
}, [formRef]);
|
||||
|
||||
return (
|
||||
<StatefulButton
|
||||
labels={{
|
||||
default: intl.formatMessage(messages.applyButton),
|
||||
pending: intl.formatMessage(messages.applyingButton),
|
||||
complete: intl.formatMessage(messages.appliedButton),
|
||||
default: intl.formatMessage(messages.saveButton),
|
||||
pending: intl.formatMessage(messages.savingButton),
|
||||
complete: intl.formatMessage(messages.savedButton),
|
||||
}}
|
||||
state={submitButtonState}
|
||||
className="mr-2"
|
||||
onClick={handleApply}
|
||||
onClick={handleSave}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
AppConfigFormApplyButton.propTypes = {
|
||||
AppConfigFormSaveButton.propTypes = {
|
||||
intl: intlShape.isRequired,
|
||||
};
|
||||
|
||||
export default injectIntl(AppConfigFormApplyButton);
|
||||
export default injectIntl(AppConfigFormSaveButton);
|
||||
@@ -14,19 +14,19 @@ const messages = defineMessages({
|
||||
defaultMessage: 'Back',
|
||||
description: 'Button allowing the user to return to discussion app selection.',
|
||||
},
|
||||
applyButton: {
|
||||
id: 'authoring.discussions.applyButton',
|
||||
defaultMessage: 'Apply',
|
||||
saveButton: {
|
||||
id: 'authoring.discussions.saveButton',
|
||||
defaultMessage: 'Save',
|
||||
description: 'Button allowing the user to submit their discussion configuration.',
|
||||
},
|
||||
applyingButton: {
|
||||
id: 'authoring.discussions.applyingButton',
|
||||
defaultMessage: 'Applying',
|
||||
savingButton: {
|
||||
id: 'authoring.discussions.savingButton',
|
||||
defaultMessage: 'Saving',
|
||||
description: 'Button label when the discussion configuration is being submitted.',
|
||||
},
|
||||
appliedButton: {
|
||||
id: 'authoring.discussions.appliedButton',
|
||||
defaultMessage: 'Applied',
|
||||
savedButton: {
|
||||
id: 'authoring.discussions.savedButton',
|
||||
defaultMessage: 'Saved',
|
||||
description: 'Button label when the discussion configuration has been successfully submitted.',
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user