Skip to content

Commit eb1cd95

Browse files
authored
ENG-1797 Add links to existing docs (#1078)
* Bump roamjs-components and add docs links to settings * Update roamjs-components to version 0.88.1 and replace imports of Description component with SettingsDescription in settings components. Add missing periods to descriptions in ExportSettings for consistency.
1 parent 347d0b2 commit eb1cd95

15 files changed

Lines changed: 182 additions & 54 deletions

apps/roam/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"react-draggable": "4.4.5",
7575
"react-in-viewport": "1.0.0-alpha.20",
7676
"react-vertical-timeline-component": "3.5.2",
77-
"roamjs-components": "0.87.0",
77+
"roamjs-components": "0.88.1",
7878
"tldraw": "2.4.6",
7979
"use-sync-external-store": "1.5.0",
8080
"xregexp": "^5.0.0",

apps/roam/src/components/settings/CanvasShortcutSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState } from "react";
22
import { Checkbox, InputGroup, Tabs, Tab } from "@blueprintjs/core";
3-
import Description from "roamjs-components/components/Description";
3+
import Description from "~/components/settings/SettingsDescription";
44
import getDiscourseNodes, {
55
excludeDefaultNodes,
66
} from "~/utils/getDiscourseNodes";

apps/roam/src/components/settings/DiscourseNodeSuggestiveRules.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
TEMPLATE_SETTING_KEYS,
1818
} from "~/components/settings/utils/settingKeys";
1919
import { RenderRoamBlock } from "~/utils/roamReactComponents";
20+
import { ROAM_DOCS, withDocsLink } from "./utils/docs";
2021

