Skip to content

Commit 656d07e

Browse files
committed
Updated carbon isotope components
1 parent 2ee8e00 commit 656d07e

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

packages/column-views/src/data-provider/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export function useMacrostratData(dataType: string, ...args: any[]) {
316316
const MacrostratDataProviderContext = createContext(createMacrostratStore());
317317

318318
export function MacrostratDataProvider(props: MacrostratDataProviderProps) {
319-
const { baseURL = "https://macrostrat.org/api/v2", children } = props;
319+
const { baseURL = "https://dev.macrostrat.org/api/v2", children } = props;
320320

321321
const [store] = useState(() => createMacrostratStore(baseURL));
322322

packages/column-views/stories/column-ui/standalone.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function useColumnUnits(col_id, inProcess) {
99
const status_code = inProcess ? "in process" : undefined;
1010
// show_position is needed to properly deal with `section` column types.
1111
return useAPIResult(
12-
"https://macrostrat.org/api/v2/units",
12+
"https://dev.macrostrat.org/api/v2/units",
1313
{ col_id, response: "long", status_code, show_position: true },
1414
(res) => res.success.data,
1515
);
@@ -18,7 +18,7 @@ function useColumnUnits(col_id, inProcess) {
1818
function useColumnBasicInfo(col_id, inProcess = false) {
1919
const status_code = inProcess ? "in process" : undefined;
2020
return useAPIResult(
21-
"https://macrostrat.org/api/v2/columns",
21+
"https://dev.macrostrat.org/api/v2/columns",
2222
{ col_id, status_code },
2323
(res) => {
2424
return res.success.data[0];

packages/column-views/stories/facets/carbon-isotopes.stories.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,10 @@ export function EdiacaranCompilation(defaultArgs) {
7575
[columnArgs],
7676
);
7777
const res: FeatureCollection = useAPIResult(
78-
"https://macrostrat.org/api/v2/columns",
78+
"https://dev.macrostrat.org/api/v2/columns",
7979
colParams,
8080
(res) => res?.success?.data,
8181
);
82-
console.log(res);
8382
const columnFeature = res?.features[0];
8483

8584
return h(

packages/svg-map-components/src/drag-interaction.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Component } from "react";
2-
import { findDOMNode } from "react-dom";
1+
import { Component, createRef } from "react";
32
import h from "./hyper";
43
import { GlobeCtx, MapContext, useMapDispatch } from "./context";
54
import { drag, DragBehavior } from "d3-drag";
@@ -45,9 +44,11 @@ class _DraggableOverlay extends Component<DraggableOverlayInternalProps, any> {
4544
qa: number[];
4645
q0: number[];
4746
zoom: number;
47+
elementRef: React.RefObject<SVGElement>;
4848

4949
constructor(props) {
5050
super(props);
51+
this.elementRef = createRef();
5152
this.dragStarted = this.dragStarted.bind(this);
5253
this.dragged = this.dragged.bind(this);
5354
this.dragEnded = this.dragEnded.bind(this);
@@ -63,7 +64,7 @@ class _DraggableOverlay extends Component<DraggableOverlayInternalProps, any> {
6364
const { width, height, renderPath } = this.context;
6465
const { showMousePosition } = this.props;
6566
const { mousePosition } = this.state;
66-
return h("g.drag-overlay", [
67+
return h("g.drag-overlay", { ref: this.elementRef }, [
6768
h("rect.drag-mouse-target", { width, height }),
6869
h.if(mousePosition != null && showMousePosition)("path.mouse-position", {
6970
d: renderPath(mousePosition),
@@ -115,7 +116,10 @@ class _DraggableOverlay extends Component<DraggableOverlayInternalProps, any> {
115116

116117
element() {
117118
// This is a hack but it seems to work!
118-
return select(findDOMNode(this).parentElement);
119+
if (this.elementRef.current == null) {
120+
return null;
121+
}
122+
return select(this.elementRef.current.parentElement);
119123
}
120124

121125
componentDidMount() {

0 commit comments

Comments
 (0)