(core) Hide the GristDocTour table by default but reveal it when /p/GristDocTour is in the URL

Summary:
Adds 'GristDocTour' as a possible value of urlState().docPage

GristDoc checks for this and converts it to a normal view record ID

It also then sets a flag showGristDocTour=true which tells Pages.ts to show the page in the sidebar

Otherwise the page is 'hidden' in the sidebar in the same way it would be if blocked by ACL rules

This all feels very hacky, but I don't know this code well enough to know if there's a better way. Hopefully this behaviour is temporary.

Test Plan: Tested manually, not sure if this is worth an automated test at this stage

Reviewers: paulfitz, dsagal

Reviewed By: paulfitz, dsagal

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D2953
This commit is contained in:
Alex Hall
2021-07-30 20:05:16 +02:00
parent 6b3ac07ca7
commit 73c4efa315
4 changed files with 28 additions and 12 deletions

View File

@@ -7,7 +7,7 @@ import {Document} from 'app/common/UserAPI';
import clone = require('lodash/clone');
import pickBy = require('lodash/pickBy');
export type IDocPage = number | 'new' | 'code' | 'acl';
export type IDocPage = number | 'new' | 'code' | 'acl' | 'GristDocTour';
// What page to show in the user's home area. Defaults to 'workspace' if a workspace is set, and
// to 'all' otherwise.
@@ -329,8 +329,8 @@ export function userOverrideParams(email: string|null, extraState?: IGristUrlSta
* parseDocPage is a noop if p is 'new' or 'code', otherwise parse to integer
*/
function parseDocPage(p: string) {
if (['new', 'code', 'acl'].includes(p)) {
return p as 'new'|'code'|'acl';
if (['new', 'code', 'acl', 'GristDocTour'].includes(p)) {
return p as 'new'|'code'|'acl'|'GristDocTour';
}
return parseInt(p, 10);
}