Rename errorView() to indexingView()
Problem: Since the `errorView()` has a refresh we can probably just call it `indexingView()` and add the indexing-specific code. Solution: Rename `errorView()` to `indexingView()` and add a progress bar for it.
This commit is contained in:
parent
1f050b18a4
commit
e5df3a1497
|
@ -145,7 +145,7 @@ const {
|
|||
authorView,
|
||||
commentView,
|
||||
editProfileView,
|
||||
errorView,
|
||||
indexingView,
|
||||
extendedView,
|
||||
latestView,
|
||||
likesView,
|
||||
|
@ -776,9 +776,7 @@ const middleware = [
|
|||
const mebibyte = 1024 * 1024;
|
||||
|
||||
if (left > mebibyte) {
|
||||
ctx.response.body = errorView({
|
||||
message: `Oasis has only processed ${percent}% of the messages and needs to catch up. This page will refresh every 10 seconds. Thanks for your patience! ❤`
|
||||
});
|
||||
ctx.response.body = indexingView({ percent });
|
||||
} else {
|
||||
await next();
|
||||
}
|
||||
|
|
|
@ -1030,20 +1030,13 @@ exports.hashtagView = ({ messages, hashtag }) => {
|
|||
};
|
||||
|
||||
exports.indexingView = ({ percent }) => {
|
||||
return template(
|
||||
section(
|
||||
p(
|
||||
`Sorry, Oasis has only processed ${percent}% of the messages and needs to catch up. Thanks for your patience, please wait for a moment and refresh this page to try again.`
|
||||
)
|
||||
)
|
||||
);
|
||||
};
|
||||
// TODO: i18n
|
||||
const message = `Oasis has only processed ${percent}% of the messages and needs to catch up. This page will refresh every 10 seconds. Thanks for your patience! ❤`;
|
||||
|
||||
exports.errorView = ({ message }) => {
|
||||
const nodes = html(
|
||||
{ lang: "en" },
|
||||
head(
|
||||
title("Oasis -- Error"),
|
||||
title("Oasis"),
|
||||
link({ rel: "icon", type: "image/svg+xml", href: "/assets/favicon.svg" }),
|
||||
meta({ charset: "utf-8" }),
|
||||
meta({
|
||||
|
@ -1056,7 +1049,13 @@ exports.errorView = ({ message }) => {
|
|||
}),
|
||||
meta({ "http-equiv": "refresh", content: 10 })
|
||||
),
|
||||
body(main({ id: "content" }, p(message)))
|
||||
body(
|
||||
main(
|
||||
{ id: "content" },
|
||||
p(message),
|
||||
progress({ value: percent, max: 100 })
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
const result = doctypeString + nodes.outerHTML;
|
||||
|
|
Loading…
Reference in New Issue