@macrostrat/map-interface 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/container.js +2 -2
- package/dist/container.js.map +1 -1
- package/dist/context-panel/index.js +2 -2
- package/dist/context-panel/index.js.map +1 -1
- package/dist/context-panel/main.module.sass.cjs +6 -1
- package/dist/context-panel/main.module.sass.cjs.map +1 -1
- package/dist/context-panel/main.module.sass.js +4 -1
- package/dist/context-panel/main.module.sass.js.map +1 -1
- package/dist/controls.js +2 -2
- package/dist/controls.js.map +1 -1
- package/dist/dev/main.module.sass.cjs +6 -1
- package/dist/dev/main.module.sass.cjs.map +1 -1
- package/dist/dev/main.module.sass.js +4 -1
- package/dist/dev/main.module.sass.js.map +1 -1
- package/dist/dev/map-page.js +2 -2
- package/dist/dev/map-page.js.map +1 -1
- package/dist/dev/vector-tile-features.cjs +3 -3
- package/dist/dev/vector-tile-features.cjs.map +1 -1
- package/dist/dev/vector-tile-features.js +3 -3
- package/dist/dev/vector-tile-features.js.map +1 -1
- package/dist/index.cjs +6 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -13
- package/dist/index.js.map +1 -1
- package/dist/location-details/fossil-collections/collections.js +2 -2
- package/dist/location-details/fossil-collections/collections.js.map +1 -1
- package/dist/location-details/fossil-collections/main.module.sass.cjs +6 -1
- package/dist/location-details/fossil-collections/main.module.sass.cjs.map +1 -1
- package/dist/location-details/fossil-collections/main.module.sass.js +4 -1
- package/dist/location-details/fossil-collections/main.module.sass.js.map +1 -1
- package/dist/location-details/index.d.ts +0 -1
- package/dist/location-details/info-blocks.cjs +0 -22
- package/dist/location-details/info-blocks.cjs.map +1 -1
- package/dist/location-details/info-blocks.js +2 -24
- package/dist/location-details/info-blocks.js.map +1 -1
- package/dist/location-details/info-blocks.module.sass.cjs +6 -1
- package/dist/location-details/info-blocks.module.sass.cjs.map +1 -1
- package/dist/location-details/info-blocks.module.sass.js +4 -1
- package/dist/location-details/info-blocks.module.sass.js.map +1 -1
- package/dist/location-details/macrostrat-linked.cjs +82 -129
- package/dist/location-details/macrostrat-linked.cjs.map +1 -1
- package/dist/location-details/macrostrat-linked.js +29 -75
- package/dist/location-details/macrostrat-linked.js.map +1 -1
- package/dist/location-details/main.module.sass.cjs +6 -1
- package/dist/location-details/main.module.sass.cjs.map +1 -1
- package/dist/location-details/main.module.sass.js +4 -1
- package/dist/location-details/main.module.sass.js.map +1 -1
- package/dist/location-details/physiography.cjs +2 -2
- package/dist/location-details/physiography.cjs.map +1 -1
- package/dist/location-details/physiography.js +1 -1
- package/dist/location-details/physiography.js.map +1 -1
- package/dist/location-details/reg-strat.cjs +2 -2
- package/dist/location-details/reg-strat.cjs.map +1 -1
- package/dist/location-details/reg-strat.js +1 -1
- package/dist/location-details/reg-strat.js.map +1 -1
- package/dist/location-panel/header.js +2 -2
- package/dist/location-panel/header.js.map +1 -1
- package/dist/location-panel/index.js +2 -2
- package/dist/location-panel/index.js.map +1 -1
- package/dist/location-panel/main.module.sass.cjs +6 -1
- package/dist/location-panel/main.module.sass.cjs.map +1 -1
- package/dist/location-panel/main.module.sass.js +4 -1
- package/dist/location-panel/main.module.sass.js.map +1 -1
- package/dist/main.module.sass.cjs +6 -1
- package/dist/main.module.sass.cjs.map +1 -1
- package/dist/main.module.sass.js +4 -1
- package/dist/main.module.sass.js.map +1 -1
- package/dist/map-interface.css +43 -215
- package/dist/map-view.js +2 -2
- package/dist/map-view.js.map +1 -1
- package/package.json +8 -8
- package/src/dev/vector-tile-features.ts +1 -1
- package/src/index.ts +0 -1
- package/src/location-details/index.ts +0 -1
- package/src/location-details/macrostrat-linked.ts +29 -81
- package/src/location-details/main.module.sass +0 -1
- package/src/location-details/physiography.ts +1 -1
- package/src/location-details/reg-strat.ts +1 -1
- package/dist/expansion-panel/headers.cjs +0 -22
- package/dist/expansion-panel/headers.cjs.map +0 -1
- package/dist/expansion-panel/headers.d.ts +0 -1
- package/dist/expansion-panel/headers.js +0 -20
- package/dist/expansion-panel/headers.js.map +0 -1
- package/dist/expansion-panel/index.cjs +0 -128
- package/dist/expansion-panel/index.cjs.map +0 -1
- package/dist/expansion-panel/index.d.ts +0 -18
- package/dist/expansion-panel/index.js +0 -125
- package/dist/expansion-panel/index.js.map +0 -1
- package/dist/expansion-panel/main.module.sass.cjs +0 -27
- package/dist/expansion-panel/main.module.sass.cjs.map +0 -1
- package/dist/expansion-panel/main.module.sass.js +0 -27
- package/dist/expansion-panel/main.module.sass.js.map +0 -1
- package/dist/location-details/fetch.d.ts +0 -4
- package/dist/location-details/utils/index.cjs +0 -15
- package/dist/location-details/utils/index.cjs.map +0 -1
- package/dist/location-details/utils/index.js +0 -15
- package/dist/location-details/utils/index.js.map +0 -1
- package/dist/location-details/xdd-panel/article.cjs +0 -64
- package/dist/location-details/xdd-panel/article.cjs.map +0 -1
- package/dist/location-details/xdd-panel/article.d.ts +0 -1
- package/dist/location-details/xdd-panel/article.js +0 -62
- package/dist/location-details/xdd-panel/article.js.map +0 -1
- package/dist/location-details/xdd-panel/index.cjs +0 -71
- package/dist/location-details/xdd-panel/index.cjs.map +0 -1
- package/dist/location-details/xdd-panel/index.d.ts +0 -18
- package/dist/location-details/xdd-panel/index.js +0 -69
- package/dist/location-details/xdd-panel/index.js.map +0 -1
- package/dist/location-details/xdd-panel/journal.cjs +0 -27
- package/dist/location-details/xdd-panel/journal.cjs.map +0 -1
- package/dist/location-details/xdd-panel/journal.d.ts +0 -20
- package/dist/location-details/xdd-panel/journal.js +0 -25
- package/dist/location-details/xdd-panel/journal.js.map +0 -1
- package/src/expansion-panel/headers.ts +0 -18
- package/src/expansion-panel/index.ts +0 -135
- package/src/expansion-panel/main.module.sass +0 -157
- package/src/location-details/fetch.ts +0 -57
- package/src/location-details/location-details.stories.ts +0 -88
- package/src/location-details/xdd-panel/article.ts +0 -67
- package/src/location-details/xdd-panel/index.ts +0 -70
- package/src/location-details/xdd-panel/journal.ts +0 -60
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
.panel-subhead
|
|
3
|
-
padding: 0 1rem
|
|
4
|
-
border: 1px solid var(--panel-rule-color)
|
|
5
|
-
border-bottom: 1px solid var(--panel-rule-color)
|
|
6
|
-
background-color: var(--accent-color)
|
|
7
|
-
display: flex
|
|
8
|
-
flex-direction: row
|
|
9
|
-
align-items: center
|
|
10
|
-
z-index: 1
|
|
11
|
-
gap: var(--panel-header-gap, 0.5rem)
|
|
12
|
-
top: -1px
|
|
13
|
-
position: sticky
|
|
14
|
-
min-height: var(--panel-header-height, 40px)
|
|
15
|
-
h1, h2, h3, h4
|
|
16
|
-
font-family: Montserrat,sans-serif
|
|
17
|
-
font-weight: 700
|
|
18
|
-
margin: 0
|
|
19
|
-
h4
|
|
20
|
-
font-weight: 600
|
|
21
|
-
.title
|
|
22
|
-
flex-grow: 1
|
|
23
|
-
|
|
24
|
-
.expansion-panel-icon
|
|
25
|
-
margin-right: -0.35em
|
|
26
|
-
|
|
27
|
-
// :global(.bp6-dark) .panel-subhead
|
|
28
|
-
// margin 0 1px
|
|
29
|
-
|
|
30
|
-
.info-panel-section
|
|
31
|
-
&>.panel-subhead
|
|
32
|
-
margin: -1px calc(var(--panel-padding-h) * -1) 0
|
|
33
|
-
|
|
34
|
-
.expansion-panel
|
|
35
|
-
padding: 0
|
|
36
|
-
flex-wrap: wrap
|
|
37
|
-
margin-top: -1px
|
|
38
|
-
// &.collapsed
|
|
39
|
-
// .expansion-panel-header
|
|
40
|
-
// border-bottom-width: 0;
|
|
41
|
-
|
|
42
|
-
.sub-expansion-panel
|
|
43
|
-
margin: -1px calc(var(--panel-padding-h) * -0.5) 0
|
|
44
|
-
overflow: hidden
|
|
45
|
-
&:first-child
|
|
46
|
-
.expansion-panel-header
|
|
47
|
-
border-top-width: 0
|
|
48
|
-
.panel-subhead
|
|
49
|
-
border-top: none
|
|
50
|
-
border-bottom: none
|
|
51
|
-
|
|
52
|
-
.expansion-panel-header
|
|
53
|
-
background-color: var(--accent-secondary-color)
|
|
54
|
-
cursor: pointer
|
|
55
|
-
padding: 0 1rem
|
|
56
|
-
|
|
57
|
-
&:hover
|
|
58
|
-
background-color: var(--accent-secondary-hover-color)
|
|
59
|
-
h2, h3, h4
|
|
60
|
-
font-weight: 500
|
|
61
|
-
border-bottom: 1px solid var(--tertiary-border-color)
|
|
62
|
-
border-top: 1px solid var(--tertiary-border-color)
|
|
63
|
-
align-items: center
|
|
64
|
-
|
|
65
|
-
.expansion-summary-title-help
|
|
66
|
-
margin-left: 5px
|
|
67
|
-
:global(.bp6-icon)
|
|
68
|
-
margin-left: 5px
|
|
69
|
-
|
|
70
|
-
.expansion-panel-header
|
|
71
|
-
cursor: pointer
|
|
72
|
-
&:hover
|
|
73
|
-
background-color: var(--accent-hover-color)
|
|
74
|
-
:global(.bp6-icon)
|
|
75
|
-
transform: translate(0,3px)
|
|
76
|
-
|
|
77
|
-
.expansion-children
|
|
78
|
-
padding: 0 1rem
|
|
79
|
-
.expansion-panel
|
|
80
|
-
margin-left: -1rem
|
|
81
|
-
margin-right: -1rem
|
|
82
|
-
&:first-child
|
|
83
|
-
margin-top: 0
|
|
84
|
-
&>:first-child
|
|
85
|
-
margin-top: 1rem
|
|
86
|
-
&>:last-child
|
|
87
|
-
margin-bottom: 1rem
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
.expansion-panel-subtext
|
|
92
|
-
font-size: 85%
|
|
93
|
-
font-weight: 400
|
|
94
|
-
|
|
95
|
-
:global
|
|
96
|
-
.expansion-panel-root
|
|
97
|
-
padding-left: 15px !important
|
|
98
|
-
|
|
99
|
-
.expansion-panel-detail
|
|
100
|
-
display: block !important
|
|
101
|
-
padding: 0 !important
|
|
102
|
-
|
|
103
|
-
.expansion-panel-detail-sub
|
|
104
|
-
display: block !important
|
|
105
|
-
|
|
106
|
-
// New expandable panel for details
|
|
107
|
-
.expandable-details-main
|
|
108
|
-
display: flex
|
|
109
|
-
flex-direction: row
|
|
110
|
-
align-items: center
|
|
111
|
-
justify-content: space-between
|
|
112
|
-
margin: 3px 0
|
|
113
|
-
|
|
114
|
-
.expandable-details-header
|
|
115
|
-
display: inline-flex
|
|
116
|
-
flex-direction: row
|
|
117
|
-
align-items: baseline
|
|
118
|
-
flex-grow: 1
|
|
119
|
-
|
|
120
|
-
.expandable-details-children
|
|
121
|
-
position: relative
|
|
122
|
-
|
|
123
|
-
.expandable-details-toggle
|
|
124
|
-
:global(.bp6-button)
|
|
125
|
-
font-size: 10px
|
|
126
|
-
|
|
127
|
-
.expandable-details
|
|
128
|
-
&.macrostrat-unit
|
|
129
|
-
.title:after
|
|
130
|
-
content: none
|
|
131
|
-
.title
|
|
132
|
-
margin-right: 1em
|
|
133
|
-
&:after
|
|
134
|
-
content: ":"
|
|
135
|
-
|
|
136
|
-
.expansion-body
|
|
137
|
-
display: inline-block
|
|
138
|
-
//flex-direction row
|
|
139
|
-
align-items: baseline
|
|
140
|
-
background-color: var(--tertiary-background)
|
|
141
|
-
padding: 2px 6px
|
|
142
|
-
border-radius: 4px
|
|
143
|
-
width: 100%
|
|
144
|
-
box-shadow: 0px 1px 2px 1px rgba(0,0,0,0.2)
|
|
145
|
-
margin-bottom: 6px
|
|
146
|
-
|
|
147
|
-
.expansion-panel-detail-header
|
|
148
|
-
font-size: 90%
|
|
149
|
-
font-style: italic
|
|
150
|
-
margin-right: 1em
|
|
151
|
-
display: inline
|
|
152
|
-
color: var(--secondary-color)
|
|
153
|
-
&:after
|
|
154
|
-
content: ":"
|
|
155
|
-
|
|
156
|
-
.expansion-panel-detail-body
|
|
157
|
-
display: inline
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { useAPIResult } from "@macrostrat/ui-components";
|
|
2
|
-
|
|
3
|
-
const apiV2Prefix = `https://dev.macrostrat.org/api/v2`;
|
|
4
|
-
const gddDomain = `https://xdd.wisc.edu`;
|
|
5
|
-
const paleobioDomain = `https://paleobiodb.org`;
|
|
6
|
-
|
|
7
|
-
export function fetchMapInfo(lng, lat, z) {
|
|
8
|
-
return useAPIResult(`${apiV2Prefix}/mobile/map_query_v2`, {
|
|
9
|
-
lng,
|
|
10
|
-
lat,
|
|
11
|
-
z,
|
|
12
|
-
})?.success?.data;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function fetchColumnInfo(lng, lat) {
|
|
16
|
-
return useAPIResult(`${apiV2Prefix}/columns`, {
|
|
17
|
-
lat,
|
|
18
|
-
lng,
|
|
19
|
-
response: "long",
|
|
20
|
-
})?.success?.data?.[0];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function fetchXddInfo(stratNames) {
|
|
24
|
-
return useAPIResult(`${gddDomain}/api/v1/snippets`, {
|
|
25
|
-
article_limit: 20,
|
|
26
|
-
term: stratNames?.map((d) => d.rank_name).join(","),
|
|
27
|
-
})?.success?.data;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function fetchFossilInfo(lng, lat) {
|
|
31
|
-
const collectionResponse = useAPIResult(
|
|
32
|
-
`${paleobioDomain}/data1.2/colls/list.json?lngmin=${lng - 0.1}&lngmax=${lng + 0.1}&latmin=${lat - 0.1}&latmax=${lat + 0.1}`,
|
|
33
|
-
)?.records;
|
|
34
|
-
|
|
35
|
-
const occurrences = useAPIResult(
|
|
36
|
-
`${paleobioDomain}/data1.2/occs/list.json?lngmin=${lng - 0.1}&lngmax=${lng + 0.1}&latmin=${lat - 0.1}&latmax=${lat + 0.1}`,
|
|
37
|
-
)?.records;
|
|
38
|
-
|
|
39
|
-
if (!collectionResponse || !occurrences) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
return collectionResponse.map((col) => {
|
|
45
|
-
col.occurrences = [];
|
|
46
|
-
occurrences.forEach((occ) => {
|
|
47
|
-
if (occ.cid === col.oid) {
|
|
48
|
-
col.occurrences.push(occ);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
return col;
|
|
52
|
-
});
|
|
53
|
-
} catch (error) {
|
|
54
|
-
console.log(error);
|
|
55
|
-
return [];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { ComponentMeta } from "@storybook/react-vite";
|
|
2
|
-
import h from "@macrostrat/hyper";
|
|
3
|
-
import { RegionalStratigraphy } from "./reg-strat";
|
|
4
|
-
import { Physiography } from "./physiography";
|
|
5
|
-
import { MacrostratLinkedData } from "./macrostrat-linked";
|
|
6
|
-
import { XddExpansion } from "./xdd-panel";
|
|
7
|
-
import {
|
|
8
|
-
fetchMapInfo,
|
|
9
|
-
fetchColumnInfo,
|
|
10
|
-
fetchXddInfo,
|
|
11
|
-
fetchFossilInfo,
|
|
12
|
-
} from "./fetch";
|
|
13
|
-
import { FossilCollections } from "./fossil-collections";
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
title: "Map interface/Location panel details",
|
|
17
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
18
|
-
args: {},
|
|
19
|
-
} as ComponentMeta<any>;
|
|
20
|
-
|
|
21
|
-
const lat = 44.60085563149249;
|
|
22
|
-
const lng = -96.16783150353609;
|
|
23
|
-
const zoom = 3.9392171056922325;
|
|
24
|
-
|
|
25
|
-
export function RegionalStratigraphyExample() {
|
|
26
|
-
const mapInfo = fetchMapInfo(lng, lat, zoom);
|
|
27
|
-
const columnInfo = fetchColumnInfo(lng, lat);
|
|
28
|
-
|
|
29
|
-
return h(RegionalStratigraphy, {
|
|
30
|
-
mapInfo,
|
|
31
|
-
columnInfo,
|
|
32
|
-
columnURL: "https://dev.macrostrat.org/columns/",
|
|
33
|
-
expanded: true,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function PhysiographyExample() {
|
|
38
|
-
const mapInfo = fetchMapInfo(lng, lat, zoom);
|
|
39
|
-
|
|
40
|
-
return h(Physiography, {
|
|
41
|
-
mapInfo,
|
|
42
|
-
expanded: true,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function MacrostratLinkedDataExample() {
|
|
47
|
-
const mapInfo = fetchMapInfo(lng, lat, zoom);
|
|
48
|
-
|
|
49
|
-
const source =
|
|
50
|
-
mapInfo && mapInfo?.mapData && mapInfo?.mapData.length
|
|
51
|
-
? mapInfo?.mapData[0]
|
|
52
|
-
: {
|
|
53
|
-
name: null,
|
|
54
|
-
descrip: null,
|
|
55
|
-
comments: null,
|
|
56
|
-
liths: [],
|
|
57
|
-
b_int: {},
|
|
58
|
-
t_int: {},
|
|
59
|
-
ref: {},
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
return h(MacrostratLinkedData, {
|
|
63
|
-
mapInfo,
|
|
64
|
-
source,
|
|
65
|
-
stratNameURL: "https://dev.macrostrat.org/lex/strat-names",
|
|
66
|
-
environmentURL: "https://dev.macrostrat.org/lex/environments",
|
|
67
|
-
intervalURL: "https://dev.macrostrat.org/lex/intervals",
|
|
68
|
-
lithologyURL: "https://dev.macrostrat.org/lex/lithologies",
|
|
69
|
-
expanded: true,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function xddInfoExample() {
|
|
74
|
-
const mapInfo = fetchMapInfo(lng, lat, zoom);
|
|
75
|
-
const xddInfo = fetchXddInfo(mapInfo?.mapData?.[0]?.macrostrat?.strat_names);
|
|
76
|
-
|
|
77
|
-
if (!xddInfo) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return h(XddExpansion, { xddInfo, expanded: true, nestedExpanded: true });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function FossilsExample() {
|
|
85
|
-
const fossilInfo = fetchFossilInfo(-89.3938453, 43.0735407);
|
|
86
|
-
|
|
87
|
-
return h(FossilCollections, { data: fossilInfo, expanded: true });
|
|
88
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { Collapse, Button } from "@blueprintjs/core";
|
|
3
|
-
import { AuthorList } from "@macrostrat/ui-components";
|
|
4
|
-
import h from "@macrostrat/hyper";
|
|
5
|
-
|
|
6
|
-
export function Article(props) {
|
|
7
|
-
const [expanded, setExpanded] = useState(false);
|
|
8
|
-
const { data } = props;
|
|
9
|
-
|
|
10
|
-
const toggleExpand = () => {
|
|
11
|
-
setExpanded(!expanded);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// Attempt to pull out only the year and not the whole date
|
|
15
|
-
let year;
|
|
16
|
-
try {
|
|
17
|
-
year = data.coverDate ? data.coverDate.match(/\d{4}/)[0] : "";
|
|
18
|
-
} catch (e) {
|
|
19
|
-
year = "";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const authors = data?.authors?.split("; ") ?? [];
|
|
23
|
-
|
|
24
|
-
const authorList =
|
|
25
|
-
authors.length > 0 ? h(AuthorList, { names: authors }) : "Unknown";
|
|
26
|
-
|
|
27
|
-
const iconName = expanded ? "chevron-up" : "chevron-down";
|
|
28
|
-
|
|
29
|
-
return h("div.article", [
|
|
30
|
-
h("div.article-title", [
|
|
31
|
-
h("p.article-author", [authorList, year.length ? ` ${year}. ` : ""]),
|
|
32
|
-
h(
|
|
33
|
-
"a.title-link",
|
|
34
|
-
{ href: data.URL, target: "_blank" },
|
|
35
|
-
h("strong", [data.title + "."]),
|
|
36
|
-
),
|
|
37
|
-
h(
|
|
38
|
-
"span",
|
|
39
|
-
{},
|
|
40
|
-
h(Button, {
|
|
41
|
-
onClick: toggleExpand,
|
|
42
|
-
minimal: true,
|
|
43
|
-
rightIcon: iconName,
|
|
44
|
-
className: "flat-btn",
|
|
45
|
-
}),
|
|
46
|
-
),
|
|
47
|
-
]),
|
|
48
|
-
h(
|
|
49
|
-
Collapse,
|
|
50
|
-
{ isOpen: expanded },
|
|
51
|
-
h(
|
|
52
|
-
"span",
|
|
53
|
-
{ className: expanded ? "" : "hidden" },
|
|
54
|
-
h(
|
|
55
|
-
"div.quotes",
|
|
56
|
-
{},
|
|
57
|
-
data.highlight.map((snippet, si) =>
|
|
58
|
-
h("p.gdd-snippet", {
|
|
59
|
-
key: si,
|
|
60
|
-
dangerouslySetInnerHTML: { __html: `...${snippet}...` },
|
|
61
|
-
}),
|
|
62
|
-
),
|
|
63
|
-
),
|
|
64
|
-
),
|
|
65
|
-
),
|
|
66
|
-
]);
|
|
67
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Spinner } from "@blueprintjs/core";
|
|
2
|
-
import h from "@macrostrat/hyper";
|
|
3
|
-
import { XDDSnippet, JournalLegacy } from "./journal";
|
|
4
|
-
import { ExpansionPanel } from "@macrostrat/map-interface";
|
|
5
|
-
|
|
6
|
-
export function XddExpansion({
|
|
7
|
-
xddInfo,
|
|
8
|
-
expanded = false,
|
|
9
|
-
nestedExpanded = true,
|
|
10
|
-
}) {
|
|
11
|
-
return h(xDDPanelCore, {
|
|
12
|
-
className: "regional-panel",
|
|
13
|
-
data: xddInfo,
|
|
14
|
-
isFetching: xddInfo == undefined || xddInfo.length === 0,
|
|
15
|
-
expanded,
|
|
16
|
-
nestedExpanded,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function xDDPanelCore({
|
|
21
|
-
isFetching,
|
|
22
|
-
data: xddInfo,
|
|
23
|
-
expanded,
|
|
24
|
-
nestedExpanded,
|
|
25
|
-
...rest
|
|
26
|
-
}) {
|
|
27
|
-
const groupedData = groupSnippetsByJournal(xddInfo);
|
|
28
|
-
|
|
29
|
-
return h(
|
|
30
|
-
ExpansionPanel,
|
|
31
|
-
{
|
|
32
|
-
className: "regional-panel",
|
|
33
|
-
title: "Primary literature",
|
|
34
|
-
helpText: "via xDD",
|
|
35
|
-
...rest,
|
|
36
|
-
expanded,
|
|
37
|
-
},
|
|
38
|
-
[
|
|
39
|
-
h.if(isFetching)(Spinner),
|
|
40
|
-
h.if(!isFetching && xddInfo.length > 0)([
|
|
41
|
-
Array.from(groupedData.entries())?.map(([journal, snippets]) => {
|
|
42
|
-
return h(JournalLegacy, {
|
|
43
|
-
nestedExpanded,
|
|
44
|
-
name: journal,
|
|
45
|
-
articles: snippets,
|
|
46
|
-
publisher: snippets[0].publisher,
|
|
47
|
-
key: journal,
|
|
48
|
-
});
|
|
49
|
-
}),
|
|
50
|
-
]),
|
|
51
|
-
],
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function groupSnippetsByJournal(
|
|
56
|
-
snippets: XDDSnippet[],
|
|
57
|
-
): Map<string, XDDSnippet[]> {
|
|
58
|
-
const journals = new Map<string, XDDSnippet[]>();
|
|
59
|
-
if (!snippets || snippets.length === 0) {
|
|
60
|
-
return journals;
|
|
61
|
-
}
|
|
62
|
-
for (let snippet of snippets) {
|
|
63
|
-
const { pubname: journal } = snippet;
|
|
64
|
-
if (!journals.has(journal)) {
|
|
65
|
-
journals.set(journal, []);
|
|
66
|
-
}
|
|
67
|
-
journals.get(journal).push(snippet);
|
|
68
|
-
}
|
|
69
|
-
return journals;
|
|
70
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Article } from "./article";
|
|
2
|
-
import { Divider } from "@blueprintjs/core";
|
|
3
|
-
import h from "@macrostrat/hyper";
|
|
4
|
-
import { SubExpansionPanel } from "@macrostrat/map-interface";
|
|
5
|
-
|
|
6
|
-
export interface XDDSnippet {
|
|
7
|
-
pubname: string;
|
|
8
|
-
publisher: string;
|
|
9
|
-
_gddid: string;
|
|
10
|
-
title: string;
|
|
11
|
-
doi: string;
|
|
12
|
-
coverDate: string;
|
|
13
|
-
URL: string;
|
|
14
|
-
authors: string;
|
|
15
|
-
hits: number;
|
|
16
|
-
highlight: string[];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function Journal(props) {
|
|
20
|
-
return h("div.journal", [
|
|
21
|
-
h("div.journal-title", [
|
|
22
|
-
h("h2.journal-title-text", [
|
|
23
|
-
props.data.name,
|
|
24
|
-
h("small.journal-source", [props.data]),
|
|
25
|
-
]),
|
|
26
|
-
]),
|
|
27
|
-
h(Divider),
|
|
28
|
-
props.data.articles.map((article, i) => {
|
|
29
|
-
return h(Article, { key: i, data: article });
|
|
30
|
-
}),
|
|
31
|
-
]);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
type JournalProps = {
|
|
35
|
-
articles: XDDSnippet[];
|
|
36
|
-
name: string;
|
|
37
|
-
publisher: string;
|
|
38
|
-
nestedExpanded?: boolean;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// Still up for review
|
|
42
|
-
export function JournalLegacy(props: JournalProps) {
|
|
43
|
-
const { articles, name, publisher, nestedExpanded } = props;
|
|
44
|
-
|
|
45
|
-
const helpText = articles[0].pubname;
|
|
46
|
-
|
|
47
|
-
return h(
|
|
48
|
-
SubExpansionPanel,
|
|
49
|
-
{
|
|
50
|
-
title: name,
|
|
51
|
-
helpText: publisher,
|
|
52
|
-
expanded: nestedExpanded,
|
|
53
|
-
},
|
|
54
|
-
[
|
|
55
|
-
articles.map((article, i) => {
|
|
56
|
-
return h(Article, { key: i, data: article });
|
|
57
|
-
}),
|
|
58
|
-
],
|
|
59
|
-
);
|
|
60
|
-
}
|