Skip to content

Commit 833ce57

Browse files
authored
Merge pull request #263 from UW-Macrostrat/feedback-updates
Feedback updates
2 parents 9481f49 + ae9cf24 commit 833ce57

File tree

25 files changed

+455
-1408
lines changed

25 files changed

+455
-1408
lines changed

deps/web-components

Submodule web-components updated 79 files

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
"chalk": "^5.3.0",
4242
"http-proxy-middleware": "^3.0.3",
4343
"prettier": "^2.7.1",
44-
"react-arborist": "^3.4.0",
45-
"react-text-annotate-blend": "^1.2.0",
4644
"sass": "^1.49.0",
4745
"sass-embedded": "^1.79.1",
4846
"stylus": "^0.55.0",

pages/dev/me/+Page.client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import h from "@macrostrat/hyper";
22
import { DocumentationPage } from "~/layouts";
33
import { AuthStatus, useAuth } from "@macrostrat/auth-components";
4-
import { usePostgresQuery } from "#/integrations/xdd/extractions/lib/data-service";
4+
import { usePostgresQuery } from "#/integrations/xdd/extractions/data-service";
55

66
export function Page() {
77
return h(DocumentationPage, { title: "Login" }, [

pages/integrations/xdd/extractions/@paperId/+Page.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ import h from "@macrostrat/hyper";
33
import { ContentPage } from "~/layouts";
44
import { PageBreadcrumbs } from "~/components";
55
import { usePageContext } from "vike-react/usePageContext";
6-
import { ExtractionContext, enhanceData } from "../lib";
6+
import {
7+
ExtractionContext,
8+
enhanceData,
9+
} from "@macrostrat/feedback-components";
710
import {
811
useEntityTypeIndex,
912
useModelIndex,
1013
usePostgresQuery,
11-
} from "../lib/data-service";
14+
} from "../data-service";
15+
import { MatchedEntityLink } from "../match";
1216

1317
export function Page() {
1418
return h(ContentPage, [h(PageBreadcrumbs), h(PageMain)]);
@@ -46,6 +50,7 @@ function ExtractionIndex() {
4650
h(ExtractionContext, {
4751
data: enhanceData(d, models, entityTypes),
4852
entityTypes,
53+
matchComponent: MatchedEntityLink,
4954
}),
5055
]);
5156
}),

pages/integrations/xdd/extractions/lib/data-service.ts renamed to pages/integrations/xdd/extractions/data-service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ export function usePostgresQuery(
1616
) {
1717
const [data, setData] = useState(null);
1818

19+
useEffect(() => {
20+
console.warn("usePostgresQuery should be moved to a separate package");
21+
}, []);
22+
1923
let _filters: FilterDef[] = [];
2024
if (filters != null) {
2125
if (!Array.isArray(filters)) {

pages/integrations/xdd/extractions/lib/index.ts

Lines changed: 0 additions & 226 deletions
This file was deleted.

pages/integrations/xdd/extractions/lib/main.module.sass

Lines changed: 0 additions & 10 deletions
This file was deleted.

pages/integrations/xdd/extractions/lib/types.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import h from "@macrostrat/hyper";
2+
3+
type MacrostratMatchData = {
4+
/** Data for Macrostrat matches from the matching service */
5+
strat_name_id?: number;
6+
lith_id?: number;
7+
lith_att_id?: number;
8+
};
9+
10+
export function MatchedEntityLink({ data }: { data: MacrostratMatchData }) {
11+
if (data == null) return null;
12+
const href = buildHref(data);
13+
return h([" ", h("a.match", { href }, `#${matchID(data)}`)]);
14+
}
15+
16+
function buildHref(match) {
17+
/** Build a URL for a matched term
18+
* TODO: this is specific to Macrostrat's UI
19+
* */
20+
if (match == null) return null;
21+
22+
if (match.strat_name_id != null) {
23+
return `/lex/strat-names/${match.strat_name_id}`;
24+
}
25+
26+
if (match.lith_id != null) {
27+
return `/lex/lithologies`;
28+
}
29+
30+
if (match.lith_att_id != null) {
31+
return `/lex/lithologies`;
32+
}
33+
34+
return null;
35+
}
36+
37+
function matchID(match: MacrostratMatchData) {
38+
if (match == null) return null;
39+
40+
for (const id of ["strat_name_id", "lith_id", "lith_att_id"]) {
41+
if (match[id]) {
42+
return match[id];
43+
}
44+
}
45+
return null;
46+
}

pages/integrations/xdd/feedback/+Page.client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { FullscreenPage } from "~/layouts";
2-
import h from "./main.module.sass";
2+
import styles from "./main.module.sass";
3+
import hyper from "@macrostrat/hyper";
34
import { PageBreadcrumbs } from "~/components";
45
import { PostgRESTTableView } from "@macrostrat/data-sheet2";
56
import { postgrestPrefix } from "@macrostrat-web/settings";
67

8+
const h = hyper.styled(styles);
9+
710
export function Page() {
811
return h(FullscreenPage, { className: "main" }, [
912
h(PageBreadcrumbs),

0 commit comments

Comments
 (0)