From dcd408482e798fe2588b3b61de7cbcc6b82bdf33 Mon Sep 17 00:00:00 2001 From: Christopher Phelefu Date: Wed, 25 Sep 2024 09:09:03 -0400 Subject: [PATCH] fixing everthing --- src/components/AppToolbar.tsx | 1 - src/components/ConfigSaveUploadButtons.tsx | 3 +-- src/components/EventsLog.tsx | 7 ++----- src/components/GeoViewMap.tsx | 19 ++----------------- src/components/LegendLayerStatusTable.tsx | 13 ++++++------- src/providers/cgpvContextProvider/cgpvHook.ts | 1 + 6 files changed, 12 insertions(+), 32 deletions(-) diff --git a/src/components/AppToolbar.tsx b/src/components/AppToolbar.tsx index 6947917..04a560f 100644 --- a/src/components/AppToolbar.tsx +++ b/src/components/AppToolbar.tsx @@ -2,7 +2,6 @@ import { IconButton, Link, Menu, MenuItem, Toolbar, Typography } from "@mui/mate import { useState } from "react"; import SettingsIcon from '@mui/icons-material/Settings'; import Logo from '../assets/logo.png'; -import GitHubIcon from '@mui/icons-material/GitHub'; interface AppToolbarProps { children?: React.ReactNode; diff --git a/src/components/ConfigSaveUploadButtons.tsx b/src/components/ConfigSaveUploadButtons.tsx index 6aa1ab4..4ef6d19 100644 --- a/src/components/ConfigSaveUploadButtons.tsx +++ b/src/components/ConfigSaveUploadButtons.tsx @@ -1,10 +1,9 @@ import { useContext, useState } from "react"; -import { Box, Button, Modal, Snackbar } from "@mui/material"; +import { Box, Button, Snackbar } from "@mui/material"; import ContentCopyIcon from '@mui/icons-material/ContentCopy'; import { CGPVContext } from "../providers/cgpvContextProvider/CGPVContextProvider"; import DownloadIcon from '@mui/icons-material/Download'; import UploadFileIcon from '@mui/icons-material/UploadFile'; -import DataObjectIcon from '@mui/icons-material/DataObject'; import { ConfigTextEditor } from "./ConfigTextEditor"; interface ConfigSaveUploadButtonsProps { diff --git a/src/components/EventsLog.tsx b/src/components/EventsLog.tsx index 3a2923f..8ec1a7b 100644 --- a/src/components/EventsLog.tsx +++ b/src/components/EventsLog.tsx @@ -1,6 +1,6 @@ import { useContext, useEffect, useState } from 'react'; import { CGPVContext } from '../providers/cgpvContextProvider/CGPVContextProvider'; -import { Box, Divider, List, ListItem, ListItemText } from '@mui/material'; +import { Box, List, ListItem, ListItemText } from '@mui/material'; import { EventListItemType, ListOptionType } from '../types'; import PillsAutoComplete from './PillsAutoComplete'; @@ -50,12 +50,9 @@ export function EventsLog() { {logsList.map((row, index) => ( - <> - + - - ))} diff --git a/src/components/GeoViewMap.tsx b/src/components/GeoViewMap.tsx index f4f0e91..c5cd9bb 100644 --- a/src/components/GeoViewMap.tsx +++ b/src/components/GeoViewMap.tsx @@ -1,27 +1,21 @@ import React, { useContext, useEffect } from 'react'; -import { AppBar, Box, CssBaseline, Drawer, IconButton, Tab, Tabs, Toolbar, Typography } from '@mui/material'; +import { AppBar, Box, CssBaseline, Drawer, IconButton, Toolbar } from '@mui/material'; import MenuIcon from '@mui/icons-material/Menu'; import ConfigurationDrawer from './ConfigurationsDrawer/ConfigurationsDrawer'; -import { ConfigTextEditor } from './ConfigTextEditor'; import { CGPVContext } from '../providers/cgpvContextProvider/CGPVContextProvider'; import { MapRenderer } from './MapRenderer'; import { DEFAULT_CONFIG } from '../constants'; import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import { useNavigate } from 'react-router-dom'; -import { CodeSnippet } from './CodeSnippet'; -import { EventsLog } from './EventsLog'; -import { LegendLayerStatusTable } from './LegendLayerStatusTable'; import { AppToolbar } from './AppToolbar'; interface GeoViewMapProps { showConfigEditor?: boolean; - showEventsLog?: boolean; - showLegendLayerStatus?: boolean; config: string | object; configIsFilePath?: boolean; - codeSnippet?: string; children?: React.ReactNode; top?: React.ReactNode; + codeSnippet?: string; bottom?: React.ReactNode; } @@ -35,12 +29,8 @@ function GeoViewMap(props: GeoViewMapProps) { const { initializeMap, isInitialized } = cgpvContext; const { - showConfigEditor = true, - showEventsLog = true, - showLegendLayerStatus = true, config = DEFAULT_CONFIG, configIsFilePath, - codeSnippet, children } = props; @@ -55,11 +45,6 @@ function GeoViewMap(props: GeoViewMapProps) { const [mobileOpen, setMobileOpen] = React.useState(false); const [isClosing, setIsClosing] = React.useState(false); - const [selectedTab, setSelectedTab] = React.useState('map'); - - const handleTabChange = (event: React.SyntheticEvent, newValue: string) => { - setSelectedTab(newValue); - }; const handleDrawerClose = () => { setIsClosing(true); diff --git a/src/components/LegendLayerStatusTable.tsx b/src/components/LegendLayerStatusTable.tsx index 035b57e..7297f44 100644 --- a/src/components/LegendLayerStatusTable.tsx +++ b/src/components/LegendLayerStatusTable.tsx @@ -1,6 +1,6 @@ import { useContext } from 'react'; import { CGPVContext } from '../providers/cgpvContextProvider/CGPVContextProvider'; -import { Box, Divider, List, ListItem, ListItemText } from '@mui/material'; +import { Box, List, ListItem, ListItemText } from '@mui/material'; export function LegendLayerStatusTable() { @@ -19,12 +19,11 @@ export function LegendLayerStatusTable() { {legendLayerStatusList.map((row, index) => ( - <> - - - - - + + + + + ))} diff --git a/src/providers/cgpvContextProvider/cgpvHook.ts b/src/providers/cgpvContextProvider/cgpvHook.ts index 1e76e79..6e9a21e 100644 --- a/src/providers/cgpvContextProvider/cgpvHook.ts +++ b/src/providers/cgpvContextProvider/cgpvHook.ts @@ -57,6 +57,7 @@ export function useCgpvHook(): ICgpvHook { console.log('registering events'); cgpv.api.maps[mapId].layer.legendsLayerSet.onLayerSetUpdated((sender: any, payload: any) => { + console.log('legendsLayerSet updated', payload); const { resultSet } = payload; const resultArr: LegendLayerStatus[] = Object.keys(resultSet).map((key) => { return { layerName: resultSet[key]?.layerName, status: resultSet[key]?.layerStatus };