Skip to content

Commit

Permalink
Merge branch 'rgeom-improvements'
Browse files Browse the repository at this point in the history
* rgeom-improvements:
  Improved feature listing
  • Loading branch information
davenquinn committed Jul 20, 2024
2 parents d5e0e5b + 3789f63 commit b11c0df
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion src/pages/dev/sources/+Page.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import {
FeaturePanel,
FeatureSelectionHandler,
} from "@macrostrat/map-interface";
import { NonIdealState } from "@blueprintjs/core";
import { LinkItem } from "~/pages/map/dev/map-layers";
import { Link } from "~/components";

export function Page() {
const dark = useDarkMode();
Expand Down Expand Up @@ -90,7 +93,7 @@ export function Page() {
},
position: inspectPosition,
},
[h(FeaturePanel, { features: data })]
h(MapInspectorPanel, { features: data })
);
}

Expand Down Expand Up @@ -134,3 +137,34 @@ export function Page() {
)
);
}

function MapInspectorPanel({ features }) {
let maps = features
?.filter((d) => d.source == "rgeom")
?.map((d) => d.properties);

maps?.sort((a, b) => a.source_id - b.source_id);

if (maps == null || maps.length == 0) {
return h(NonIdealState, { icon: "map", title: "No maps found" });
}

return h("div", [
h("h2", "Maps"),
h(
"ul",
maps.map((d) => h(MapItem, { map: d }))
),
]);
}

function MapItem({ map }) {
return h(
"li",
h(Link, { href: `/maps/${map.source_id}` }, [
h("span.name", map.name),
" ",
h("code.id", map.source_id),
])
);
}

0 comments on commit b11c0df

Please sign in to comment.