Skip to content

Commit 6b3bbfb

Browse files
authored
Merge pull request #317 from UW-Macrostrat/new-npm
New web-components
2 parents a5c70d5 + f58ccbb commit 6b3bbfb

File tree

15 files changed

+650
-456
lines changed

15 files changed

+650
-456
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@
6666
"@macrostrat/api-types": "^1.1.0",
6767
"@macrostrat/color-utils": "^1.1.0",
6868
"@macrostrat/column-components": "^1.1.0",
69-
"@macrostrat/column-views": "^2.0.1",
70-
"@macrostrat/data-components": "^0.1.0",
69+
"@macrostrat/column-views": "^2.1.1",
70+
"@macrostrat/data-components": "^0.2.0",
7171
"@macrostrat/data-sheet": "^2.0.2",
72-
"@macrostrat/feedback-components": "^1.0.1",
72+
"@macrostrat/feedback-components": "^1.1.0",
7373
"@macrostrat/form-components": "^0.2.1",
7474
"@macrostrat/hyper": "^3.0.6",
7575
"@macrostrat/map-interface": "^1.3.0",
@@ -78,8 +78,8 @@
7878
"@macrostrat/mapbox-utils": "^1.5.0",
7979
"@macrostrat/style-system": "^0.2.1",
8080
"@macrostrat/svg-map-components": "^1.0.4",
81-
"@macrostrat/timescale": "^2.1.1",
82-
"@macrostrat/ui-components": "^4.1.2",
81+
"@macrostrat/timescale": "^2.2.0",
82+
"@macrostrat/ui-components": "^4.3.0",
8383
"@react-hook/size": "^2.1.2",
8484
"@supabase/postgrest-js": "^1.18.1",
8585
"@turf/bbox": "^6.5.0",

pages/columns/@column/column-inspector/modal-panel.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,24 @@ export function ModalUnitPanel(props) {
5656
onSelectUnit,
5757
columnUnits: unitData,
5858
features,
59-
onClickItem: (unit) => {
60-
console.log("Clicked unit:", unit);
59+
onClickItem: (e, unit) => {
60+
if(unit?.lith_id) {
61+
window.open('/lex/lithology/' + unit.lith_id, '_blank');
62+
}
63+
64+
if(unit?.environ_id) {
65+
window.open('/lex/environments/' + unit.environ_id, '_blank');
66+
}
67+
68+
if(e?.data?.int_id) { // fix when new we components release is out
69+
window.open('/lex/intervals/' + e.data.int_id, '_blank');
70+
}
71+
72+
/* // implement when new web components release is out
73+
if(unit?.strat_name_id) {
74+
window.open('/lex/strat-names/' + unit.strat_name_id, '_blank');
75+
}
76+
*/
6177
},
6278
});
6379
}

pages/columns/map.client.ts

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
import h from "@macrostrat/hyper";
66
import { mapboxAccessToken } from "@macrostrat-web/settings";
77
import { ErrorBoundary } from "@macrostrat/ui-components";
8-
import { ColumnsMap } from "~/columns-map/index.client";
98

