You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.8 KiB
61 lines
1.8 KiB
import { useCallback } from 'react'; |
|
|
|
import { FormattedMessage } from 'react-intl'; |
|
|
|
import { Button } from 'mastodon/components/button'; |
|
import { GIF } from 'mastodon/components/gif'; |
|
import { LoadingIndicator } from 'mastodon/components/loading_indicator'; |
|
|
|
export const ModalPlaceholder: React.FC<{ |
|
loading: boolean; |
|
onClose: (arg0: string | undefined, arg1: boolean) => void; |
|
onRetry?: () => void; |
|
}> = ({ loading, onClose, onRetry }) => { |
|
const handleClose = useCallback(() => { |
|
onClose(undefined, false); |
|
}, [onClose]); |
|
|
|
const handleRetry = useCallback(() => { |
|
if (onRetry) onRetry(); |
|
}, [onRetry]); |
|
|
|
return ( |
|
<div className='modal-root__modal modal-placeholder' aria-busy={loading}> |
|
{loading ? ( |
|
<LoadingIndicator /> |
|
) : ( |
|
<div className='modal-placeholder__error'> |
|
<GIF |
|
src='/oops.gif' |
|
staticSrc='/oops.png' |
|
className='modal-placeholder__error__image' |
|
/> |
|
|
|
<div className='modal-placeholder__error__message'> |
|
<p> |
|
<FormattedMessage |
|
id='bundle_modal_error.message' |
|
defaultMessage='Something went wrong while loading this screen.' |
|
/> |
|
</p> |
|
|
|
<div className='modal-placeholder__error__message__actions'> |
|
<Button onClick={handleRetry}> |
|
<FormattedMessage |
|
id='bundle_modal_error.retry' |
|
defaultMessage='Try again' |
|
/> |
|
</Button> |
|
<Button onClick={handleClose} className='button button-tertiary'> |
|
<FormattedMessage |
|
id='bundle_modal_error.close' |
|
defaultMessage='Close' |
|
/> |
|
</Button> |
|
</div> |
|
</div> |
|
</div> |
|
)} |
|
</div> |
|
); |
|
};
|
|
|