Skip to content

Commit 3b584bf

Browse files
Made suggested changes
1 parent 027a1a3 commit 3b584bf

File tree

10 files changed

+41
-88
lines changed

10 files changed

+41
-88
lines changed

packages/base/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export * from './icons';
88
export * from './mainview';
99
export * from './menus';
1010
export * from './panelview';
11-
export * from './stacBrowser';
1211
export * from './store';
12+
export * from './stacBrowser';
1313
export * from './toolbar';
1414
export * from './tools';
1515
export * from './types';

packages/base/src/mainview/mainView.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ import CollaboratorPointers, { ClientPointer } from './CollaboratorPointers';
9393
import { FollowIndicator } from './FollowIndicator';
9494
import TemporalSlider from './TemporalSlider';
9595
import { MainViewModel } from './mainviewmodel';
96-
import { LeftPanelComponent, RightPanelComponent } from '../panelview';
96+
import { LeftPanel, RightPanel } from '../panelview';
9797

9898
type OlLayerTypes =
9999
| TileLayer
@@ -2234,18 +2234,18 @@ export class MainView extends React.Component<IProps, IStates> {
22342234
</div>
22352235

22362236
{this._state && (
2237-
<LeftPanelComponent
2237+
<LeftPanel
22382238
model={this._model}
22392239
commands={this._mainViewModel.commands}
22402240
state={this._state}
2241-
></LeftPanelComponent>
2241+
></LeftPanel>
22422242
)}
22432243
{this._formSchemaRegistry && this._annotationModel && (
2244-
<RightPanelComponent
2244+
<RightPanel
22452245
model={this._model}
22462246
formSchemaRegistry={this._formSchemaRegistry}
22472247
annotationModel={this._annotationModel}
2248-
></RightPanelComponent>
2248+
></RightPanel>
22492249
)}
22502250
</>
22512251
);

packages/base/src/panelview/components/identify-panel/IdentifyPanel.tsx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ interface IIdentifyComponentProps {
1313
model: IJupyterGISModel;
1414
}
1515

16-
export const IdentifyPanelComponent = (options: IIdentifyComponentProps) => {
16+
export const IdentifyPanelComponent: React.FC<IIdentifyComponentProps> = ({
17+
model,
18+
}) => {
1719
const [features, setFeatures] = useState<IDict<any>>();
1820
const [visibleFeatures, setVisibleFeatures] = useState<IDict<any>>({
1921
0: true,
2022
});
2123
const [remoteUser, setRemoteUser] = useState<User.IIdentity | null>(null);
22-
const jgisModel = options.model;
2324

2425
const featuresRef = useRef(features);
2526

@@ -34,7 +35,7 @@ export const IdentifyPanelComponent = (options: IIdentifyComponentProps) => {
3435
sender: IJupyterGISModel,
3536
clients: Map<number, IJupyterGISClientState>,
3637
) => {
37-
const remoteUserId = jgisModel?.localState?.remoteUser;
38+
const remoteUserId = model?.localState?.remoteUser;
3839

3940
// If following a collaborator
4041
if (remoteUserId) {
@@ -50,34 +51,30 @@ export const IdentifyPanelComponent = (options: IIdentifyComponentProps) => {
5051
}
5152

5253
// If not following a collaborator
53-
const identifiedFeatures =
54-
jgisModel?.localState?.identifiedFeatures?.value;
54+
const identifiedFeatures = model?.localState?.identifiedFeatures?.value;
5555

5656
if (!identifiedFeatures) {
5757
setFeatures({});
5858
return;
5959
}
6060

61-
if (
62-
jgisModel.isIdentifying &&
63-
featuresRef.current !== identifiedFeatures
64-
) {
61+
if (model.isIdentifying && featuresRef.current !== identifiedFeatures) {
6562
setFeatures(identifiedFeatures);
6663
}
6764
};
6865

69-
jgisModel?.clientStateChanged.connect(handleClientStateChanged);
66+
model?.clientStateChanged.connect(handleClientStateChanged);
7067

7168
return () => {
72-
jgisModel?.clientStateChanged.disconnect(handleClientStateChanged);
69+
model?.clientStateChanged.disconnect(handleClientStateChanged);
7370
};
74-
}, [jgisModel]);
71+
}, [model]);
7572

