(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

@@ -12,17 +12,15 @@ import {dom, input, Observable, styled, subscribeElem} from 'grainjs';
const t = makeT('WelcomeQuestions');
export function shouldShowWelcomeQuestions(userPrefsObs: Observable<UserPrefs>): boolean {
return Boolean(getGristConfig().survey && userPrefsObs.get()?.showNewUserQuestions);
}
/**
* Shows a modal with welcome questions if surveying is enabled and the user hasn't
* dismissed the modal before.
*
* Returns a boolean indicating whether the modal was shown or not.
*/
export function showWelcomeQuestions(userPrefsObs: Observable<UserPrefs>): boolean {
if (!(getGristConfig().survey && userPrefsObs.get()?.showNewUserQuestions)) {
return false;
}
export function showWelcomeQuestions(userPrefsObs: Observable<UserPrefs>) {
saveModal((ctl, owner): ISaveModalOptions => {
const selection = choices.map(c => Observable.create(owner, false));
const otherText = Observable.create(owner, '');
@@ -60,8 +58,6 @@ export function showWelcomeQuestions(userPrefsObs: Observable<UserPrefs>): boole
modalArgs: cssModalCentered.cls(''),
};
});
return true;
}
const choices: Array<{icon: IconName, color: string, textKey: string}> = [