@@ -4,7 +4,8 @@ import { Divider, AnchorButton, Tag, Card, Collapse, Icon } from "@blueprintjs/c
44import { useData } from "vike-react/useData" ;
55import { useState } from "react" ;
66import "./main.scss" ;
7- import h from "@macrostrat/hyper" ;
7+ import { hyperStyled } from "@macrostrat/hyper" ;
8+ import styles from "./index.module.sass" ;
89import {
910 MapAreaContainer ,
1011 MapMarker ,
@@ -14,7 +15,13 @@ import {
1415import { SETTINGS } from "@macrostrat-web/settings" ;
1516import mapboxgl , { LngLat } from "mapbox-gl" ;
1617import { MapPosition } from "@macrostrat/mapbox-utils" ;
17- import { useEffect } from "react" ;
18+ import { useEffect , useCallback } from "react" ;
19+ import { onDemand } from "~/_utils" ;
20+ import { navigate } from "vike/client/router" ;
21+
22+ const h = hyperStyled ( styles ) ;
23+
24+ const ColumnMap = onDemand ( ( ) => import ( "./map" ) . then ( ( mod ) => mod . ColumnMap ) ) ;
1825
1926export function Page ( props ) {
2027 return h ( ColumnListPage , props ) ;
@@ -24,6 +31,7 @@ function ColumnListPage({ title = "Columns", linkPrefix = "/" }) {
2431 const { columnGroups } = useData ( ) ;
2532 const [ columnInput , setColumnInput ] = useState ( "" ) ;
2633 const [ mapInstance , setMapInstance ] = useState < mapboxgl . Map | null > ( null ) ;
34+ const [ selectedUnitID , setSelectedUnitID ] = useState < number > ( null ) ;
2735
2836 const filteredGroups = columnGroups . filter ( ( group ) => {
2937 const name = group . name . toLowerCase ( ) ;
@@ -32,6 +40,8 @@ function ColumnListPage({ title = "Columns", linkPrefix = "/" }) {
3240 return name . includes ( input ) || columns . some ( ( col ) => col . includes ( input ) ) ;
3341 } ) ;
3442
43+ /*
44+
3545 const mapPosition: MapPosition = {
3646 camera: {
3747 lat: 39,
@@ -127,18 +137,40 @@ function ColumnListPage({ title = "Columns", linkPrefix = "/" }) {
127137 const source = mapInstance.getSource("geojson-data") as mapboxgl.GeoJSONSource;
128138 if (source) source.setData(geojson);
129139 }, [filteredGroups, mapInstance]);
140+ */
141+
130142
131143 const handleInputChange = ( event ) => {
132144 setColumnInput ( event . target . value . toLowerCase ( ) ) ;
133145 } ;
134146
147+ const onSelectColumn = useCallback (
148+ ( col_id : number ) => {
149+ // do nothing
150+ // We could probably find a more elegant way to do this
151+ setSelectedUnitID ( null ) ;
152+ navigate ( linkPrefix + `columns/${ col_id } ` , {
153+ overwriteLastHistoryEntry : true ,
154+ } ) ;
155+ } ,
156+ [ setSelectedUnitID ]
157+ ) ;
158+
135159 return h ( "div.column-list-page" , [
136160 h ( AssistantLinks , [
137161 h ( AnchorButton , { href : "/projects" , minimal : true } , "Projects" ) ,
138162 h ( DevLinkButton , { href : "/columns/correlation" } , "Correlation chart" ) ,
139163 ] ) ,
140164 h ( ContentPage , [
141165 h ( PageHeader , { title } ) ,
166+ h ( ColumnMap , {
167+ className : "column-map" ,
168+ inProcess : true ,
169+ projectID : null ,
170+ selectedColumn : null ,
171+ onSelectColumn,
172+ } ) ,
173+ /*
142174 h("div.map-section", [
143175 h("h2", "Map of Columns"),
144176 h("div.map-container",
@@ -152,6 +184,7 @@ function ColumnListPage({ title = "Columns", linkPrefix = "/" }) {
152184 )
153185 ),
154186 ]),
187+ */
155188 h ( Card , { className : "search-bar" } , [
156189 h ( Icon , { icon : "search" } ) ,
157190 h ( "input" , {
0 commit comments