diff --git a/app/javascript/gabsocial/components/bundle_modal_error.js b/app/javascript/gabsocial/components/bundle_modal_error.js deleted file mode 100644 index b4cf5b48..00000000 --- a/app/javascript/gabsocial/components/bundle_modal_error.js +++ /dev/null @@ -1,51 +0,0 @@ -import { defineMessages, injectIntl } from 'react-intl'; -import Button from './button'; - -const messages = defineMessages({ - error: { id: 'bundle_modal_error.message', defaultMessage: 'Something went wrong while loading this component.' }, - retry: { id: 'bundle_modal_error.retry', defaultMessage: 'Try again' }, - close: { id: 'bundle_modal_error.close', defaultMessage: 'Close' }, -}); - -export default -@injectIntl -class BundleModalError extends PureComponent { - - static propTypes = { - onRetry: PropTypes.func.isRequired, - onClose: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - } - - handleRetry = () => { - this.props.onRetry(); - } - - render () { - const { onClose, intl: { formatMessage } } = this.props; - - // Keep the markup in sync with - // (make sure they have the same dimensions) - return ( -
-
-
- -
-
- -
-
-
- ); - } - -} - diff --git a/app/javascript/gabsocial/components/modal/bundle_error_modal.js b/app/javascript/gabsocial/components/modal/bundle_error_modal.js new file mode 100644 index 00000000..c006cb8b --- /dev/null +++ b/app/javascript/gabsocial/components/modal/bundle_error_modal.js @@ -0,0 +1,39 @@ +import { defineMessages, injectIntl } from 'react-intl' +import ConfirmationModal from './confirmation_modal' + +const messages = defineMessages({ + error: { id: 'bundle_modal_error.message', defaultMessage: 'Something went wrong while loading this component.' }, + retry: { id: 'bundle_modal_error.retry', defaultMessage: 'Try again' }, + title: { id: 'bundle_modal_error.error', defaultMessage: 'Error' }, +}) + +export default +@injectIntl +class BundleErrorModal extends PureComponent { + + static propTypes = { + onRetry: PropTypes.func.isRequired, + onClose: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, + } + + handleRetry = () => { + this.props.onRetry() + } + + render () { + const { onClose, intl } = this.props + + return ( + + ) + } + +} + diff --git a/app/javascript/gabsocial/components/modal/loading_modal.js b/app/javascript/gabsocial/components/modal/loading_modal.js new file mode 100644 index 00000000..d230f8cf --- /dev/null +++ b/app/javascript/gabsocial/components/modal/loading_modal.js @@ -0,0 +1,22 @@ +import Block from '../block' +import ColumnIndicator from '../column_indicator' + +export default class LoadingModal extends PureComponent { + + render() { + return ( +
+ +
+
+ + + +
+
+
+
+ ) + } + +} diff --git a/app/javascript/gabsocial/components/modal/modal_loading.js b/app/javascript/gabsocial/components/modal/modal_loading.js deleted file mode 100644 index 78d75a2f..00000000 --- a/app/javascript/gabsocial/components/modal/modal_loading.js +++ /dev/null @@ -1,20 +0,0 @@ -import ColumnIndicator from '../column_indicator'; - -// Keep the markup in sync with -// (make sure they have the same dimensions) -export default class ModalLoading extends PureComponent { - render() { - return ( -
-
- -
-
-
-
-
-
- ); - } -} \ No newline at end of file diff --git a/app/javascript/gabsocial/components/modal/modal_root.js b/app/javascript/gabsocial/components/modal/modal_root.js index 8137ddc6..2e5389ee 100644 --- a/app/javascript/gabsocial/components/modal/modal_root.js +++ b/app/javascript/gabsocial/components/modal/modal_root.js @@ -1,9 +1,9 @@ -import { Fragment } from 'react' import { closeModal } from '../../actions/modal' import { cancelReplyCompose } from '../../actions/compose' import Bundle from '../../features/ui/util/bundle' import ModalBase from './modal_base' -import BundleModalError from '../bundle_modal_error' +import BundleErrorModal from './bundle_error_modal' +import LoadingModal from './loading_modal' import { MODAL_BLOCK_ACCOUNT, MODAL_BOOST, @@ -152,11 +152,11 @@ class ModalRoot extends PureComponent { } renderLoading = () => { - return null + return } renderError = () => { - return + return } onClickClose = () => { @@ -179,7 +179,7 @@ class ModalRoot extends PureComponent { fetchComponent={MODAL_COMPONENTS[type]} loading={this.renderLoading} error={this.renderError} - renderDelay={200} + renderDelay={150} > { (Component) => diff --git a/app/javascript/gabsocial/components/popover/error_popover.js b/app/javascript/gabsocial/components/popover/error_popover.js new file mode 100644 index 00000000..96b0b146 --- /dev/null +++ b/app/javascript/gabsocial/components/popover/error_popover.js @@ -0,0 +1,22 @@ +import Block from '../block' +import ColumnIndicator from '../column_indicator' + +export default class ErrorPopover extends PureComponent { + + render() { + return ( +
+ +
+
+ + + +
+
+
+
+ ) + } + +} diff --git a/app/javascript/gabsocial/components/popover/loading_popover.js b/app/javascript/gabsocial/components/popover/loading_popover.js new file mode 100644 index 00000000..509fa6ba --- /dev/null +++ b/app/javascript/gabsocial/components/popover/loading_popover.js @@ -0,0 +1,22 @@ +import Block from '../block' +import ColumnIndicator from '../column_indicator' + +export default class LoadingPopover extends PureComponent { + + render() { + return ( +
+ +
+
+ + + +
+
+
+
+ ) + } + +} \ No newline at end of file diff --git a/app/javascript/gabsocial/components/popover/popover_root.js b/app/javascript/gabsocial/components/popover/popover_root.js index 0010958e..301a9201 100644 --- a/app/javascript/gabsocial/components/popover/popover_root.js +++ b/app/javascript/gabsocial/components/popover/popover_root.js @@ -35,6 +35,8 @@ import { getWindowDimension } from '../../utils/is_mobile' import Bundle from '../../features/ui/util/bundle' import ModalBase from '../modal/modal_base' import PopoverBase from './popover_base' +import ErrorPopover from './error_popover' +import LoadingPopover from './loading_popover' const initialState = getWindowDimension() @@ -102,8 +104,12 @@ class PopoverRoot extends PureComponent { this.setState({ width }) } - renderEmpty = () => { - return
+ renderLoading = () => { + return + } + + renderError = () => { + return } render() { @@ -130,9 +136,9 @@ class PopoverRoot extends PureComponent { visible && { (Component) => diff --git a/app/javascript/gabsocial/features/ui/util/async_components.js b/app/javascript/gabsocial/features/ui/util/async_components.js index ce819d6a..5410cac4 100644 --- a/app/javascript/gabsocial/features/ui/util/async_components.js +++ b/app/javascript/gabsocial/features/ui/util/async_components.js @@ -54,7 +54,6 @@ export function ListTimeline() { return import(/* webpackChunkName: "features/li export function ListTimelineSettingsModal() { return import(/* webpackChunkName: "components/list_timeline_settings_modal" */'../../../components/modal/list_timeline_settings_modal') } export function MediaGallery() { return import(/* webpackChunkName: "components/media_gallery" */'../../../components/media_gallery') } export function MediaModal() { return import(/* webpackChunkName: "components/media_modal" */'../../../components/modal/media_modal') } -export function ModalLoading() { return import(/* webpackChunkName: "components/modal_loading" */'../../../components/modal/modal_loading') } export function Mutes() { return import(/* webpackChunkName: "features/mutes" */'../../mutes') } export function MuteModal() { return import(/* webpackChunkName: "modals/mute_modal" */'../../../components/modal/mute_modal') } export function NavSettingsPopover() { return import(/* webpackChunkName: "modals/nav_settings_popover" */'../../../components/popover/nav_settings_popover') }