Skip to content

Commit 19af0fa

Browse files
fix(website, editable-layers): Unbreak editor example in website (#271)
1 parent fc80a3c commit 19af0fa

File tree

9 files changed

+90
-201
lines changed

9 files changed

+90
-201
lines changed

examples/editable-layers/editor/example.tsx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@
22
// SPDX-License-Identifier: MIT
33
// Copyright (c) vis.gl contributors
44

5-
import React, {useState} from 'react';
5+
import React, { useState } from 'react';
66
import DeckGL from '@deck.gl/react';
7-
import {ViewMode, EditableGeoJsonLayer} from '@deck.gl-community/editable-layers';
8-
import {Toolbox} from './toolbox/toolbox';
7+
import { ViewMode, EditableGeoJsonLayer } from '@deck.gl-community/editable-layers';
8+
import { Toolbox } from './toolbox/toolbox';
99
import StaticMap from 'react-map-gl/maplibre';
1010

11-
const initialViewState = {
12-
longitude: -122.43,
13-
latitude: 37.775,
14-
zoom: 12
15-
};
16-
17-
export function Example() {
18-
const [geoJson, setGeoJson] = useState({
11+
export function getDefaultGeoJSON() {
12+
return {
1913
type: 'FeatureCollection',
2014
features: [
2115
{
@@ -51,7 +45,17 @@ export function Example() {
5145
}
5246
}
5347
]
54-
});
48+
} as const;
49+
}
50+
51+
const initialViewState = {
52+
longitude: -122.43,
53+
latitude: 37.775,
54+
zoom: 12
55+
};
56+
57+
export function Example() {
58+
const [geoJson, setGeoJson] = useState(getDefaultGeoJSON());
5559
const [selectedFeatureIndexes, setSelectedFeatureIndexes] = useState([0]);
5660
const [mode, setMode] = useState(() => ViewMode);
5761
const [modeConfig, setModeConfig] = useState({});
@@ -61,7 +65,7 @@ export function Example() {
6165
mode,
6266
modeConfig,
6367
selectedFeatureIndexes,
64-
onEdit: ({updatedData}) => {
68+
onEdit: ({ updatedData }) => {
6569
setGeoJson(updatedData);
6670
}
6771
});

examples/editable-layers/editor/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,11 @@
3333
"react-dom": "^18.2.0",
3434
"react-dropzone": "^10.2.2",
3535
"react-map-gl": "^7.1.7",
36-
"styled-components": "^4.4.1",
36+
"styled-components": "^6.1.9",
3737
"wellknown": "^0.5.0"
3838
},
3939
"devDependencies": {
4040
"typescript": "^5.4.4",
4141
"vite": "^5.2.8"
42-
},
43-
"volta": {
44-
"extends": "../../../package.json"
4542
}
4643
}

examples/editable-layers/editor/toolbox/toolbox.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,12 @@ function ModeButton({buttonConfig, mode, onClick}: any) {
103103
</Button>
104104
);
105105
}
106+
106107
function ModeGroupButtons({left, modeGroup, mode, onSetMode}: any) {
107108
const [expanded, setExpanded] = React.useState(false);
108109

109110
const {modes} = modeGroup;
110-
111+
111112
let subTools = null;
112113

113114
if (expanded) {
@@ -240,6 +241,7 @@ export function Toolbox({
240241
{/* zoom in and out */}
241242
</Tools>
242243

244+
{/*
243245
{showImport && (
244246
<ImportModal
245247
onImport={(imported) => {
@@ -251,6 +253,7 @@ export function Toolbox({
251253
)}
252254
253255
{showExport && <ExportModal geoJson={geoJson} onClose={() => setShowExport(false)} />}
256+
*/}
254257
</>
255258
);
256259
}

examples/graph-layers/graph-viewer/app.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ export function App(props) {
107107
return;
108108
}
109109

110-
debugger
111110
setEngine(new GraphEngine({graph, layout}));
112111
}, [graph, layout]);
113112

@@ -279,7 +278,7 @@ export function App(props) {
279278
}
280279
getTooltip={(info) => getToolTip(info.object)}
281280
/>
282-
{/* View control component TODO - replace with widget */
281+
{/* View control component TODO - doesn't work in website, replace with widget *
283282
<PositionedViewControl
284283
fitBounds={fitBounds}
285284
panBy={panBy}
@@ -288,7 +287,7 @@ export function App(props) {
288287
maxZoom={maxZoom}
289288
minZoom={minZoom}
290289
/>
291-
}
290+
*/}
292291
</div>
293292
</>
294293
</div>

examples/graph-layers/graph-viewer/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
"start-local": "vite --config ../../vite.config.local.mjs"
1010
},
1111
"dependencies": {
12-
"@deck.gl-community/graph-layers": "^9.1.0-beta.5",
13-
"@deck.gl-community/react": "^9.1.0-beta.5",
14-
"@deck.gl/core": "^9.1.12"
12+
"@deck.gl-community/graph-layers": "^9.1.0-beta.8",
13+
"@deck.gl-community/react": "^9.1.0-beta.8",
14+
"@deck.gl/core": "^9.1.12",
15+
"@deck.gl/layers": "^9.1.12",
16+
"@deck.gl/react": "^9.1.12",
17+
"react": "^18.2.0",
18+
"react-dom": "^18.2.0"
1519
},
1620
"devDependencies": {
1721
"vite": "^5.0.12"
18-
},
19-
"volta": {
20-
"extends": "../../../package.json"
2122
}
2223
}

website/src/examples-sidebar.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ const sidebars = {
5252
// },
5353

5454
// TODO - need BING map key
55-
{
56-
type: 'category',
57-
label: '@deck.gl-community/bing-maps',
58-
items: [
59-
"bing-maps/get-started"
60-
]
61-
},
55+
// {
56+
// type: 'category',
57+
// label: '@deck.gl-community/bing-maps',
58+
// items: [
59+
// "bing-maps/get-started"
60+
// ]
61+
// },
6262

6363
// TODO - unclear why not rendering
6464
// {

website/src/examples/graph-layers/graph-viewer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {App} from '../../../../examples/graph-layers/graph-viewer/app';
66

77
import {makeExample} from '../../components';
88

9-
class AdvancedDemo extends Component {
9+
class GraphViewerDemo extends Component {
1010
static title = 'Simple Graph Viewer';
1111

1212
static code = `${GITHUB_TREE}/examples/graph-layers/graph-viewer`;
@@ -26,4 +26,4 @@ class AdvancedDemo extends Component {
2626
}
2727
}
2828

29-
export default makeExample(AdvancedDemo);
29+
export default makeExample(GraphViewerDemo);

website/src/examples/infovis-layers/horizon-graph-layer.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Horizon Graph Layer Demo
1+
# HorizonGraphLayer
22

33
import Demo from './horizon-graph-layer';
44

0 commit comments

Comments
 (0)