forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Glitch] Change design of modal loading and error screens in web UI
Port 7f2cfcc to glitch-soc Signed-off-by: Claire <[email protected]>
- Loading branch information
1 parent
605975c
commit 017e2ff
Showing
6 changed files
with
116 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { useHovering } from '@/hooks/useHovering'; | ||
import { autoPlayGif } from 'flavours/glitch/initial_state'; | ||
|
||
export const GIF: React.FC<{ | ||
src: string; | ||
staticSrc: string; | ||
className: string; | ||
animate?: boolean; | ||
}> = ({ src, staticSrc, className, animate = autoPlayGif }) => { | ||
const { hovering, handleMouseEnter, handleMouseLeave } = useHovering(animate); | ||
|
||
return ( | ||
<img | ||
className={className} | ||
src={hovering || animate ? src : staticSrc} | ||
alt='' | ||
role='presentation' | ||
onMouseEnter={handleMouseEnter} | ||
onMouseLeave={handleMouseLeave} | ||
/> | ||
); | ||
}; |
56 changes: 0 additions & 56 deletions
56
app/javascript/flavours/glitch/features/ui/components/bundle_modal_error.jsx
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
app/javascript/flavours/glitch/features/ui/components/modal_loading.jsx
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
app/javascript/flavours/glitch/features/ui/components/modal_placeholder.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { useCallback } from 'react'; | ||
|
||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import { Button } from 'flavours/glitch/components/button'; | ||
import { GIF } from 'flavours/glitch/components/gif'; | ||
import { LoadingIndicator } from 'flavours/glitch/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> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters