Files
frontend-app-authoring/src/editors/containers/VideoEditor/index.jsx
Omar Al-Ithawi 98ec415e2b fix: let make extract_translations find messages (#290)
Otherwise it'll complain for not finding any message.

`defineMessage` ensures that React i18n static code collector is able to
find the messages.

References
----------

This pull request is part of the [FC-0012 project](https://openedx.atlassian.net/l/cp/XGS0iCcQ) which is sparked by the [Translation Infrastructure update OEP-58](https://open-edx-proposals.readthedocs.io/en/latest/architectural-decisions/oep-0058-arch-translations-management.html#specification).

Check the links above for full information about the overall project.
2023-03-29 10:17:25 -04:00

70 lines
1.7 KiB
JavaScript

import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import {
Spinner,
} from '@edx/paragon';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { selectors } from '../../data/redux';
import { RequestKeys } from '../../data/constants/requests';
import EditorContainer from '../EditorContainer';
import VideoEditorModal from './components/VideoEditorModal';
import { ErrorContext, errorsHook, fetchVideoContent } from './hooks';
import messages from './messages';
export const VideoEditor = ({
onClose,
// injected
intl,
// redux
studioViewFinished,
}) => {
const {
error,
validateEntry,
} = errorsHook();
return (
<ErrorContext.Provider value={error}>
<EditorContainer
getContent={fetchVideoContent()}
onClose={onClose}
validateEntry={validateEntry}
>
{studioViewFinished ? (
<div className="video-editor">
<VideoEditorModal />
</div>
) : (
<Spinner
animation="border"
className="m-3"
screenreadertext={intl.formatMessage(messages.spinnerScreenReaderText)}
/>
)}
</EditorContainer>
</ErrorContext.Provider>
);
};
VideoEditor.defaultProps = {
onClose: null,
};
VideoEditor.propTypes = {
onClose: PropTypes.func,
// injected
intl: intlShape.isRequired,
// redux
studioViewFinished: PropTypes.bool.isRequired,
};
export const mapStateToProps = (state) => ({
studioViewFinished: selectors.requests.isFinished(state, { requestKey: RequestKeys.fetchStudioView }),
});
export const mapDispatchToProps = {};
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(VideoEditor));