Skip to content

Commit 2a5528a

Browse files
committed
UI changes to add submission
1 parent 22c81ee commit 2a5528a

File tree

5 files changed

+235
-95
lines changed

5 files changed

+235
-95
lines changed

src/pages/maps/@id/edit/components/cell/interval-selection.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Button, MenuItem} from "@blueprintjs/core";
2-
import { Select, ItemRenderer, ItemPredicate } from "@blueprintjs/select";
2+
import { Select2, ItemRenderer, ItemPredicate } from "@blueprintjs/select";
33
import {EditableCell2Props, EditableCell2, Cell} from "@blueprintjs/table";
44
import React, {useEffect, useMemo} from "react";
55

@@ -33,7 +33,7 @@ const IntervalOption: ItemRenderer<Interval> = (interval: Interval, { handleClic
3333

3434
if (interval == null) {
3535
return h(MenuItem, {
36-
shouldDismissPopover: false,
36+
shouldDismissPopover: true,
3737
active: modifiers.active,
3838
disabled: modifiers.disabled,
3939
key: "",
@@ -47,7 +47,7 @@ const IntervalOption: ItemRenderer<Interval> = (interval: Interval, { handleClic
4747

4848
return h(MenuItem, {
4949
style: {backgroundColor: interval.color},
50-
shouldDismissPopover: false,
50+
shouldDismissPopover: true,
5151
active: modifiers.active,
5252
disabled: modifiers.disabled,
5353
key: interval.int_id,
@@ -74,12 +74,14 @@ const IntervalSelection = ({value, onConfirm, intent, ...props} : EditableCell2P
7474
}
7575

7676
const interval = useMemo(() => {
77-
if(intervalValues.length == 0){
78-
return null
79-
} else {
80-
return intervalValues.filter((interval) => interval.int_id == parseInt(localValue))[0]
77+
78+
let interval = null
79+
if(intervalValues.length != 0){
80+
interval = intervalValues.filter((interval) => interval.int_id == parseInt(value))[0]
8181
}
82-
}, [localValue, intervalValues])
82+
83+
return interval
84+
}, [value, localValue, intervalValues])
8385

8486
useEffect(() => {
8587

@@ -99,7 +101,7 @@ const IntervalSelection = ({value, onConfirm, intent, ...props} : EditableCell2P
99101
...props,
100102
style: {...props.style, padding: 0},
101103
}, [
102-
h(Select<Interval>, {
104+
h(Select2<Interval>, {
103105
fill: true,
104106
items: intervalValues,
105107
className: "update-input-group",

src/pages/maps/@id/edit/edit-page.ts

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { WidthAdjustablePanel } from "./components";
88
import MapInterface from "./map-interface";
99
import { useStoredState } from "@macrostrat/ui-components";
1010
import { ParentRouteButton } from "~/components/map-navbar";
11-
import { Button } from "@blueprintjs/core";
11+
import { Button, HotkeysProvider } from "@blueprintjs/core";
1212

1313
export const h = hyper.styled(styles);
1414

@@ -43,41 +43,43 @@ export default function EditInterface({
4343

4444
const title = mapBounds.properties.name;
4545

46-
return h("div.edit-page", [
47-
h(
48-
WidthAdjustablePanel,
49-
{
50-
expand: !showMap,
51-
className: "edit-page-content",
52-
storageID: "edit-panel-width",
53-
},
54-
// TODO: make this basename dynamic
55-
h([
56-
h("div.edit-page-header", [
57-
h(ParentRouteButton, { parentRoute: "/maps/" }),
58-
h("h2", title),
59-
h("div.spacer"),
60-
h("div.edit-page-buttons", [
61-
h(ShowMapButton, { showMap, setShowMap }),
46+
return h(HotkeysProvider, [
47+
h("div.edit-page", [
48+
h(
49+
WidthAdjustablePanel,
50+
{
51+
expand: !showMap,
52+
className: "edit-page-content",
53+
storageID: "edit-panel-width",
54+
},
55+
// TODO: make this basename dynamic
56+
h([
57+
h("div.edit-page-header", [
58+
h(ParentRouteButton, { parentRoute: "/maps/" }),
59+
h("h2", title),
60+
h("div.spacer"),
61+
h("div.edit-page-buttons", [
62+
h(ShowMapButton, { showMap, setShowMap }),
63+
]),
6264
]),
63-
]),
64-
h(Router, { basename: `/maps/${source_id}/edit` }, [
65-
h(Routes, [
66-
h(Route, {
67-
path: "",
68-
element: h(EditMenu),
69-
}),
70-
h(Route, {
71-
path: "polygons",
72-
element: h(EditTable, {
73-
url: `${import.meta.env.VITE_MACROSTRAT_INGEST_API}/sources/${source_id}/polygons`,
65+
h(Router, { basename: `/maps/${source_id}/edit` }, [
66+
h(Routes, [
67+
h(Route, {
68+
path: "",
69+
element: h(EditMenu),
7470
}),
75-
}),
76-
]),
77-
]),
78-
])
79-
),
80-
h.if(showMap)(MapInterface, { id: source_id, map: mapBounds }),
71+
h(Route, {
72+
path: "polygons",
73+
element: h(EditTable, {
74+
url: `${import.meta.env.VITE_MACROSTRAT_INGEST_API}/sources/${source_id}/polygons`,
75+
}),
76+
}),
77+
]),
78+
])
79+
])
80+
),
81+
h.if(showMap)(MapInterface, { id: source_id, map: mapBounds }),
82+
]),
8183
]);
8284
}
8385

0 commit comments

Comments
 (0)