Skip to content

Commit c4ea68f

Browse files
committed
eng-1088 delete affordance
1 parent 6c65f20 commit c4ea68f

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

apps/roam/src/components/results-view/ResultsTable.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,7 @@ export const CellEmbed = ({
174174
}, [contentRef]);
175175
return (
176176
<div className="roamjs-query-embed">
177-
<div
178-
ref={contentRef}
179-
className={!!title ? "page-embed" : "block-embed"}
180-
/>
177+
<div ref={contentRef} className={title ? "page-embed" : "block-embed"} />
181178
</div>
182179
);
183180
};
@@ -267,6 +264,15 @@ const ResultRow = ({
267264
[views],
268265
);
269266
const trRef = useRef<HTMLTableRowElement>(null);
267+
const onDelete = () => {
268+
void deleteBlock(r["relation-uid"])
269+
.catch((e) => {
270+
console.error(e);
271+
})
272+
.then(() => {
273+
onRefresh();
274+
});
275+
};
270276
return (
271277
<>
272278
<tr ref={trRef} data-uid={r.uid}>
@@ -324,6 +330,15 @@ const ResultRow = ({
324330
) : (
325331
cell(key)
326332
)}
333+
{r["relation-uid"] && (
334+
<Button
335+
minimal
336+
icon="delete"
337+
className="float-right"
338+
title="Delete relation"
339+
onClick={onDelete}
340+
></Button>
341+
)}
327342
{i < columns.length - 1 && (
328343
<div
329344
style={{

apps/roam/src/utils/getDiscourseContextResults.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import getDiscourseRelations, {
77
DiscourseRelation,
88
} from "./getDiscourseRelations";
99
import { Selection } from "./types";
10+
import { getSetting } from "~/utils/extensionSettings";
1011

1112
const resultCache: Record<string, Awaited<ReturnType<typeof fireQuery>>> = {};
1213
const CACHE_TIMEOUT = 1000 * 60 * 5;
@@ -57,6 +58,12 @@ const buildSelections = ({
5758
text: `node:${conditionUid}-Anchor`,
5859
});
5960
}
61+
if (getSetting("use-reified-relations"))
62+
selections.push({
63+
uid: window.roamAlphaAPI.util.generateUID(),
64+
label: "relation",
65+
text: `node:rel`,
66+
});
6067

6168
return selections;
6269
};

apps/roam/src/utils/registerDiscourseDatalogTranslators.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,7 @@ const registerDiscourseDatalogTranslators = () => {
818818
[
819819
{ from: source, to: source },
820820
{ from: target, to: target },
821+
{ from: "rel", to: "rel" },
821822
{ from: true, to: (v) => `${uid}-${v}` },
822823
],
823824
clauses,

0 commit comments

Comments
 (0)