-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle error when loading article (#105)
* Handle error whern loading article Show an error page if loading an article fail. One way to test this is to use the search page to list articles, then turn off your wifi before trying to load one. https://phabricator.wikimedia.org/T236897 * Add refresh option on the error page to retry loading the article. * Show loading animation on refresh Co-authored-by: Huei Tan <[email protected]>
- Loading branch information
1 parent
c3d7064
commit 29c803a
Showing
10 changed files
with
58 additions
and
6 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { h } from 'preact' | ||
import { useSoftkey, useI18n } from 'hooks' | ||
|
||
export const Error = ({ message, onRefresh }) => { | ||
const i18n = useI18n() | ||
|
||
useSoftkey('Error', { | ||
center: i18n.i18n('softkey-refresh'), | ||
onKeyCenter: onRefresh, | ||
right: i18n.i18n('softkey-close'), | ||
onKeyRight: () => history.back() | ||
}) | ||
|
||
return ( | ||
<div class='error'> | ||
<img src='images/article-error.png' /> | ||
<p class='message'>{message}</p> | ||
</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
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,14 @@ | ||
.error { | ||
height: @availableHeight; | ||
width: 100vw; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
flex-direction: column; | ||
|
||
p { | ||
font-family: @textFont; | ||
font-size: @bigFont; | ||
text-align: center; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
@colorLight: #72777d; | ||
|
||
@smallFont: 12px; | ||
@bigFont: 17px; |