Skip to content

Commit 71c03e7

Browse files
authored
ENG-890 | ENG-891 - Ship pre populated tags and adjust tag placeholder (#460)
* Add default tags for Claim and Evidence nodes in defaultDiscourseNodes.ts * Add generateTagPlaceholder function to create dynamic tag placeholders for nodes in NodeConfig component in the format of abc-candidate * missed #
1 parent d091583 commit 71c03e7

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,19 @@ const useDebouncedRoamUpdater = <
141141
return { value, handleChange, handleBlur };
142142
};
143143

144+
const generateTagPlaceholder = (node: DiscourseNode): string => {
145+
// Extract first reference from format like [[CLM]], [[QUE]], [[EVD]]
146+
const referenceMatch = node.format.match(/\[\[([A-Z]+)\]\]/);
147+
148+
if (referenceMatch) {
149+
const reference = referenceMatch[1].toLowerCase();
150+
return `#${reference.slice(0, 3)}-candidate`; // [[EVD]] - {content} = #evd-candidate
151+
}
152+
153+
const nodeTextPrefix = node.text.toLowerCase().slice(0, 3);
154+
return `#${nodeTextPrefix}-candidate`; // Evidence = #evi-candidate
155+
};
156+
144157
const NodeConfig = ({
145158
node,
146159
onloadArgs,
@@ -288,7 +301,7 @@ const NodeConfig = ({
288301
onChange={handleTagChange}
289302
onBlur={handleTagBlur}
290303
error={tagError}
291-
placeholder={`#${node.text.toLowerCase()}`}
304+
placeholder={generateTagPlaceholder(node)}
292305
/>
293306
</div>
294307
}

apps/roam/src/data/defaultDiscourseNodes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const INITIAL_NODE_VALUES: Partial<DiscourseNode>[] = [
66
format: "[[CLM]] - {content}",
77
text: "Claim",
88
shortcut: "C",
9+
tag: "#clm-candidate",
910
graphOverview: true,
1011
canvasSettings: {
1112
color: "7DA13E",
@@ -26,6 +27,7 @@ const INITIAL_NODE_VALUES: Partial<DiscourseNode>[] = [
2627
format: "[[EVD]] - {content} - {Source}",
2728
text: "Evidence",
2829
shortcut: "E",
30+
tag: "#evd-candidate",
2931
graphOverview: true,
3032
canvasSettings: {
3133
color: "DB134A",

0 commit comments

Comments
 (0)