Skip to content

Commit 2625e7c

Browse files
authored
Merge pull request #396 from UW-Macrostrat/column-updates
Column system updates
2 parents fa3c805 + da3b78d commit 2625e7c

File tree

17 files changed

+719
-294
lines changed

17 files changed

+719
-294
lines changed

package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@macrostrat/web",
33
"private": true,
4-
"version": "5.2.2",
4+
"version": "5.3.0",
55
"description": "Macrostrat map interface",
66
"type": "module",
77
"scripts": {
@@ -61,23 +61,23 @@
6161
"@macrostrat-web/sift": "workspace:*",
6262
"@macrostrat-web/text-toolchain": "workspace:*",
6363
"@macrostrat-web/utility-functions": "workspace:*",
64-
"@macrostrat/api-types": "^1.1.0",
65-
"@macrostrat/color-utils": "^1.1.0",
66-
"@macrostrat/column-components": "^1.1.0",
67-
"@macrostrat/column-views": "^2.1.2",
68-
"@macrostrat/data-components": "^0.2.0",
69-
"@macrostrat/data-sheet": "^2.0.2",
70-
"@macrostrat/feedback-components": "^1.1.9",
71-
"@macrostrat/form-components": "^0.2.4",
64+
"@macrostrat/api-types": "^1.1.3",
65+
"@macrostrat/color-utils": "^1.1.2",
66+
"@macrostrat/column-components": "^1.3.1",
67+
"@macrostrat/column-views": "^2.2.1",
68+
"@macrostrat/data-components": "^0.2.2",
69+
"@macrostrat/data-sheet": "^2.2.1",
70+
"@macrostrat/feedback-components": "^1.1.10",
71+
"@macrostrat/form-components": "^0.2.5",
7272
"@macrostrat/hyper": "^3.0.6",
73-
"@macrostrat/map-interface": "^1.5.6",
74-
"@macrostrat/map-styles": "^1.2.0",
75-
"@macrostrat/mapbox-react": "^2.6.0",
76-
"@macrostrat/mapbox-utils": "^1.5.0",
77-
"@macrostrat/style-system": "^0.2.1",
78-
"@macrostrat/svg-map-components": "^1.0.4",
79-
"@macrostrat/timescale": "^2.2.1",
80-
"@macrostrat/ui-components": "^4.4.5",
73+
"@macrostrat/map-interface": "^1.6.0",
74+
"@macrostrat/map-styles": "^1.2.4",
75+
"@macrostrat/mapbox-react": "^2.6.4",
76+
"@macrostrat/mapbox-utils": "^1.6.1",
77+
"@macrostrat/style-system": "^0.2.3",
78+
"@macrostrat/svg-map-components": "^1.0.6",
79+
"@macrostrat/timescale": "^2.3.0",
80+
"@macrostrat/ui-components": "^4.5.2",
8181
"@react-hook/size": "^2.1.2",
8282
"@supabase/postgrest-js": "^1.18.1",
8383
"@turf/bbox": "^6.5.0",
@@ -102,7 +102,7 @@
102102
"classnames": "^2.2.6",
103103
"compression": "^1.7.4",
104104
"cookie-parser": "^1.4.6",
105-
"cross-fetch": "^4.0.0",
105+
"cross-fetch": "^4.1.0",
106106
"d3-array": "^3.1.1",
107107
"d3-axis": "^3.0.0",
108108
"d3-format": "^3.1.0",

packages/column-builder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@supabase/postgrest-js": "^1.18.1",
2323
"@types/mapbox__mapbox-gl-draw": "^1.2.3",
2424
"axios": "^1.13.2",
25-
"cross-fetch": "^3.1.5",
25+
"cross-fetch": "^4.0.0",
2626
"mapbox-gl": "^3.0.0",
2727
"react": "^18",
2828
"react-beautiful-dnd": "^13.1.0",

packages/section-editor/src/column/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import {
99
FaciesProvider,
1010
AssetPathContext,
1111
GrainsizeLayoutProvider,
12-
GeologicPatternProvider,
13-
SymbolColumn,
1412
DivisionEditOverlay,
1513
ColumnImage,
1614
LithologyColumn,
@@ -175,7 +173,6 @@ class StratColumn extends Component {
175173
h(CoveredOverlay),
176174
h(LithologyBoxes),
177175
]),
178-
h(SymbolColumn, { left: 90, symbols: [] }),
179176
h(ColumnAxis),
180177
h(GrainsizeAxis),
181178
// Notes column
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// https://vike.dev/onBeforeRender
22

33
import { apiV2Prefix } from "@macrostrat-web/settings";
4-
import { preprocessUnits } from "@macrostrat/column-views";
54
import fetch from "cross-fetch";
65

76
import { ColumnSummary } from "#/map/map-interface/app-state/handlers/columns";
@@ -34,6 +33,8 @@ export async function data(pageContext) {
3433
{
3534
project_id,
3635
col_id,
36+
show_position: true,
37+
response: "long",
3738
},
3839
(res) => res
3940
),
@@ -75,19 +76,13 @@ async function getData(
7576
* gets around the current limitation that there's no way to request any column data
7677
* without knowing the status_code.
7778
*/
78-
let res = await getAndUnwrap(
79-
assembleURL(entity, { ...args, status_code: "active" })
80-
);
81-
let data = unwrapResponse(res);
82-
83-
if (data.length > 0) {
84-
return data;
85-
}
79+
const url = assembleURL(entity, {
80+
...args,
81+
status_code: "active,in process",
82+
});
8683

87-
let res2 = await getAndUnwrap(
88-
assembleURL(entity, { ...args, status_code: "in process" })
89-
);
90-
return unwrapResponse(res2);
84+
const res = await getAndUnwrap(url);
85+
return unwrapResponse(res);
9186
}
9287

9388
function assembleURL(
@@ -100,7 +95,7 @@ function assembleURL(
10095
}: {
10196
col_id: number;
10297
project_id: number;
103-
status_code?: "active" | "in process";
98+
status_code?: string;
10499
[key: string]: string | number;
105100
}
106101
) {
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import hyper from "@macrostrat/hyper";
2+
import { useAPIResult } from "@macrostrat/ui-components";
3+
import {
4+
BaseMeasurementsColumn,
5+
IsotopesColumn,
6+
MeasurementDataProvider,
7+
TruncatedList,
8+
} from "@macrostrat/column-views";
9+
import { apiDomain } from "@macrostrat-web/settings";
10+
import styles from "./index.module.sass";
11+
12+
const h = hyper.styled(styles);
13+
14+
function useSGPData({ col_id }) {
15+
const res = useAPIResult(
16+
apiDomain + "/api/pg/sgp_unit_matches",
17+
{
18+
col_id: `eq.${col_id}`,
19+
},
20+
(d) => d
21+
);
22+
return res;
23+
}
24+
25+
export function SGPMeasurementsColumn({ columnID }) {
26+
const data = useSGPData({ col_id: columnID });
27+
28+
if (data == null) return null;
29+
30+
return h(BaseMeasurementsColumn, {
31+
data,
32+
noteComponent: SGPSamplesNote,
33+
});
34+
}
35+
36+
function SGPSamplesNote(props) {
37+
const { note } = props;
38+
const sgp_samples = note?.data?.sgp_samples;
39+
40+
if (sgp_samples == null || sgp_samples.length === 0) return null;
41+
42+
return h(TruncatedList, {
43+
className: "sgp-samples",
44+
data: sgp_samples,
45+
itemRenderer: (p) => h("span", p.data.name),
46+
});
47+
}
48+
49+
export function StableIsotopesColumn({ columnID }) {
50+
return h(
51+
"div.isotopes-column",
52+
h(MeasurementDataProvider, { col_id: columnID }, [
53+
h(IsotopesColumn, {
54+
parameter: "D13C",
55+
label: "δ¹³C",
56+
color: "dodgeblue",
57+
domain: [-14, 6],
58+
width: 100,
59+
nTicks: 4,
60+
}),
61+
h(IsotopesColumn, {
62+
parameter: "D18O",
63+
label: "δ¹⁸O",
64+
color: "red",
65+
domain: [-40, 0],
66+
width: 100,
67+
nTicks: 4,
68+
}),
69+
])
70+
);
71+
}

pages/columns/@column/column-inspector/index.module.sass

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
max-width: 80rem
1414
margin: 0 auto
15+
gap: 1em
1516

1617

1718
.left-column
@@ -38,7 +39,7 @@
3839

3940

4041
.column-view
41-
margin: 0 4em 4em
42+
margin: 0 0 4em
4243
padding: 0
4344

4445
.column-header
@@ -109,3 +110,14 @@ rect.selection-overlay
109110
.column-map, .unit-details-panel
110111
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3)
111112
border-radius: 6px
113+
114+
115+
.column-title-row
116+
display: flex
117+
flex-direction: row
118+
align-items: baseline
119+
justify-content: space-between
120+
121+
.isotopes-column
122+
display: flex
123+
flex-direction: row

0 commit comments

Comments
 (0)