Skip to content

Commit 2ee8e00

Browse files
authored
Merge pull request #156 from UW-Macrostrat/feedback
Feedback update to 1.1.7
2 parents b55d794 + 9076f3f commit 2ee8e00

File tree

7 files changed

+47
-10
lines changed

7 files changed

+47
-10
lines changed

packages/feedback-components/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format
44
is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
55
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.1.7]
8+
9+
- Can't select tree in view only mode
10+
- View matches on hover in view only mode
11+
712
## [1.1.6] - 2025-07-24
813

914
- Fix view and match glitches

packages/feedback-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@macrostrat/feedback-components",
3-
"version": "1.1.6",
3+
"version": "1.1.7",
44
"description": "",
55
"source": "src/index.ts",
66
"type": "module",

packages/feedback-components/src/feedback/feedback.module.sass

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,6 @@ mark
167167

168168
.close-btn
169169
cursor: pointer
170+
171+
.match-link
172+
padding: .5em

packages/feedback-components/src/feedback/index.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export function FeedbackComponent({
146146
width,
147147
height,
148148
matchComponent,
149+
viewOnly,
149150
}),
150151
h.if(state.viewMode == "graph")(GraphView, {
151152
tree,
@@ -305,8 +306,15 @@ function countNodes(tree) {
305306
}
306307

307308
function ManagedSelectionTree(props) {
308-
const { selectedNodes, dispatch, tree, height, width, matchComponent } =
309-
props;
309+
const {
310+
selectedNodes,
311+
dispatch,
312+
tree,
313+
height,
314+
width,
315+
matchComponent,
316+
viewOnly,
317+
} = props;
310318

311319
const ref = useRef<TreeApi<TreeData>>();
312320
// Use a ref to track clicks (won't cause rerender)
@@ -402,6 +410,7 @@ function ManagedSelectionTree(props) {
402410
onSelect: handleSelect,
403411
children: _Node,
404412
idAccessor(d) {
413+
if (viewOnly) return -1;
405414
return d.id.toString();
406415
},
407416
}),

packages/feedback-components/src/feedback/matches.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ interface MatchTagProps {
178178
setPayload?: (payload: Record<string, any>) => void;
179179
}
180180

181-
function MatchTag({ data, matchLinks, setPayload }: MatchTagProps) {
181+
export function MatchTag({ data, matchLinks, setPayload }: MatchTagProps) {
182182
if (!data || Object.keys(data).length === 0) return;
183183

184184
if (data.lith_id || data?.type === "lith") {

packages/feedback-components/src/feedback/text-visualizer.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import hyper from "@macrostrat/hyper";
66
import { buildHighlights, getTagStyle } from "../extractions";
77
import { Highlight } from "../extractions/types";
88
import { useEffect, useRef } from "react";
9-
import { Icon } from "@blueprintjs/core";
10-
import { DataField, JSONView } from "@macrostrat/ui-components";
11-
import { LithologyList, LithologyTag } from "@macrostrat/data-components";
9+
import { Popover } from "@blueprintjs/core";
10+
import { MatchTag } from "./matches";
11+
import { data } from "packages/feedback-components/stories/test-data";
1212

1313
const h = hyper.styled(styles);
1414

@@ -284,7 +284,7 @@ function renderNode(
284284
zIndex: parentSelected ? -1 : 1,
285285
border:
286286
"1px solid " +
287-
(match != undefined && matchLinks && !viewOnly
287+
(match != undefined && matchLinks
288288
? "orange"
289289
: showBorder
290290
? tag.color
@@ -306,13 +306,13 @@ function renderNode(
306306
}
307307
}
308308

309-
return h(
309+
const tagComponent = h(
310310
"span",
311311
{
312312
onMouseEnter: (e: MouseEvent) => {
313313
e.stopPropagation();
314314
},
315-
className: "highlight" + (!viewOnly ? " clickable" : ""),
315+
className: "highlight" + (!viewOnly || match ? " clickable" : ""),
316316
style,
317317
onClick: (e: MouseEvent) => {
318318
e.stopPropagation();
@@ -356,6 +356,19 @@ function renderNode(
356356
),
357357
),
358358
);
359+
360+
if (viewOnly && match) {
361+
return h(
362+
Popover,
363+
{
364+
content: h("div.match-link", h(MatchTag, { data: match, matchLinks })),
365+
interactionKind: "hover",
366+
},
367+
tagComponent,
368+
);
369+
}
370+
371+
return tagComponent;
359372
}
360373

361374
export function HighlightedText(props: {

packages/feedback-components/stories/feedback.stories.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ export const ViewOnly: StoryObj<{}> = {
6767
types: entityTypes,
6868
allowOverlap: false,
6969
view: true,
70+
matchLinks: {
71+
lithology: `${lexURL}/lithology`,
72+
strat_name: `${lexURL}/strat-names`,
73+
lith_att: `${lexURL}/lith-atts`,
74+
concept: `${lexURL}/strat-name-concepts`,
75+
interval: `${lexURL}/intervals`,
76+
},
7077
},
7178
};
7279

0 commit comments

Comments
 (0)