2023-03-27 17:25:25 +00:00
|
|
|
import * as commands from 'app/client/components/commands';
|
|
|
|
import {makeT} from 'app/client/lib/localization';
|
|
|
|
import {ShortcutKey, ShortcutKeyContent} from 'app/client/ui/ShortcutKey';
|
|
|
|
import {icon} from 'app/client/ui2018/icons';
|
2022-10-19 23:06:05 +00:00
|
|
|
import {cssLink} from 'app/client/ui2018/links';
|
2023-07-04 21:21:34 +00:00
|
|
|
import {commonUrls, GristDeploymentType} from 'app/common/gristUrls';
|
2022-12-20 02:06:39 +00:00
|
|
|
import {BehavioralPrompt} from 'app/common/Prefs';
|
2022-10-19 23:06:05 +00:00
|
|
|
import {dom, DomContents, DomElementArg, styled} from 'grainjs';
|
2023-01-31 16:35:46 +00:00
|
|
|
|
|
|
|
const t = makeT('GristTooltips');
|
2022-10-19 23:06:05 +00:00
|
|
|
|
|
|
|
const cssTooltipContent = styled('div', `
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
row-gap: 8px;
|
|
|
|
`);
|
|
|
|
|
2022-12-20 02:06:39 +00:00
|
|
|
const cssBoldText = styled('span', `
|
|
|
|
font-weight: 600;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssItalicizedText = styled('span', `
|
|
|
|
font-style: italic;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssIcon = styled(icon, `
|
|
|
|
height: 18px;
|
|
|
|
width: 18px;
|
|
|
|
`);
|
|
|
|
|
|
|
|
export type Tooltip =
|
2022-10-19 23:06:05 +00:00
|
|
|
| 'dataSize'
|
|
|
|
| 'setTriggerFormula'
|
|
|
|
| 'selectBy'
|
|
|
|
| 'workOnACopy'
|
|
|
|
| 'openAccessRules'
|
|
|
|
| 'addRowConditionalStyle'
|
2023-10-23 05:51:08 +00:00
|
|
|
| 'addColumnConditionalStyle'
|
|
|
|
| 'uuid'
|
|
|
|
| 'lookups';
|
2022-10-19 23:06:05 +00:00
|
|
|
|
|
|
|
export type TooltipContentFunc = (...domArgs: DomElementArg[]) => DomContents;
|
|
|
|
|
2022-12-20 02:06:39 +00:00
|
|
|
export const GristTooltips: Record<Tooltip, TooltipContentFunc> = {
|
2022-10-19 23:06:05 +00:00
|
|
|
dataSize: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', t('The total size of all data in this document, excluding attachments.')),
|
|
|
|
dom('div', t('Updates every 5 minutes.')),
|
2022-10-19 23:06:05 +00:00
|
|
|
...args,
|
|
|
|
),
|
|
|
|
setTriggerFormula: (...args: DomElementArg[]) => cssTooltipContent(
|
|
|
|
dom('div',
|
2023-01-31 16:35:46 +00:00
|
|
|
t('Formulas that trigger in certain cases, and store the calculated value as data.')
|
2022-10-19 23:06:05 +00:00
|
|
|
),
|
|
|
|
dom('div',
|
2023-07-16 16:52:13 +00:00
|
|
|
t('Useful for storing the timestamp or author of a new record, data cleaning, and more.')
|
2022-10-19 23:06:05 +00:00
|
|
|
),
|
|
|
|
dom('div',
|
2023-01-31 16:35:46 +00:00
|
|
|
cssLink({href: commonUrls.helpTriggerFormulas, target: '_blank'}, t('Learn more.')),
|
2022-10-19 23:06:05 +00:00
|
|
|
),
|
|
|
|
...args,
|
|
|
|
),
|
|
|
|
selectBy: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', t('Link your new widget to an existing widget on this page.')),
|
2022-10-19 23:06:05 +00:00
|
|
|
dom('div',
|
2023-01-31 16:35:46 +00:00
|
|
|
cssLink({href: commonUrls.helpLinkingWidgets, target: '_blank'}, t('Learn more.')),
|
2022-10-19 23:06:05 +00:00
|
|
|
),
|
|
|
|
...args,
|
|
|
|
),
|
|
|
|
workOnACopy: (...args: DomElementArg[]) => cssTooltipContent(
|
|
|
|
dom('div',
|
2023-01-31 16:35:46 +00:00
|
|
|
t('Try out changes in a copy, then decide whether to replace the original with your edits.')
|
2022-10-19 23:06:05 +00:00
|
|
|
),
|
|
|
|
dom('div',
|
|
|
|
cssLink({href: commonUrls.helpTryingOutChanges, target: '_blank'}, 'Learn more.'),
|
|
|
|
),
|
|
|
|
...args,
|
|
|
|
),
|
|
|
|
openAccessRules: (...args: DomElementArg[]) => cssTooltipContent(
|
|
|
|
dom('div',
|
2023-07-16 16:52:13 +00:00
|
|
|
t('Access rules give you the power to create nuanced rules to determine who can \
|
|
|
|
see or edit which parts of your document.')
|
2022-10-19 23:06:05 +00:00
|
|
|
),
|
|
|
|
dom('div',
|
2023-01-31 16:35:46 +00:00
|
|
|
cssLink({href: commonUrls.helpAccessRules, target: '_blank'}, t('Learn more.')),
|
2022-10-19 23:06:05 +00:00
|
|
|
),
|
|
|
|
...args,
|
|
|
|
),
|
|
|
|
addRowConditionalStyle: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', t('Apply conditional formatting to rows based on formulas.')),
|
2022-10-19 23:06:05 +00:00
|
|
|
dom('div',
|
2023-01-31 16:35:46 +00:00
|
|
|
cssLink({href: commonUrls.helpConditionalFormatting, target: '_blank'}, t('Learn more.')),
|
2022-10-19 23:06:05 +00:00
|
|
|
),
|
|
|
|
...args,
|
|
|
|
),
|
|
|
|
addColumnConditionalStyle: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', t('Apply conditional formatting to cells in this column when formula conditions are met.')),
|
|
|
|
dom('div', t('Click on “Open row styles” to apply conditional formatting to rows.')),
|
2022-10-19 23:06:05 +00:00
|
|
|
dom('div',
|
2023-01-31 16:35:46 +00:00
|
|
|
cssLink({href: commonUrls.helpConditionalFormatting, target: '_blank'}, t('Learn more.')),
|
2022-10-19 23:06:05 +00:00
|
|
|
),
|
|
|
|
...args,
|
|
|
|
),
|
2023-10-23 05:51:08 +00:00
|
|
|
uuid: (...args: DomElementArg[]) => cssTooltipContent(
|
|
|
|
dom('div', t('A UUID is a randomly-generated string that is useful for unique identifiers and link keys.')),
|
|
|
|
dom('div',
|
|
|
|
cssLink({href: commonUrls.helpLinkKeys, target: '_blank'}, t('Learn more.')),
|
|
|
|
),
|
|
|
|
...args,
|
|
|
|
),
|
|
|
|
lookups: (...args: DomElementArg[]) => cssTooltipContent(
|
|
|
|
dom('div', t('Lookups return data from related tables.')),
|
|
|
|
dom('div', t('Use reference columns to relate data in different tables.')),
|
|
|
|
dom('div',
|
|
|
|
cssLink({href: commonUrls.helpColRefs, target: '_blank'}, t('Learn more.')),
|
|
|
|
),
|
|
|
|
...args,
|
|
|
|
),
|
2022-10-19 23:06:05 +00:00
|
|
|
};
|
2022-12-20 02:06:39 +00:00
|
|
|
|
|
|
|
export interface BehavioralPromptContent {
|
2023-01-31 16:35:46 +00:00
|
|
|
title: () => string;
|
2022-12-20 02:06:39 +00:00
|
|
|
content: (...domArgs: DomElementArg[]) => DomContents;
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: GristDeploymentType[] | '*';
|
|
|
|
/** Defaults to `desktop`. */
|
|
|
|
showContext?: 'mobile' | 'desktop' | '*';
|
|
|
|
/** Defaults to `false`. */
|
|
|
|
hideDontShowTips?: boolean;
|
|
|
|
/** Defaults to `false`. */
|
|
|
|
forceShow?: boolean;
|
|
|
|
/** Defaults to `true`. */
|
|
|
|
markAsSeen?: boolean;
|
2022-12-20 02:06:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const GristBehavioralPrompts: Record<BehavioralPrompt, BehavioralPromptContent> = {
|
|
|
|
referenceColumns: {
|
2023-01-31 16:35:46 +00:00
|
|
|
title: () => t('Reference Columns'),
|
2022-12-20 02:06:39 +00:00
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', t('Reference columns are the key to {{relational}} data in Grist.', {
|
|
|
|
relational: cssBoldText(t('relational'))
|
|
|
|
})),
|
|
|
|
dom('div', t('They allow for one record to point (or refer) to another.')),
|
2022-12-20 02:06:39 +00:00
|
|
|
dom('div',
|
2023-01-31 16:35:46 +00:00
|
|
|
cssLink({href: commonUrls.helpColRefs, target: '_blank'}, t('Learn more.')),
|
2022-12-20 02:06:39 +00:00
|
|
|
),
|
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: ['saas'],
|
2022-12-20 02:06:39 +00:00
|
|
|
},
|
|
|
|
referenceColumnsConfig: {
|
2023-01-31 16:35:46 +00:00
|
|
|
title: () => t('Reference Columns'),
|
2022-12-20 02:06:39 +00:00
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', t('Select the table to link to.')),
|
2023-07-16 16:52:13 +00:00
|
|
|
dom('div', t('Cells in a reference column always identify an {{entire}} \
|
|
|
|
record in that table, but you may select which column from that record to show.', {
|
2023-01-31 16:35:46 +00:00
|
|
|
entire: cssItalicizedText(t('entire'))
|
|
|
|
})),
|
2022-12-20 02:06:39 +00:00
|
|
|
dom('div',
|
2023-01-31 16:35:46 +00:00
|
|
|
cssLink({href: commonUrls.helpUnderstandingReferenceColumns, target: '_blank'}, t('Learn more.')),
|
2022-12-20 02:06:39 +00:00
|
|
|
),
|
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: ['saas'],
|
2022-12-20 02:06:39 +00:00
|
|
|
},
|
|
|
|
rawDataPage: {
|
2023-01-31 16:35:46 +00:00
|
|
|
title: () => t('Raw Data page'),
|
2022-12-20 02:06:39 +00:00
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-07-16 16:52:13 +00:00
|
|
|
dom('div', t('The Raw Data page lists all data tables in your document, \
|
|
|
|
including summary tables and tables not included in page layouts.')),
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', cssLink({href: commonUrls.helpRawData, target: '_blank'}, t('Learn more.'))),
|
2022-12-20 02:06:39 +00:00
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: ['saas'],
|
2022-12-20 02:06:39 +00:00
|
|
|
},
|
|
|
|
accessRules: {
|
2023-01-31 16:35:46 +00:00
|
|
|
title: () => t('Access Rules'),
|
2022-12-20 02:06:39 +00:00
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-07-16 16:52:13 +00:00
|
|
|
dom('div', t('Access rules give you the power to create nuanced rules \
|
|
|
|
to determine who can see or edit which parts of your document.')),
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', cssLink({href: commonUrls.helpAccessRules, target: '_blank'}, t('Learn more.'))),
|
2022-12-20 02:06:39 +00:00
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: ['saas'],
|
2022-12-20 02:06:39 +00:00
|
|
|
},
|
|
|
|
filterButtons: {
|
2023-01-31 16:35:46 +00:00
|
|
|
title: () => t('Pinning Filters'),
|
2022-12-20 02:06:39 +00:00
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', t('Pinned filters are displayed as buttons above the widget.')),
|
|
|
|
dom('div', t('Unpin to hide the the button while keeping the filter.')),
|
|
|
|
dom('div', cssLink({href: commonUrls.helpFilterButtons, target: '_blank'}, t('Learn more.'))),
|
2022-12-20 02:06:39 +00:00
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: ['saas'],
|
2022-12-20 02:06:39 +00:00
|
|
|
},
|
|
|
|
nestedFiltering: {
|
2023-01-31 16:35:46 +00:00
|
|
|
title: () => t('Nested Filtering'),
|
2022-12-20 02:06:39 +00:00
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', t('You can filter by more than one column.')),
|
|
|
|
dom('div', t('Only those rows will appear which match all of the filters.')),
|
2022-12-20 02:06:39 +00:00
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: ['saas'],
|
2022-12-20 02:06:39 +00:00
|
|
|
},
|
|
|
|
pageWidgetPicker: {
|
2023-01-31 16:35:46 +00:00
|
|
|
title: () => t('Selecting Data'),
|
2022-12-20 02:06:39 +00:00
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', t('Select the table containing the data to show.')),
|
|
|
|
dom('div', t('Use the 𝚺 icon to create summary (or pivot) tables, for totals or subtotals.')),
|
2022-12-20 02:06:39 +00:00
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: ['saas'],
|
2022-12-20 02:06:39 +00:00
|
|
|
},
|
|
|
|
pageWidgetPickerSelectBy: {
|
2023-01-31 16:35:46 +00:00
|
|
|
title: () => t('Linking Widgets'),
|
2022-12-20 02:06:39 +00:00
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', t('Link your new widget to an existing widget on this page.')),
|
|
|
|
dom('div', t('This is the secret to Grist\'s dynamic and productive layouts.')),
|
|
|
|
dom('div', cssLink({href: commonUrls.helpLinkingWidgets, target: '_blank'}, t('Learn more.'))),
|
2022-12-20 02:06:39 +00:00
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: ['saas'],
|
2022-12-20 02:06:39 +00:00
|
|
|
},
|
|
|
|
editCardLayout: {
|
2023-01-31 16:35:46 +00:00
|
|
|
title: () => t('Editing Card Layout'),
|
2022-12-20 02:06:39 +00:00
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-01-31 16:35:46 +00:00
|
|
|
dom('div', t('Rearrange the fields in your card by dragging and resizing cells.')),
|
|
|
|
dom('div', t('Clicking {{EyeHideIcon}} in each cell hides the field from this view without deleting it.', {
|
|
|
|
EyeHideIcon: cssIcon('EyeHide')
|
|
|
|
})),
|
2022-12-20 02:06:39 +00:00
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: ['saas'],
|
2022-12-20 02:06:39 +00:00
|
|
|
},
|
2023-01-13 07:39:33 +00:00
|
|
|
addNew: {
|
2023-01-31 16:35:46 +00:00
|
|
|
title: () => t('Add New'),
|
2023-01-13 07:39:33 +00:00
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
2023-07-16 16:52:13 +00:00
|
|
|
dom('div', t('Click the Add New button to create new documents or workspaces, or import data.')),
|
2023-01-13 07:39:33 +00:00
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: ['saas'],
|
2023-01-13 07:39:33 +00:00
|
|
|
},
|
2023-03-27 17:25:25 +00:00
|
|
|
rickRow: {
|
|
|
|
title: () => t('Anchor Links'),
|
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
|
|
|
dom('div',
|
2023-07-16 16:52:13 +00:00
|
|
|
t('To make an anchor link that takes the user to a specific cell, click on a row and press {{shortcut}}.',
|
2023-03-27 17:25:25 +00:00
|
|
|
{
|
|
|
|
shortcut: ShortcutKey(ShortcutKeyContent(commands.allCommands.copyLink.humanKeys[0])),
|
|
|
|
}
|
|
|
|
),
|
|
|
|
),
|
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: '*',
|
|
|
|
showContext: '*',
|
|
|
|
hideDontShowTips: true,
|
|
|
|
forceShow: true,
|
|
|
|
markAsSeen: false,
|
2023-04-14 10:09:50 +00:00
|
|
|
},
|
|
|
|
customURL: {
|
|
|
|
title: () => t('Custom Widgets'),
|
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
|
|
|
dom('div',
|
|
|
|
t(
|
2023-07-16 16:52:13 +00:00
|
|
|
'You can choose one of our pre-made widgets or embed your own by providing its full URL.'
|
2023-04-14 10:09:50 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
dom('div', cssLink({href: commonUrls.helpCustomWidgets, target: '_blank'}, t('Learn more.'))),
|
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: ['saas'],
|
2023-04-14 10:09:50 +00:00
|
|
|
},
|
2023-09-19 02:48:56 +00:00
|
|
|
calendarConfig: {
|
|
|
|
title: () => t('Calendar'),
|
|
|
|
content: (...args: DomElementArg[]) => cssTooltipContent(
|
|
|
|
dom('div', t("To configure your calendar, select columns for start/end dates and event titles. \
|
|
|
|
Note each column's type.")),
|
|
|
|
dom('div', t("Can't find the right columns? Click 'Change Widget' to select the table with events \
|
|
|
|
data.")),
|
|
|
|
dom('div', cssLink({href: commonUrls.helpCalendarWidget, target: '_blank'}, t('Learn more.'))),
|
|
|
|
...args,
|
|
|
|
),
|
2023-09-27 00:40:34 +00:00
|
|
|
showDeploymentTypes: ['saas'],
|
2023-09-19 02:48:56 +00:00
|
|
|
},
|
2022-12-20 02:06:39 +00:00
|
|
|
};
|