7673
const highlightFeatureOnMap = (feature: any) => {
77-
jgisModel?.highlightFeatureSignal?.emit(feature);
74+
model?.highlightFeatureSignal?.emit(feature);
7875

7976
const geometry = feature.geometry || feature._geometry;
80-
jgisModel?.flyToGeometrySignal?.emit(geometry);
77+
model?.flyToGeometrySignal?.emit(geometry);
8178
};
8279

8380
const toggleFeatureVisibility = (index: number) => {
@@ -91,7 +88,7 @@ export const IdentifyPanelComponent = (options: IIdentifyComponentProps) => {
9188
<div
9289
className="jgis-identify-wrapper"
9390
style={{
94-
border: jgisModel?.localState?.remoteUser
91+
border: model?.localState?.remoteUser
9592
? `solid 3px ${remoteUser?.color}`
9693
: 'unset',
9794
}}

packages/base/src/panelview/components/layers.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,13 @@ const LAYER_TITLE_CLASS = 'jp-gis-layerTitle';
3030
const LAYER_ICON_CLASS = 'jp-gis-layerIcon';
3131
const LAYER_TEXT_CLASS = 'jp-gis-layerText data-jgis-keybinding';
3232

33-
/**
34-
* Properties of the layers body component.
35-
*/
3633
interface IBodyProps {
3734
model: IJupyterGISModel;
3835
commands: CommandRegistry;
3936
state: IStateDB;
4037
}
4138

42-
/**
43-
* The body component of the panel.
44-
*/
45-
export function LayersBodyComponent(props: IBodyProps): JSX.Element {
39+
export const LayersBodyComponent: React.FC<IBodyProps> = props => {
4640
const model = props.model;
4741
const id = UUID.uuid4();
4842

@@ -57,15 +51,13 @@ export function LayersBodyComponent(props: IBodyProps): JSX.Element {
5751
};
5852

5953
const _onDragOver = (e: React.DragEvent) => {
60-
console.log('_onDragOver');
6154
e.stopPropagation();
6255
e.preventDefault();
6356
Private.dragInfo.dragOverElement = null;
6457
Private.dragInfo.dragOverPosition = null;
6558
};
6659

6760
const _onDrop = (e: React.DragEvent) => {
68-
console.log('_onDrop');
6961
Private.dragIndicator.style.display = 'none';
7062

7163
if (model === undefined) {
@@ -247,7 +239,7 @@ export function LayersBodyComponent(props: IBodyProps): JSX.Element {
247239
)}
248240
</div>
249241
);
250-
}
242+
};
251243

252244
/**
253245
* Properties of the layer group component.

packages/base/src/panelview/leftpanel.tsx

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,25 @@ import {
1111
TabsList,
1212
TabsTrigger,
1313
} from '../shared/components/Tabs';
14-
import StacBrowser from '../stacBrowser/StacBrowser';
14+
import StacPanel from '../stacBrowser/components/StacPanel';
1515
import FilterComponent from './components/filter-panel/Filter';
1616

17-
/**
18-
* Options of the left panel widget.
19-
*/
20-
export interface ILeftPanelOptions {
21-
model: IJupyterGISModel;
22-
onSelect: ({ type, item, nodeId }: ILeftPanelClickHandlerParams) => void;
23-
}
24-
25-
export interface ILayerPanelOptions extends ILeftPanelOptions {
26-
state: IStateDB;
27-
}
28-
2917
export interface ILeftPanelClickHandlerParams {
3018
type: SelectionType;
3119
item: string;
3220
nodeId?: string;
3321
event: ReactMouseEvent;
3422
}
3523

36-
interface ILeftComponentProps {
24+
interface ILeftPanelProps {
3725
model: IJupyterGISModel;
3826
state: IStateDB;
3927
commands: CommandRegistry;
4028
}
4129

42-
export const LeftPanelComponent = (options: ILeftComponentProps) => {
30+
export const LeftPanel: React.FC<ILeftPanelProps> = (
31+
props: ILeftPanelProps,
32+
) => {
4333
const tabInfo = [
4434
{ name: 'layers', title: 'Layers' },
4535
{ name: 'stac', title: 'Stac Browser' },
@@ -73,16 +63,16 @@ export const LeftPanelComponent = (options: ILeftComponentProps) => {
7363
</TabsList>
7464
<TabsContent value="layers" className="jgis-panel-tab-content">
7565
<LayersBodyComponent
76-
model={options.model}
77-
commands={options.commands}
78-
state={options.state}
66+
model={props.model}
67+
commands={props.commands}
68+
state={props.state}
7969
></LayersBodyComponent>
8070
</TabsContent>
8171
<TabsContent value="stac">
82-
<StacBrowser model={options.model}></StacBrowser>
72+
<StacPanel model={props.model}></StacPanel>
8373
</TabsContent>
8474
<TabsContent value="filters" className="jgis-panel-tab-content">
85-
<FilterComponent model={options.model}></FilterComponent>,
75+
<FilterComponent model={props.model}></FilterComponent>,
8676
</TabsContent>
8777
</PanelTabs>
8878
</div>

packages/base/src/panelview/objectproperties.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
IJupyterGISClientState,
44
IJupyterGISModel,
55
} from '@jupytergis/schema';
6-
import { Panel } from '@lumino/widgets';
76
import * as React from 'react';
87
import { v4 as uuid } from 'uuid';
98

@@ -120,13 +119,3 @@ export class ObjectPropertiesReact extends React.Component<IProps, IStates> {
120119
);
121120
}
122121
}
123-
124-
export namespace ObjectProperties {
125-
/**
126-
* Instantiation options for `ObjectProperties`.
127-
*/
128-
export interface IOptions extends Panel.IOptions {
129-
model: IJupyterGISModel;
130-
formSchemaRegistry: IJGISFormSchemaRegistry;
131-
}
132-
}

packages/base/src/panelview/rightpanel.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ import {
1515
TabsTrigger,
1616
} from '../shared/components/Tabs';
1717

18-
interface IRightComponentProps {
18+
interface IRightPanelProps {
1919
formSchemaRegistry: IJGISFormSchemaRegistry;
2020
annotationModel: IAnnotationModel;
2121
model: IJupyterGISModel;
2222
}
2323

24-
export const RightPanelComponent = (options: IRightComponentProps) => {
24+
export const RightPanel: React.FC<IRightPanelProps> = props => {
2525
const [selectedObjectProperties, setSelectedObjectProperties] =
2626
React.useState(undefined);
2727

2828
const tabInfo = [
2929
{ name: 'objectProperties', title: 'Object Properties' },
3030
{ name: 'annotations', title: 'Annotations' },
31-
{ name: 'identifyPanel', title: 'Identify Panels' },
31+
{ name: 'identifyPanel', title: 'Identify Features' },
3232
];
3333

3434
const [curTab, setCurTab] = React.useState<string | undefined>(
@@ -64,20 +64,18 @@ export const RightPanelComponent = (options: IRightComponentProps) => {
6464
<ObjectPropertiesReact
6565
setSelectedObject={setSelectedObjectProperties}
6666
selectedObject={selectedObjectProperties}
67-
formSchemaRegistry={options.formSchemaRegistry}
68-
model={options.model}
67+
formSchemaRegistry={props.formSchemaRegistry}
68+
model={props.model}
6969
/>
7070
</TabsContent>
7171
<TabsContent value="annotations">
7272
<AnnotationsPanel
73-
annotationModel={options.annotationModel}
74-
jgisModel={options.model}
73+
annotationModel={props.annotationModel}
74+
jgisModel={props.model}
7575
></AnnotationsPanel>
7676
</TabsContent>
7777
<TabsContent value="identifyPanel" className="jgis-panel-tab-content">
78-
<IdentifyPanelComponent
79-
model={options.model}
80-
></IdentifyPanelComponent>
78+
<IdentifyPanelComponent model={props.model}></IdentifyPanelComponent>
8179
</TabsContent>
8280
</PanelTabs>
8381
</div>

packages/base/src/stacBrowser/StacBrowser.tsx

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/base/src/stacBrowser/components/StacPanelView.tsx renamed to packages/base/src/stacBrowser/components/StacPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import StacPanelResults from './StacPanelResults';
1414
interface IStacViewProps {
1515
model?: IJupyterGISModel;
1616
}
17-
const StacPanelView = ({ model }: IStacViewProps) => {
17+
const StacPanel = ({ model }: IStacViewProps) => {
1818
const {
1919
filterState,
2020
filterSetters,
@@ -76,4 +76,4 @@ const StacPanelView = ({ model }: IStacViewProps) => {
7676
);
7777
};
7878

79-
export default StacPanelView;
79+
export default StacPanel;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './StacBrowser';
1+
export * from './components/StacPanel';

0 commit comments

Comments
 (0)