(core) Add page titles to login and error pages

Summary:
Login and error pages now have their own unique page titles. This also fixes
the bug with the signed-out page having a page title of "Error".

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3479
pull/214/head
George Gevoian 2 years ago
parent 0350e2df58
commit 02dd96daf2

@ -6,7 +6,8 @@ import {pagePanels} from 'app/client/ui/PagePanels';
import {createTopBarHome} from 'app/client/ui/TopBar'; import {createTopBarHome} from 'app/client/ui/TopBar';
import {bigBasicButtonLink, bigPrimaryButtonLink} from 'app/client/ui2018/buttons'; import {bigBasicButtonLink, bigPrimaryButtonLink} from 'app/client/ui2018/buttons';
import {colors, vars} from 'app/client/ui2018/cssVars'; import {colors, vars} from 'app/client/ui2018/cssVars';
import {GristLoadConfig} from 'app/common/gristUrls'; import {getPageTitleSuffix, GristLoadConfig} from 'app/common/gristUrls';
import {getGristConfig} from 'app/common/urlUtils';
import {dom, DomElementArg, makeTestId, observable, styled} from 'grainjs'; import {dom, DomElementArg, makeTestId, observable, styled} from 'grainjs';
const testId = makeTestId('test-'); const testId = makeTestId('test-');
@ -24,6 +25,8 @@ export function createErrPage(appModel: AppModel) {
* Creates a page to show that the user has no access to this org. * Creates a page to show that the user has no access to this org.
*/ */
export function createForbiddenPage(appModel: AppModel, message?: string) { export function createForbiddenPage(appModel: AppModel, message?: string) {
document.title = `Access denied${getPageTitleSuffix(getGristConfig())}`;
const isAnonym = () => !appModel.currentValidUser; const isAnonym = () => !appModel.currentValidUser;
const isExternal = () => appModel.currentValidUser?.loginMethod === 'External'; const isExternal = () => appModel.currentValidUser?.loginMethod === 'External';
return pagePanelsError(appModel, 'Access denied', [ return pagePanelsError(appModel, 'Access denied', [
@ -51,6 +54,8 @@ export function createForbiddenPage(appModel: AppModel, message?: string) {
* Creates a page that shows the user is logged out. * Creates a page that shows the user is logged out.
*/ */
export function createSignedOutPage(appModel: AppModel) { export function createSignedOutPage(appModel: AppModel) {
document.title = `Signed out${getPageTitleSuffix(getGristConfig())}`;
return pagePanelsError(appModel, 'Signed out', [ return pagePanelsError(appModel, 'Signed out', [
cssErrorText("You are now signed out."), cssErrorText("You are now signed out."),
cssButtonWrap(bigPrimaryButtonLink( cssButtonWrap(bigPrimaryButtonLink(
@ -63,6 +68,8 @@ export function createSignedOutPage(appModel: AppModel) {
* Creates a "Page not found" page. * Creates a "Page not found" page.
*/ */
export function createNotFoundPage(appModel: AppModel, message?: string) { export function createNotFoundPage(appModel: AppModel, message?: string) {
document.title = `Page not found${getPageTitleSuffix(getGristConfig())}`;
return pagePanelsError(appModel, 'Page not found', [ return pagePanelsError(appModel, 'Page not found', [
cssErrorText(message || "The requested page could not be found.", dom('br'), cssErrorText(message || "The requested page could not be found.", dom('br'),
"Please check the URL and try again."), "Please check the URL and try again."),
@ -76,6 +83,8 @@ export function createNotFoundPage(appModel: AppModel, message?: string) {
* Creates a generic error page with the given message. * Creates a generic error page with the given message.
*/ */
export function createOtherErrorPage(appModel: AppModel, message?: string) { export function createOtherErrorPage(appModel: AppModel, message?: string) {
document.title = `Error${getPageTitleSuffix(getGristConfig())}`;
return pagePanelsError(appModel, 'Something went wrong', [ return pagePanelsError(appModel, 'Something went wrong', [
cssErrorText(message ? `There was an error: ${addPeriod(message)}` : cssErrorText(message ? `There was an error: ${addPeriod(message)}` :
"There was an unknown error."), "There was an unknown error."),

@ -6,7 +6,7 @@
<link rel="icon" type="image/x-icon" href="icons/favicon.png" /> <link rel="icon" type="image/x-icon" href="icons/favicon.png" />
<link rel="stylesheet" href="icons/icons.css"> <link rel="stylesheet" href="icons/icons.css">
<!-- INSERT CUSTOM --> <!-- INSERT CUSTOM -->
<title>Error<!-- INSERT TITLE SUFFIX --></title> <title>Loading...<!-- INSERT TITLE SUFFIX --></title>
</head> </head>
<body> <body>
<!-- INSERT ERROR --> <!-- INSERT ERROR -->

Loading…
Cancel
Save