mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
cd0c6de53e
Summary: Extracts code from showExampleCard into a generic function which is reused for document tours. It handles reading and writing to user preferences for automatic showing and explicitly reopening. Test Plan: Manually tested that it automatically shows a tour just once and clicking to reopen works. There's not much new functionality so there's little that needs testing. This is an initial version that's mostly internal and is likely to be polished for users in the future. If I should still add tests, I'd like confirmation that the current behaviour is as desired. Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2944
32 lines
972 B
TypeScript
32 lines
972 B
TypeScript
import {StringUnion} from 'app/common/StringUnion';
|
|
|
|
export const SortPref = StringUnion("name", "date");
|
|
export type SortPref = typeof SortPref.type;
|
|
|
|
export const ViewPref = StringUnion("list", "icons");
|
|
export type ViewPref = typeof ViewPref.type;
|
|
|
|
|
|
// A collection of preferences related to a user or org (or combination).
|
|
export interface Prefs {
|
|
// TODO replace this with real preferences.
|
|
placeholder?: string;
|
|
}
|
|
|
|
export type UserPrefs = Prefs;
|
|
|
|
export interface UserOrgPrefs extends Prefs {
|
|
docMenuSort?: SortPref;
|
|
docMenuView?: ViewPref;
|
|
|
|
// List of example docs that the user has seen and dismissed the welcome card for.
|
|
// The numbers are the `id` from IExampleInfo in app/client/ui/ExampleInfo.
|
|
// By living in UserOrgPrefs, this applies only to the examples-containing org.
|
|
seenExamples?: number[];
|
|
|
|
// List of document IDs where the user has seen and dismissed the document tour.
|
|
seenDocTours?: string[];
|
|
}
|
|
|
|
export type OrgPrefs = Prefs;
|