Skip to content

Commit 4c996c5

Browse files
authored
Merge pull request #162 from UW-Macrostrat/info-panel
xDD and Macrostrat linked data update
2 parents 3ec08ac + d67fc40 commit 4c996c5

File tree

6 files changed

+28
-8
lines changed

6 files changed

+28
-8
lines changed

packages/map-interface/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.5.4] - 2025-07-31
8+
9+
- Nested xdd panel expansion option
10+
- Macrostrat interval links work
11+
712
## [1.5.3] - 2025-07-31
813

914
Broke apart info panel into 5 components

packages/map-interface/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@macrostrat/map-interface",
3-
"version": "1.5.3",
3+
"version": "1.5.4",
44
"description": "Map interface for Macrostrat",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",

packages/map-interface/src/location-details/location-details.stories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ComponentStory, ComponentMeta } from "@storybook/react-vite";
1+
import { ComponentMeta } from "@storybook/react-vite";
22
import h from "@macrostrat/hyper";
33
import { RegionalStratigraphy } from "./reg-strat";
44
import { Physiography } from "./physiography";
@@ -90,7 +90,7 @@ export function xddInfoExample() {
9090
return null;
9191
}
9292

93-
return h(XddExpansion, { xddInfo, expanded: true });
93+
return h(XddExpansion, { xddInfo, expanded: true, nestedExpanded: true });
9494
}
9595

9696
export function FossilsExample() {

packages/map-interface/src/location-details/macrostrat-linked.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,20 @@ function AgeInformation(props) {
5757
const { source, mapInfo, intervalURL } = props;
5858
const { macrostrat } = source;
5959

60-
if (!macrostrat?.b_age) return h(MapAgeRenderer, { mapInfo });
60+
if (!macrostrat?.b_age) return h(MapAgeRenderer, { mapInfo, intervalURL });
6161

6262
return h(MacrostratAgeInfo, { macrostrat, mapInfo, intervalURL });
6363
}
6464

6565
function MapAgeRenderer(props) {
66-
const { mapInfo, ...rest } = props;
66+
const { mapInfo, intervalURL, ...rest } = props;
6767
return h(
6868
DescribedAgeInfo,
6969
{
7070
ageElement: h(AgeChip, {
7171
b_int: mapInfo.mapData[0].b_int,
7272
t_int: mapInfo.mapData[0].t_int,
73+
intervalURL,
7374
}),
7475
},
7576
"Based on geologic map description.",

packages/map-interface/src/location-details/xdd-panel/Journal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ type JournalProps = {
2323
articles: XDDSnippet[];
2424
name: string;
2525
publisher: string;
26+
nestedExpanded?: boolean;
2627
};
2728

2829
// Still up for review
2930
function Journal_(props: JournalProps) {
30-
const { articles, name, publisher } = props;
31+
const { articles, name, publisher, nestedExpanded } = props;
3132

3233
const helpText = articles[0].pubname;
3334

@@ -36,6 +37,7 @@ function Journal_(props: JournalProps) {
3637
{
3738
title: name,
3839
helpText: publisher,
40+
expanded: nestedExpanded,
3941
},
4042
[
4143
articles.map((article, i) => {

packages/map-interface/src/location-details/xdd-panel/index.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,27 @@ export interface XDDSnippet {
1616
highlight: string[];
1717
}
1818

19-
export function XddExpansion({ xddInfo, expanded = false }) {
19+
export function XddExpansion({
20+
xddInfo,
21+
expanded = false,
22+
nestedExpanded = true,
23+
}) {
2024
return h(xDDPanelCore, {
2125
className: "regional-panel",
2226
data: xddInfo,
2327
isFetching: xddInfo == undefined || xddInfo.length === 0,
2428
expanded,
29+
nestedExpanded,
2530
});
2631
}
2732

28-
export function xDDPanelCore({ isFetching, data: xddInfo, expanded, ...rest }) {
33+
export function xDDPanelCore({
34+
isFetching,
35+
data: xddInfo,
36+
expanded,
37+
nestedExpanded,
38+
...rest
39+
}) {
2940
const groupedData = groupSnippetsByJournal(xddInfo);
3041

3142
console.log("expanded", expanded);
@@ -44,6 +55,7 @@ export function xDDPanelCore({ isFetching, data: xddInfo, expanded, ...rest }) {
4455
h.if(!isFetching && xddInfo.length > 0)([
4556
Array.from(groupedData.entries())?.map(([journal, snippets]) => {
4657
return h(Journal, {
58+
nestedExpanded,
4759
name: journal,
4860
articles: snippets,
4961
publisher: snippets[0].publisher,

0 commit comments

Comments
 (0)