mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Direct users to last visited site when possible
Summary: When clicking the logo in the top-left corner, or finishing a tutorial, we now direct users to the site they last visited, if possible. If unknown, a new redirect endpoint, /welcome/home, is used instead, which directs users to a sensible location based on the number of sites they have. Test Plan: Browser tests. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3878
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {urlState} from 'app/client/models/gristUrlState';
|
||||
import {getWelcomeHomeUrl, urlState} from 'app/client/models/gristUrlState';
|
||||
import {buildAppMenuBillingItem} from 'app/client/ui/BillingButtons';
|
||||
import {getTheme} from 'app/client/ui/CustomThemes';
|
||||
import {cssLeftPane} from 'app/client/ui/PagePanels';
|
||||
@@ -48,7 +48,7 @@ export class AppHeader extends Disposable {
|
||||
cssAppLogo(
|
||||
{title: `Version ${version.version}` +
|
||||
((version.gitcommit as string) !== 'unknown' ? ` (${version.gitcommit})` : '')},
|
||||
urlState().setLinkUrl({}),
|
||||
this._setHomePageUrl(),
|
||||
testId('dm-logo')
|
||||
),
|
||||
cssOrg(
|
||||
@@ -79,6 +79,15 @@ export class AppHeader extends Disposable {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
private _setHomePageUrl() {
|
||||
const lastVisitedOrg = this._appModel.lastVisitedOrgDomain.get();
|
||||
if (lastVisitedOrg) {
|
||||
return urlState().setLinkUrl({org: lastVisitedOrg});
|
||||
} else {
|
||||
return {href: getWelcomeHomeUrl()};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function productPill(org: Organization|null, options: {large?: boolean} = {}): DomContents {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {GristDoc} from 'app/client/components/GristDoc';
|
||||
import {urlState} from 'app/client/models/gristUrlState';
|
||||
import {getWelcomeHomeUrl, urlState} from 'app/client/models/gristUrlState';
|
||||
import {renderer} from 'app/client/ui/DocTutorialRenderer';
|
||||
import {cssPopupBody, FloatingPopup} from 'app/client/ui/FloatingPopup';
|
||||
import {sanitizeHTML} from 'app/client/ui/sanitizeHTML';
|
||||
@@ -242,7 +242,12 @@ export class DocTutorial extends FloatingPopup {
|
||||
private async _finishTutorial() {
|
||||
this._saveCurrentSlidePositionDebounced.cancel();
|
||||
await this._saveCurrentSlidePosition();
|
||||
await urlState().pushUrl({});
|
||||
const lastVisitedOrg = this._appModel.lastVisitedOrgDomain.get();
|
||||
if (lastVisitedOrg) {
|
||||
await urlState().pushUrl({org: lastVisitedOrg});
|
||||
} else {
|
||||
window.location.assign(getWelcomeHomeUrl());
|
||||
}
|
||||
}
|
||||
|
||||
private async _restartTutorial() {
|
||||
|
||||
Reference in New Issue
Block a user