109
export function ColumnsMapContainer(props) {
1110
/* TODO: integrate this with shared web components */
@@ -14,39 +13,25 @@ export function ColumnsMapContainer(props) {
1413

1514
function ColumnsMapInner({ columnIDs = null, projectID = null, className }) {
1615
const columnData = useMacrostratColumns(projectID, projectID != null);
16+
console.log("columnData", columnData);
1717

18-
let columns = columnData;
19-
20-
// Filter columns on the client side
21-
if (columnIDs != null) {
22-
columns = columns.filter((feature) =>
23-
columnIDs.includes(feature.properties.col_id)
24-
);
18+
if(!columnData) {
19+
return h("div", { className }, "Loading map...");
2520
}
2621

2722
return h(
2823
"div",
2924
{ className },
30-
h(ColumnsMap, { columns: { type: "FeatureCollection", features: columns } })
31-
);
32-
}
33-
34-
export function ColumnsMapOld({
35-
projectID,
36-
inProcess,
37-
className,
38-
selectedColumn,
39-
onSelectColumn,
40-
}) {
41-
return h(
42-
ErrorBoundary,
43-
h(ColumnNavigationMap, {
44-
className,
45-
inProcess,
46-
projectID,
25+
h(ColumnNavigationMap, {
26+
style: { height: "100%" },
4727
accessToken: mapboxAccessToken,
48-
selectedColumn,
49-
onSelectColumn,
50-
})
28+
columns: columnData,
29+
columnIDs,
30+
onSelectColumn: (col) => {
31+
if (col) {
32+
window.open(`/columns/${col}`, "_blank");
33+
}
34+
}
35+
}),
5136
);
52-
}
37+
}

pages/dev/concepts/carbon-isotopes/+Page.ts

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

pages/dev/concepts/carbon-isotopes/main.styl

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

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import h from "@macrostrat/hyper";
2+
import { IntervalTag } from "@macrostrat/column-views";
3+
import { mapboxAccessToken } from "@macrostrat-web/settings";
4+
import { useAPIResult } from "@macrostrat/ui-components";
5+
import { LithologyTag } from "@macrostrat/data-components";
6+
import { data } from "#/+data";
7+
8+
export function Page() {
9+
return h(LithologyTag, {
10+
data: {
11+
id: 1,
12+
name: "Sandstone",
13+
lith_id: 1,
14+
color: "#d2b48c", // Example color
15+
},
16+
onClick: (e, d) => {
17+
console.log("Clicked item", d);
18+
}
19+
})
20+
}

pages/lex/economics/+Page.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,33 +59,21 @@ function EconItem({ data }) {
5959
const luminance = 0.9;
6060
const chromaColor = asChromaColor(color);
6161

62-
return h(
63-
Popover,
64-
{
65-
className: "econ-item-popover",
66-
content: h("div.econ-tooltip", [
67-
h("div.econ-tooltip-id", "ID - #" + econ_id),
68-
h("div.econ-tooltip-t-unit", "Time Units - " + t_units),
69-
h(
70-
"a",
71-
{ href: `/lex/economics/${econ_id}`, className: "econ-tooltip-link" },
72-
"View details"
73-
),
74-
]),
75-
},
76-
h("div.econ-item", [
62+
return h("div.econ-item", [
7763
h(
7864
"div.econ-name",
7965
{
8066
style: {
8167
color: chromaColor?.luminance(luminance).hex(),
8268
backgroundColor: chromaColor?.luminance(1 - luminance).hex(),
8369
},
70+
onClick: (e) => {
71+
window.open(`/lex/economics/${econ_id}`, "_blank");
72+
},
8473
},
8574
name
8675
),
8776
])
88-
);
8977
}
9078

9179
function groupByClassThenType(items) {

pages/lex/economics/main.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ h2 {
2828
padding: 2px 6px;
2929
margin: 0.2em 0;
3030
border-radius: 0.2em;
31+
cursor: pointer;
3132
}
3233
}
3334
}

pages/lex/environments/+Page.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ContentPage } from "~/layouts";
66
import { asChromaColor } from "@macrostrat/color-utils";
77
import { useData } from "vike-react/useData";
88
import { SearchBar } from "~/components/general";
9+
import { LithologyTag } from "@macrostrat/data-components";
910

1011
export function Page() {
1112
const [input, setInput] = useState("");
@@ -63,29 +64,21 @@ function EnvironmentItem({ data }) {
6364

6465
const luminance = 0.9;
6566

66-
return h(
67-
Popover,
68-
{
69-
className: "environ-item-popover",
70-
content: h("div.environ-tooltip", [
71-
h("div.environ-tooltip-id", "ID - #" + environ_id),
72-
h("div.environ-tooltip-t-unit", "Time Units - " + t_units),
73-
h("a", { href: `/lex/environments/${environ_id}` }, "View details"),
74-
]),
75-
},
76-
h("div.environ-item", [
67+
return h("div.environ-item", [
7768
h(
7869
"div.environ-name",
7970
{
8071
style: {
8172
backgroundColor: chromaColor?.luminance(1 - luminance).hex(),
8273
color: chromaColor?.luminance(luminance).hex(),
8374
},
75+
onClick: (e) => {
76+
window.open(`/lex/environments/${environ_id}`, "_blank");
77+
},
8478
},
8579
name
8680
),
87-
])
88-
);
81+
]);
8982
}
9083

9184
function groupByClassThenType(items) {

pages/lex/environments/main.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ h2 {
3434
padding: 2px 6px;
3535
margin: 0.2em 0;
3636
border-radius: 0.2em;
37+
cursor: pointer;
3738
}
3839
}
3940
}

0 commit comments

Comments
 (0)