2023-01-11 17:57:42 +00:00
|
|
|
import { makeT } from 'app/client/lib/localization';
|
2021-07-30 15:16:33 +00:00
|
|
|
import * as commands from 'app/client/components/commands';
|
|
|
|
import { urlState } from 'app/client/models/gristUrlState';
|
2021-07-19 08:49:44 +00:00
|
|
|
import { IOnBoardingMsg, startOnBoarding } from "app/client/ui/OnBoardingPopups";
|
2023-03-27 17:25:25 +00:00
|
|
|
import { ShortcutKey, ShortcutKeyContent } from 'app/client/ui/ShortcutKey';
|
2022-09-06 01:51:57 +00:00
|
|
|
import { theme } from 'app/client/ui2018/cssVars';
|
2021-07-19 08:49:44 +00:00
|
|
|
import { icon } from "app/client/ui2018/icons";
|
2021-07-30 15:16:33 +00:00
|
|
|
import { cssLink } from "app/client/ui2018/links";
|
2023-10-30 03:21:28 +00:00
|
|
|
import { getGristConfig } from "app/common/urlUtils";
|
2021-07-19 08:49:44 +00:00
|
|
|
import { dom, styled } from "grainjs";
|
|
|
|
|
2023-01-11 17:57:42 +00:00
|
|
|
const t = makeT('WelcomeTour');
|
|
|
|
|
2023-10-30 03:21:28 +00:00
|
|
|
export function getOnBoardingMessages(): IOnBoardingMsg[] {
|
|
|
|
const {features} = getGristConfig();
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
title: t('Editing Data'),
|
|
|
|
body: () => [
|
|
|
|
dom('p',
|
|
|
|
t('Double-click or hit {{enter}} on a cell to edit it. ', {
|
|
|
|
enter: ShortcutKey(ShortcutKeyContent(t('Enter'))),
|
|
|
|
}),
|
|
|
|
t('Start with {{equal}} to enter a formula.', {
|
|
|
|
equal: ShortcutKey(ShortcutKeyContent('=')),
|
2023-03-27 17:25:25 +00:00
|
|
|
})),
|
2023-10-30 03:21:28 +00:00
|
|
|
],
|
|
|
|
selector: '.field_clip',
|
|
|
|
placement: 'bottom',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
selector: '.tour-creator-panel',
|
|
|
|
title: t('Configuring your document'),
|
|
|
|
body: () => [
|
|
|
|
dom('p',
|
|
|
|
t('Toggle the {{creatorPanel}} to format columns, ', {creatorPanel: dom('em', t('creator panel'))}),
|
|
|
|
t('convert to card view, select data, and more.')
|
|
|
|
)
|
|
|
|
],
|
|
|
|
placement: 'left',
|
|
|
|
cropPadding: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
selector: '.tour-type-selector',
|
|
|
|
title: t('Customizing columns'),
|
|
|
|
body: () => [
|
|
|
|
dom('p',
|
|
|
|
t('Set formatting options, formulas, or column types, such as dates, choices, or attachments. ')),
|
|
|
|
dom('p',
|
|
|
|
t('Make it relational! Use the {{ref}} type to link tables. ', {
|
|
|
|
ref: ShortcutKey(t('Reference')),
|
|
|
|
})),
|
|
|
|
],
|
|
|
|
placement: 'right',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
selector: '.tour-add-new',
|
|
|
|
title: t('Building up'),
|
|
|
|
body: () => [
|
|
|
|
dom('p', t('Use {{addNew}} to add widgets, pages, or import more data. ', {
|
|
|
|
addNew: ShortcutKey(t('Add New')),
|
|
|
|
})),
|
|
|
|
],
|
|
|
|
placement: 'right',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
selector: '.tour-share-icon',
|
|
|
|
title: t('Sharing'),
|
|
|
|
body: () => [
|
|
|
|
dom('p', t('Use the Share button ({{share}}) to share the document or export data.',
|
|
|
|
{share: TopBarButtonIcon(t('Share'))}))
|
|
|
|
],
|
|
|
|
placement: 'bottom',
|
|
|
|
cropPadding: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
selector: '.tour-help-center',
|
|
|
|
title: t('Flying higher'),
|
|
|
|
body: () => [
|
|
|
|
dom('p', t('Use {{helpCenter}} for documentation or questions.',
|
|
|
|
{helpCenter: ShortcutKey(GreyIcon('Help'), t('Help Center'))}))
|
|
|
|
],
|
|
|
|
placement: 'right',
|
|
|
|
},
|
|
|
|
...(features?.includes('templates') && Boolean(getGristConfig().templateOrg) ? [{
|
|
|
|
selector: '.tour-welcome',
|
|
|
|
title: t('Welcome to Grist!'),
|
|
|
|
body: () => [
|
|
|
|
dom('p', t("Browse our {{templateLibrary}} to discover what's possible and get inspired.",
|
|
|
|
{
|
|
|
|
templateLibrary: cssLink({ target: '_blank', href: urlState().makeUrl({ homePage: "templates" }) },
|
|
|
|
t('template library'), cssInlineIcon('FieldLink'))
|
|
|
|
}
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
showHasModal: true,
|
|
|
|
}] : []),
|
|
|
|
];
|
|
|
|
}
|
2021-07-19 08:49:44 +00:00
|
|
|
|
|
|
|
export function startWelcomeTour(onFinishCB: () => void) {
|
2021-07-30 15:16:33 +00:00
|
|
|
commands.allCommands.fieldTabOpen.run();
|
2023-10-30 03:21:28 +00:00
|
|
|
startOnBoarding(getOnBoardingMessages(), onFinishCB);
|
2021-07-19 08:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-09-06 01:51:57 +00:00
|
|
|
const TopBarButtonIcon = styled(icon, `
|
|
|
|
--icon-color: ${theme.topBarButtonPrimaryFg};
|
2021-07-19 08:49:44 +00:00
|
|
|
`);
|
2021-07-30 15:16:33 +00:00
|
|
|
|
|
|
|
const GreyIcon = styled(icon, `
|
2022-09-06 01:51:57 +00:00
|
|
|
--icon-color: ${theme.shortcutKeySecondaryFg};
|
2021-07-30 15:16:33 +00:00
|
|
|
margin-right: 8px;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssInlineIcon = styled(icon, `
|
|
|
|
margin: -3px 8px 0 4px;
|
|
|
|
`);
|