2122
const DiscourseNodeSuggestiveRules = ({
2223
node,
@@ -72,7 +73,10 @@ const DiscourseNodeSuggestiveRules = ({
7273
<DualWriteBlocksPanel
7374
nodeType={node.type}
7475
title="Template"
75-
description={`The template that auto fills ${node.text} page when generated.`}
76+
description={withDocsLink(
77+
`The template that auto fills ${node.text} page when generated.`,
78+
ROAM_DOCS.creatingNodes,
79+
)}
7680
settingKeys={TEMPLATE_SETTING_KEYS}
7781
uid={templateUid}
7882
defaultValue={node.template}

apps/roam/src/components/settings/ExportSettings.tsx

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
EXPORT_KEYS,
1212
} from "~/components/settings/utils/settingKeys";
1313
import { type SettingsSnapshot } from "./utils/accessors";
14+
import { ROAM_DOCS, withDocsLink } from "./utils/docs";
1415

1516
const DiscourseGraphExport = ({
1617
globalSettings,
@@ -27,7 +28,10 @@ const DiscourseGraphExport = ({
2728
<div>
2829
<GlobalFlagPanel
2930
title="remove special characters"
30-
description="Whether or not to remove the special characters in a file name"
31+
description={withDocsLink(
32+
"Whether or not to remove the special characters in a file name.",
33+
ROAM_DOCS.sharing,
34+
)}
3135
settingKeys={[
3236
GLOBAL_KEYS.export,
3337
EXPORT_KEYS.removeSpecialCharacters,
@@ -40,7 +44,10 @@ const DiscourseGraphExport = ({
4044

4145
<GlobalFlagPanel
4246
title="resolve block references"
43-
description="Replaces block references in the markdown content with the block's content"
47+
description={withDocsLink(
48+
"Replaces block references in the markdown content with the block's content.",
49+
ROAM_DOCS.sharing,
50+
)}
4451
settingKeys={[GLOBAL_KEYS.export, EXPORT_KEYS.resolveBlockReferences]}
4552
initialValue={exportBlockProps[EXPORT_KEYS.resolveBlockReferences]}
4653
order={3}
@@ -49,7 +56,10 @@ const DiscourseGraphExport = ({
4956
/>
5057
<GlobalFlagPanel
5158
title="resolve block embeds"
52-
description="Replaces block embeds in the markdown content with the block's content tree"
59+
description={withDocsLink(
60+
"Replaces block embeds in the markdown content with the block's content tree.",
61+
ROAM_DOCS.sharing,
62+
)}
5363
settingKeys={[GLOBAL_KEYS.export, EXPORT_KEYS.resolveBlockEmbeds]}
5464
initialValue={exportBlockProps[EXPORT_KEYS.resolveBlockEmbeds]}
5565
order={4}
@@ -59,7 +69,10 @@ const DiscourseGraphExport = ({
5969

6070
<GlobalFlagPanel
6171
title="append referenced node"
62-
description="If a referenced node is defined in a node's format, it will be appended to the discourse context"
72+
description={withDocsLink(
73+
"If a referenced node is defined in a node's format, it will be appended to the discourse context.",
74+
ROAM_DOCS.sharing,
75+
)}
6376
settingKeys={[GLOBAL_KEYS.export, EXPORT_KEYS.appendReferencedNode]}
6477
initialValue={exportBlockProps[EXPORT_KEYS.appendReferencedNode]}
6578
order={6}
@@ -70,7 +83,10 @@ const DiscourseGraphExport = ({
7083
<div className="link-type-select-wrapper">
7184
<GlobalSelectPanel
7285
title="link type"
73-
description="How to format links that appear in your export."
86+
description={withDocsLink(
87+
"How to format links that appear in your export.",
88+
ROAM_DOCS.sharing,
89+
)}
7490
settingKeys={[GLOBAL_KEYS.export, EXPORT_KEYS.linkType]}
7591
initialValue={exportBlockProps[EXPORT_KEYS.linkType]}
7692
order={5}
@@ -81,7 +97,10 @@ const DiscourseGraphExport = ({
8197
</div>
8298
<GlobalNumberPanel
8399
title="max filename length"
84-
description="Set the maximum name length for markdown file exports"
100+
description={withDocsLink(
101+
"Set the maximum name length for markdown file exports.",
102+
ROAM_DOCS.sharing,
103+
)}
85104
settingKeys={[GLOBAL_KEYS.export, EXPORT_KEYS.maxFilenameLength]}
86105
initialValue={exportBlockProps[EXPORT_KEYS.maxFilenameLength]}
87106
order={0}
@@ -90,7 +109,10 @@ const DiscourseGraphExport = ({
90109
/>
91110
<GlobalMultiTextPanel
92111
title="frontmatter"
93-
description="Specify all the lines that should go to the Frontmatter of the markdown file"
112+
description={withDocsLink(
113+
"Specify all the lines that should go to the Frontmatter of the markdown file.",
114+
ROAM_DOCS.sharing,
115+
)}
94116
settingKeys={[GLOBAL_KEYS.export, EXPORT_KEYS.frontmatter]}
95117
initialValue={exportBlockProps[EXPORT_KEYS.frontmatter]}
96118
order={2}

apps/roam/src/components/settings/GeneralSettings.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
getUidAndStringSetting,
1616
} from "~/utils/getExportSettings";
1717
import { DISCOURSE_CONFIG_PAGE_TITLE } from "~/data/constants";
18+
import { ROAM_DOCS, withDocsLink } from "./utils/docs";
1819

1920
const DiscourseGraphHome = ({
2021
globalSettings,
@@ -47,7 +48,10 @@ const DiscourseGraphHome = ({
4748
Update titles to Sentence case once read side is migrated to block props. */}
4849
<GlobalTextPanel
4950
title="trigger"
50-
description="The trigger to create the node menu."
51+
description={withDocsLink(
52+
"The trigger to create the node menu.",
53+
ROAM_DOCS.creatingNodes,
54+
)}
5155
settingKeys={[GLOBAL_KEYS.trigger]}
5256
initialValue={globalSettings[GLOBAL_KEYS.trigger]}
5357
order={0}

apps/roam/src/components/settings/HomePersonalSettings.tsx

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState } from "react";
22
import { OnloadArgs } from "roamjs-components/types";
33
import { render as renderToast } from "roamjs-components/components/Toast";
44
import { Label, Dialog, Button, Intent, Classes } from "@blueprintjs/core";
5-
import Description from "roamjs-components/components/Description";
5+
import Description from "~/components/settings/SettingsDescription";
66
import { addStyle } from "roamjs-components/dom";
77
import { NodeMenuTriggerComponent } from "~/components/DiscourseNodeMenu";
88
import {
@@ -35,6 +35,7 @@ import posthog from "posthog-js";
3535
import internalError from "~/utils/internalError";
3636
import { setPersonalSetting, type SettingsSnapshot } from "./utils/accessors";
3737
import { getStoredRelationsEnabled } from "~/utils/storedRelations";
38+
import { ROAM_DOCS, withDocsLink } from "./utils/docs";
3839

3940
const enum RelationMigrationDialog {
4041
"none",
@@ -119,7 +120,12 @@ const HomePersonalSettings = ({
119120
<div className="flex flex-col gap-4 p-1">
120121
<Label>
121122
Personal node menu trigger
122-
<Description description="Override the global trigger for the discourse node menu." />
123+
<Description
124+
description={withDocsLink(
125+
"Override the global trigger for the discourse node menu.",
126+
ROAM_DOCS.creatingNodes,
127+
)}
128+
/>
123129
<NodeMenuTriggerComponent
124130
extensionAPI={extensionAPI}
125131
initialValue={personalSettings[PERSONAL_KEYS.personalNodeMenuTrigger]}
@@ -138,13 +144,19 @@ const HomePersonalSettings = ({
138144
settingKey={DISCOURSE_TOOL_SHORTCUT_KEY}
139145
blockPropKey={PERSONAL_KEYS.discourseToolShortcut}
140146
label="Discourse tool keyboard shortcut"
141-
description="Set a single key to activate the discourse tool in tldraw. Only single keys (no modifiers) are supported. Leave empty for no shortcut."
147+
description={withDocsLink(
148+
"Set a single key to activate the discourse tool in tldraw. Only single keys (no modifiers) are supported. Leave empty for no shortcut.",
149+
ROAM_DOCS.creatingNodes,
150+
)}
142151
placeholder="Click to set single key"
143152
initialValue={personalSettings[PERSONAL_KEYS.discourseToolShortcut]}
144153
/>
145154
<PersonalFlagPanel
146155
title="Overlay"
147-
description="Whether or not to overlay discourse context information over discourse node references."
156+
description={withDocsLink(
157+
"Whether or not to overlay discourse context information over discourse node references.",
158+
ROAM_DOCS.discourseContextOverlay,
159+
)}
148160
settingKeys={[PERSONAL_KEYS.discourseContextOverlay]}
149161
initialValue={personalSettings[PERSONAL_KEYS.discourseContextOverlay]}
150162
onChange={(checked) => {
@@ -157,7 +169,10 @@ const HomePersonalSettings = ({
157169
/>
158170
<PersonalFlagPanel
159171
title="Enable stored relations"
160-
description="Use stored relations instead of legacy pattern-based relations"
172+
description={withDocsLink(
173+
"Use stored relations instead of legacy pattern-based relations",
174+
ROAM_DOCS.migrationToStoredRelations,
175+
)}
161176
settingKeys={["Reified relation triples"]}
162177
initialValue={personalSettings["Reified relation triples"]}
163178
value={storedRelations}
@@ -179,7 +194,10 @@ const HomePersonalSettings = ({
179194

180195
<PersonalFlagPanel
181196
title="Text selection popup"
182-
description="Whether or not to show the discourse node menu when selecting text."
197+
description={withDocsLink(
198+
"Whether or not to show the discourse node menu when selecting text.",
199+
ROAM_DOCS.creatingNodes,
200+
)}
183201
settingKeys={[PERSONAL_KEYS.textSelectionPopup]}
184202
initialValue={personalSettings[PERSONAL_KEYS.textSelectionPopup]}
185203
onChange={(checked) => {
@@ -221,7 +239,10 @@ const HomePersonalSettings = ({
221239
/>
222240
<PersonalFlagPanel
223241
title="Auto canvas relations"
224-
description="Automatically add discourse relations to canvas when a node is added"
242+
description={withDocsLink(
243+
"Automatically add discourse relations to canvas when a node is added",
244+
ROAM_DOCS.storedRelations,
245+
)}
225246
settingKeys={[PERSONAL_KEYS.autoCanvasRelations]}
226247
initialValue={personalSettings[PERSONAL_KEYS.autoCanvasRelations]}
227248
onChange={(checked) => {
@@ -231,7 +252,10 @@ const HomePersonalSettings = ({
231252

232253
<PersonalFlagPanel
233254
title="(BETA) Overlay in canvas"
234-
description="Whether or not to overlay discourse context information over canvas nodes."
255+
description={withDocsLink(
256+
"Whether or not to overlay discourse context information over canvas nodes.",
257+
ROAM_DOCS.discourseContextOverlay,
258+
)}
235259
settingKeys={[PERSONAL_KEYS.overlayInCanvas]}
236260
initialValue={personalSettings[PERSONAL_KEYS.overlayInCanvas]}
237261
onChange={(checked) => {

apps/roam/src/components/settings/KeyboardShortcutInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
IKeyCombo,
88
Label,
99
} from "@blueprintjs/core";
10-
import Description from "roamjs-components/components/Description";
10+
import Description from "~/components/settings/SettingsDescription";
1111
import { DISCOURSE_TOOL_SHORTCUT_KEY } from "~/data/userSettings";
1212
import { setPersonalSetting } from "~/components/settings/utils/accessors";
1313
import { comboToString } from "~/components/DiscourseNodeMenu";
@@ -18,7 +18,7 @@ type KeyboardShortcutInputProps = {
1818
settingKey: string;
1919
blockPropKey: keyof PersonalSettings;
2020
label: string;
21-
description: string;
21+
description: React.ReactNode;
2222
initialValue: IKeyCombo;
2323
placeholder?: string;
2424
};

apps/roam/src/components/settings/NodeConfig.tsx

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState, useCallback, useEffect } from "react";
22
import getDiscourseNodes, { DiscourseNode } from "~/utils/getDiscourseNodes";
33
import DualWriteBlocksPanel from "./components/EphemeralBlocksPanel";
44
import { getSubTree } from "roamjs-components/util";
5-
import Description from "roamjs-components/components/Description";
5+
import Description from "~/components/settings/SettingsDescription";
66
import {
77
Label,
88
Tabs,
@@ -39,6 +39,7 @@ import {
3939
DiscourseNodeFlagPanel,
4040
DiscourseNodeSelectPanel,
4141
} from "./components/BlockPropSettingPanels";
42+
import { ROAM_DOCS, withDocsLink } from "./utils/docs";
4243

4344
export const getCleanTagText = (tag: string): string => {
4445
return tag.replace(/^#+/, "").trim().toUpperCase();
@@ -209,7 +210,10 @@ const NodeConfig = ({
209210
<DiscourseNodeTextPanel
210211
nodeType={node.type}
211212
title="Description"
212-
description={`Describing what the ${node.text} node represents in your graph.`}
213+
description={withDocsLink(
214+
`Describing what the ${node.text} node represents in your graph.`,
215+
ROAM_DOCS.grammarNodes,
216+
)}
213217
settingKeys={[DISCOURSE_NODE_KEYS.description]}
214218
initialValue={node.description}
215219
multiline
@@ -220,7 +224,10 @@ const NodeConfig = ({
220224
<DiscourseNodeTextPanel
221225
nodeType={node.type}
222226
title="Shortcut"
223-
description={`The trigger to quickly create a ${node.text} page from the node menu.`}
227+
description={withDocsLink(
228+
`The trigger to quickly create a ${node.text} page from the node menu.`,
229+
ROAM_DOCS.creatingNodes,
230+
)}
224231
settingKeys={[DISCOURSE_NODE_KEYS.shortcut]}
225232
initialValue={node.shortcut}
226233
error={shortcutError}
@@ -233,7 +240,10 @@ const NodeConfig = ({
233240
<DiscourseNodeTextPanel
234241
nodeType={node.type}
235242
title="Tag"
236-
description={`Designate a hashtag for marking potential ${node.text}.`}
243+
description={withDocsLink(
244+
`Designate a hashtag for marking potential ${node.text}.`,
245+
ROAM_DOCS.taggingCandidateNodes,
246+
)}
237247
settingKeys={[DISCOURSE_NODE_KEYS.tag]}
238248
initialValue={node.tag}
239249
placeholder={generateTagPlaceholder(node)}
@@ -330,7 +340,10 @@ const NodeConfig = ({
330340
<DiscourseNodeTextPanel
331341
nodeType={node.type}
332342
title="Format"
333-
description={`DEPRECATED - Use specification instead. The format ${node.text} pages should have.`}
343+
description={withDocsLink(
344+
`DEPRECATED - Use specification instead. The format ${node.text} pages should have.`,
345+
ROAM_DOCS.grammarNodes,
346+
)}
334347
settingKeys={[DISCOURSE_NODE_KEYS.format]}
335348
initialValue={node.format}
336349
error={formatError}
@@ -342,9 +355,10 @@ const NodeConfig = ({
342355
<Label>
343356
Specification
344357
<Description
345-
description={
346-
"The conditions specified to identify a ${nodeText} node."
347-
}
358+
description={withDocsLink(
359+
`The conditions specified to identify a ${node.text} node.`,
360+
ROAM_DOCS.grammarNodes,
361+
)}
348362
/>
349363
<DiscourseNodeSpecification
350364
node={node}
@@ -369,7 +383,10 @@ const NodeConfig = ({
369383
<DualWriteBlocksPanel
370384
nodeType={node.type}
371385
title="Template"
372-
description={`The template that auto fills ${node.text} page when generated.`}
386+
description={withDocsLink(
387+
`The template that auto fills ${node.text} page when generated.`,
388+
ROAM_DOCS.creatingNodes,
389+
)}
373390
settingKeys={TEMPLATE_SETTING_KEYS}
374391
uid={templateUid}
375392
defaultValue={node.template}
@@ -393,7 +410,10 @@ const NodeConfig = ({
393410
<DiscourseNodeSelectPanel
394411
nodeType={node.type}
395412
title="Overlay"
396-
description="Select which attribute is used for the discourse overlay"
413+
description={withDocsLink(
414+
"Select which attribute is used for the discourse overlay",
415+
ROAM_DOCS.discourseAttributes,
416+
)}
397417
settingKeys={[DISCOURSE_NODE_KEYS.overlay]}
398418
options={attributeNode.children.map((c) => c.text)}
399419
initialValue={

apps/roam/src/components/settings/PageGroupPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useCallback } from "react";
22
import { Label, Button, Intent, Tag, InputGroup } from "@blueprintjs/core";
3-
import Description from "roamjs-components/components/Description";
3+
import Description from "~/components/settings/SettingsDescription";
44
import AutocompleteInput from "roamjs-components/components/AutocompleteInput";
55
import createBlock from "roamjs-components/writes/createBlock";
66
import deleteBlock from "roamjs-components/writes/deleteBlock";

0 commit comments

Comments
 (0)