Skip to content

Commit

Permalink
fixing everthing
Browse files Browse the repository at this point in the history
  • Loading branch information
cphelefu committed Sep 25, 2024
1 parent 61fc19c commit dcd4084
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 32 deletions.
1 change: 0 additions & 1 deletion src/components/AppToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/components/ConfigSaveUploadButtons.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
7 changes: 2 additions & 5 deletions src/components/EventsLog.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -50,12 +50,9 @@ export function EventsLog() {

<List sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
{logsList.map((row, index) => (
<>
<ListItem key={`$legend_layer_status_index_${index}`}>
<ListItem key={`$eventslog_index_${index}`} sx={{borderBottom: '1px solid rgba(0, 0, 0, 0.12);'}} >
<ListItemText primary={row.eventName} secondary={row?.description} />
</ListItem>
<Divider component="li" />
</>
))}
</List>
</Box>
Expand Down
19 changes: 2 additions & 17 deletions src/components/GeoViewMap.tsx
Original file line number Diff line number Diff line change
@@ -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;
}

Expand All @@ -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;

Expand All @@ -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);
Expand Down
13 changes: 6 additions & 7 deletions src/components/LegendLayerStatusTable.tsx
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -19,12 +19,11 @@ export function LegendLayerStatusTable() {

<List sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
{legendLayerStatusList.map((row, index) => (
<>
<ListItem key={`$legend_layer_status_index_${index}`}>
<ListItemText primary={row.layerName} secondary={row?.status} />
</ListItem>
<Divider component="li" />
</>

<ListItem key={`$legend_layer_status_index_${index}`} sx={{ borderBottom: '1px solid rgba(0, 0, 0, 0.12);' }} >
<ListItemText primary={row.layerName} secondary={row?.status} />
</ListItem>

))}
</List>
</Box>
Expand Down
1 change: 1 addition & 0 deletions src/providers/cgpvContextProvider/cgpvHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down

0 comments on commit dcd4084

Please sign in to comment.