@@ -4,11 +4,12 @@ import 'mapbox-gl/dist/mapbox-gl.css';
44import { BlankImage , Footer , getProfilePicUrl , getImageUrl , Comments } from "~/components/general" ;
55import { Icon , Divider , H2 } from "@blueprintjs/core" ;
66import h from "./main.module.sass" ;
7- import { SETTINGS } from "@macrostrat-web/settings" ;
7+ import { rockdApiOldURL , SETTINGS } from "@macrostrat-web/settings" ;
88import "@macrostrat/style-system" ;
99import { Overlay2 } from "@blueprintjs/core" ;
1010import { LithologyList } from "@macrostrat/data-components" ;
1111import { ClientOnly } from "vike-react/ClientOnly" ;
12+ import { macrostratApiURL } from "@macrostrat-web/settings" ;
1213
1314function Map ( props ) {
1415 return h (
@@ -172,22 +173,30 @@ function observationFooter(observation) {
172173 return `#${ red } ${ green } ${ blue } ` ;
173174 }
174175
175- let obsAge = observation . age_est ? observation . age_est . name + " (" + observation . age_est . b_age + " - " + observation ?. age_est ?. t_age + ")" : null ;
176-
177176 let lithologies = [ ] ;
178177 rocks . liths ?. forEach ( lith => {
179178 if ( ! lith . color . includes ( "#" ) ) {
180179 lithologies . push ( {
181- name : lith . name ,
182- color : rgbaStringToHex ( lith . color ) } ) ;
180+ ...lith ,
181+ color : rgbaStringToHex ( lith . color ) ,
182+ } ) ;
183183 } else {
184184 lithologies . push ( lith ) ;
185185 }
186186 } ) ;
187187
188+ if ( rocks . interval ?. name ) {
189+ lithologies . push ( {
190+ name : rocks . interval . name ,
191+ int_id : rocks . interval . int_id ,
192+ color : `rgba(${ rocks . interval . color } )` ,
193+ } )
194+ }
195+
188196 if ( rocks . strat_name ?. strat_name_long ) {
189197 lithologies . push ( {
190198 name : rocks . strat_name ?. strat_name_long ,
199+ strat_id : rocks . strat_name ?. strat_name_id
191200 } )
192201 }
193202
@@ -197,16 +206,6 @@ function observationFooter(observation) {
197206 } )
198207 }
199208
200- if ( obsAge ) {
201- lithologies . push ( {
202- name : obsAge
203- } )
204- }
205- if ( rocks . interval ?. name ) {
206- lithologies . push ( {
207- name : rocks . interval . name
208- } )
209- }
210209 if ( observation . orientation . feature ?. name ) {
211210 lithologies . push ( {
212211 name : observation . orientation . feature ?. name
@@ -215,14 +214,26 @@ function observationFooter(observation) {
215214
216215 const show = lithologies . length > 0 || rocks ?. notes ?. length > 0 && observation . lat && rocks . strat_name ?. strat_name_long ;
217216
217+ const handleClick = ( e , data ) => {
218+ if ( data . int_id ) {
219+ window . open ( macrostratApiURL + `/lex/intervals/${ data . int_id } ` , '_blank' ) ;
220+ }
221+ if ( data . strat_id ) {
222+ window . open ( macrostratApiURL + `/lex/strat-names/${ data . strat_id } ` , '_blank' ) ;
223+ }
224+ if ( data . lith_id ) {
225+ window . open ( macrostratApiURL + `/lex/lithology/${ data . lith_id } ` , '_blank' ) ;
226+ }
227+ } ;
228+
218229 // observation body
219230 return h . if ( show ) ( "div" , { className : 'observation-body' } , [
220231 observation . lat && rocks . strat_name ?. strat_name_long ? h ( 'h4' , { className : 'observation-header' } , [
221232 rocks . strat_name ?. strat_name_long ,
222233 observation . lat ? LngLatCoords ( LngLatProps ) : null ,
223234 ] ) : null ,
224235 h ( 'div' , { className : 'observation-details' } , [
225- h ( LithologyList , { lithologies } ) ,
236+ h ( LithologyList , { lithologies, onClickItem : handleClick } ) ,
226237 h ( 'p' , { className : "notes" } , rocks . notes ) ,
227238 ] ) ,
228239 ] ) ;
0 commit comments