diff --git a/app/javascript/mastodon/features/ui/components/modal_root.js b/app/javascript/mastodon/features/ui/components/modal_root.js index 5420ba2bd24..a09c9d9b370 100644 --- a/app/javascript/mastodon/features/ui/components/modal_root.js +++ b/app/javascript/mastodon/features/ui/components/modal_root.js @@ -5,23 +5,23 @@ import spring from 'react-motion/lib/spring'; import BundleContainer from '../containers/bundle_container'; import BundleModalError from './bundle_modal_error'; import ModalLoading from './modal_loading'; -import ActionsModal from '../components/actions_modal'; +import ActionsModal from './actions_modal'; +import MediaModal from './media_modal'; +import VideoModal from './video_modal'; +import BoostModal from './boost_modal'; +import ConfirmationModal from './confirmation_modal'; import { - MediaModal, OnboardingModal, - VideoModal, - BoostModal, - ConfirmationModal, ReportModal, EmbedModal, } from '../../../features/ui/util/async-components'; const MODAL_COMPONENTS = { - 'MEDIA': MediaModal, + 'MEDIA': () => Promise.resolve({ default: MediaModal }), 'ONBOARDING': OnboardingModal, - 'VIDEO': VideoModal, - 'BOOST': BoostModal, - 'CONFIRM': ConfirmationModal, + 'VIDEO': () => Promise.resolve({ default: VideoModal }), + 'BOOST': () => Promise.resolve({ default: BoostModal }), + 'CONFIRM': () => Promise.resolve({ default: ConfirmationModal }), 'REPORT': ReportModal, 'ACTIONS': () => Promise.resolve({ default: ActionsModal }), 'EMBED': EmbedModal, @@ -82,8 +82,8 @@ export default class ModalRoot extends React.PureComponent { return { opacity: spring(0), scale: spring(0.98) }; } - renderLoading = () => { - return ; + renderLoading = modalId => () => { + return ['MEDIA', 'VIDEO', 'BOOST', 'CONFIRM', 'ACTIONS'].indexOf(modalId) === -1 ? : null; } renderError = (props) => { @@ -117,7 +117,7 @@ export default class ModalRoot extends React.PureComponent {
- + {(SpecificComponent) => }
diff --git a/app/javascript/mastodon/features/ui/util/async-components.js b/app/javascript/mastodon/features/ui/util/async-components.js index 0b4e2df22bf..c767f77a793 100644 --- a/app/javascript/mastodon/features/ui/util/async-components.js +++ b/app/javascript/mastodon/features/ui/util/async-components.js @@ -82,26 +82,10 @@ export function Mutes () { return import(/* webpackChunkName: "features/mutes" */'../../mutes'); } -export function MediaModal () { - return import(/* webpackChunkName: "modals/media_modal" */'../components/media_modal'); -} - export function OnboardingModal () { return import(/* webpackChunkName: "modals/onboarding_modal" */'../components/onboarding_modal'); } -export function VideoModal () { - return import(/* webpackChunkName: "modals/video_modal" */'../components/video_modal'); -} - -export function BoostModal () { - return import(/* webpackChunkName: "modals/boost_modal" */'../components/boost_modal'); -} - -export function ConfirmationModal () { - return import(/* webpackChunkName: "modals/confirmation_modal" */'../components/confirmation_modal'); -} - export function ReportModal () { return import(/* webpackChunkName: "modals/report_modal" */'../components/report_modal'); }