Skip to content

Commit

Permalink
Aoi ui phase 1
Browse files Browse the repository at this point in the history
  • Loading branch information
guichoquette committed Jul 11, 2024
1 parent 0412291 commit c649312
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 18 deletions.
2 changes: 2 additions & 0 deletions packages/geoview-aoi-panel/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
},
"extent": {
"type": "array",
"minItems": 4,
"maxItems": 4,
"items": [
{
"type": "number",
Expand Down
61 changes: 45 additions & 16 deletions packages/geoview-aoi-panel/src/aoi-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,68 @@
// import { TypeBasemapProps } from 'geoview-core/src/geo/layer/basemap/basemap-types';
// import { TypeJsonObject } from 'geoview-core/src/core/types/global-types';
// import { useMapProjection } from 'geoview-core/src/core/stores/store-interface-and-intial-values/map-state';
// import { useAppDisplayLanguage } from 'geoview-core/src/core/stores/store-interface-and-intial-values/app-state';
// import { TypeValidMapProjectionCodes, TypeDisplayLanguage } from 'geoview-core/src/api/config/types/map-schema-types';
import { Extent } from 'geoview-core/src/api/config/types/map-schema-types';
// import { logger } from 'geoview-core/src/core/utils/logger';
// import { getLocalizedMessage } from 'geoview-core/src/core/utils/utilities';
// import { getSxClasses } from './area-of-interest-style';
import { getSxClasses } from './area-of-interest-style';

/*
interface AoiPanelProps {
mapId: string;
config: TypeJsonObject;
config: TypeAoiProps;
}
*/

export function AoiPanel(/* props: AoiPanelProps */): JSX.Element {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// const { mapId, config } = props;
interface AoiItem {
aoiTitle: string;
aoiUrl: string;
extent: Extent;
}

type AoiListItems = AoiItem[];

type TypeAoiProps = {
isOpen: boolean;
aoiList: AoiListItems;
version: string;
};

// const { cgpv } = window;
export function AoiPanel(props: AoiPanelProps): JSX.Element {
const { mapId, config } = props;

Check failure on line 29 in packages/geoview-aoi-panel/src/aoi-panel.tsx

View workflow job for this annotation

GitHub Actions / Build demo files / build-geoview

'mapId' is assigned a value but never used
const aoiList = config.aoiList as AoiListItems;

const { cgpv } = window;
// const myMap = cgpv.api.maps[mapId];

// const { api, ui, react } = cgpv;
// const { Select, Card, Box } = ui.elements;
const { /* api, */ ui /* , react */ } = cgpv;
const { Card, Box } = ui.elements;

// const { useState } = react;

// const theme = ui.useTheme();
// const sxClasses = getSxClasses(theme);
const theme = ui.useTheme();
const sxClasses = getSxClasses(theme);

// internal state and store values
// const language = useAppDisplayLanguage();

// #region PRIVATE UTILITY FUNCTIONS
// #endregion

return <div />;
return (
<Box sx={sxClasses.basemapCard}>
{aoiList.map((aoiItem: AoiItem, index) => {
return (
<Card
tabIndex={0}
// onClick={() => setBasemap(basemap.basemapId as string)}
// onKeyPress={() => setBasemap(basemap.basemapId as string)}
// eslint-disable-next-line react/no-array-index-key
key={index}
title={aoiItem.aoiTitle}
contentCard={
// eslint-disable-next-line react/jsx-no-useless-fragment
<>{typeof aoiItem.aoiUrl === 'string' && <Box component="img" src={aoiItem.aoiUrl} className="aoiCardThumbnail" />}</>
}
/>
);
})}
</Box>
);
}
2 changes: 1 addition & 1 deletion packages/geoview-aoi-panel/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AoiPanelPlugin extends AppBarPlugin {
}

override onCreateContent = (): JSX.Element => {
return <AoiPanel /* mapId={this.pluginProps.mapId} config={this.configObj || {}} */ />;
return <AoiPanel mapId={this.pluginProps.mapId} config={this.configObj || {}} />;
};

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"aoiList": [
"isOpen": false,
"aoiList": [
{
"imageUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9c/Toronto_-_ON_-_CN_Tower_Turmkorb.jpg/1920px-Toronto_-_ON_-_CN_Tower_Turmkorb.jpg",
"aoiTitle": "CN Tower",
"extent": [-88, 54, -86, 55]
},
{
"imageUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9c/Toronto_-_ON_-_CN_Tower_Turmkorb.jpg/1920px-Toronto_-_ON_-_CN_Tower_Turmkorb.jpg",
"aoiTitle": "CN Tower2",
"extent": [-88, 54, -86, 55]
}
],
"version": "1.0"
Expand Down

0 comments on commit c649312

Please sign in to comment.