(core) Add tip for "Add New" button

Summary:
Adds a new tip for the doc menu's Add New button. The tip is
shown only when the current user is an editor or owner, and
the site is non-empty. The presence of welcome videos or
popups will also cause the tip to not be shown; it will instead
be shown the next time the doc menu is visited.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3757
This commit is contained in:
George Gevoian
2023-01-13 02:39:33 -05:00
parent b7f65ff408
commit db64dfeef0
18 changed files with 134 additions and 46 deletions

View File

@@ -6,7 +6,6 @@
import {AccessRules} from 'app/client/aclui/AccessRules';
import {ActionLog} from 'app/client/components/ActionLog';
import BaseView from 'app/client/components/BaseView';
import {BehavioralPrompts} from 'app/client/components/BehavioralPrompts';
import {isNumericLike, isNumericOnly} from 'app/client/components/ChartView';
import {CodeEditorPanel} from 'app/client/components/CodeEditorPanel';
import * as commands from 'app/client/components/commands';
@@ -166,7 +165,7 @@ export class GristDoc extends DisposableWithEvents {
// If the doc has a docTour. Used also to enable the UI button to restart the tour.
public readonly hasDocTour: Computed<boolean>;
public readonly behavioralPrompts = BehavioralPrompts.create(this, this.docPageModel.appModel);
public readonly behavioralPromptsManager = this.docPageModel.appModel.behavioralPromptsManager;
private _actionLog: ActionLog;
private _undoStack: UndoStack;
@@ -1100,7 +1099,7 @@ export class GristDoc extends DisposableWithEvents {
// Don't show the tip if a non-card widget was selected.
!['single', 'detail'].includes(selectedWidgetType) ||
// Or if we've already seen it.
this.behavioralPrompts.hasSeenTip('editCardLayout')
this.behavioralPromptsManager.hasSeenTip('editCardLayout')
) {
return;
}
@@ -1114,7 +1113,7 @@ export class GristDoc extends DisposableWithEvents {
const editLayoutButton = document.querySelector('.behavioral-prompt-edit-card-layout');
if (!editLayoutButton) { throw new Error('GristDoc failed to find edit card layout button'); }
this.behavioralPrompts.showTip(editLayoutButton, 'editCardLayout', {
this.behavioralPromptsManager.showTip(editLayoutButton, 'editCardLayout', {
popupOptions: {
placement: 'left-start',
}