mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Disable tips during tutorials
Summary: Behavioral tips shouldn't be shown during tutorials. Test Plan: Browser test. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D3842
This commit is contained in:
@@ -35,6 +35,8 @@ interface QueuedTip {
|
||||
* Tips are shown in the order that they are attached.
|
||||
*/
|
||||
export class BehavioralPromptsManager extends Disposable {
|
||||
private _isDisabled: boolean = false;
|
||||
|
||||
private readonly _prefs = getUserPrefObs(this._appModel.userPrefsObs, 'behavioralPrompts',
|
||||
{ defaultValue: { dontShowTips: false, dismissedTips: [] } }) as Observable<BehavioralPromptPrefs>;
|
||||
|
||||
@@ -67,8 +69,17 @@ export class BehavioralPromptsManager extends Disposable {
|
||||
return !this._prefs.get().dontShowTips;
|
||||
}
|
||||
|
||||
public enable() {
|
||||
this._isDisabled = false;
|
||||
}
|
||||
|
||||
public disable() {
|
||||
this._isDisabled = true;
|
||||
}
|
||||
|
||||
private _queueTip(refElement: Element, prompt: BehavioralPrompt, options: AttachOptions) {
|
||||
if (
|
||||
this._isDisabled ||
|
||||
// Don't show tips if surveying is disabled.
|
||||
// TODO: Move this into a dedicated variable - this is only a short-term fix for hiding
|
||||
// tips in grist-core.
|
||||
|
||||
@@ -332,6 +332,10 @@ export class GristDoc extends DisposableWithEvents {
|
||||
}
|
||||
}));
|
||||
|
||||
if (this.docModel.isTutorial()) {
|
||||
this.behavioralPromptsManager.disable();
|
||||
}
|
||||
|
||||
let isStartingTourOrTutorial = false;
|
||||
this.autoDispose(subscribe(urlState().state, async (_use, state) => {
|
||||
// Only start a tour or tutorial when the full interface is showing, i.e. not when in
|
||||
|
||||
Reference in New Issue
Block a user