feat: "add" button status control & ui improvement
This commit is contained in:
parent
fb23e2c592
commit
05c444206e
|
@ -6,9 +6,7 @@
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3c7078e7-6f30-4d92-9696-11496f9e6dff" name="Changes" comment="">
|
<list default="true" id="3c7078e7-6f30-4d92-9696-11496f9e6dff" name="Changes" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/public/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/public/index.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/App.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/App.js" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/App.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/App.js" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/Networking.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/Networking.js" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/SimulateClick.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/SimulateClick.js" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/SimulateClick.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/SimulateClick.js" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/UMap.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/UMap.js" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/UMap.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/UMap.js" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
|
@ -73,7 +71,7 @@
|
||||||
<updated>1700814200305</updated>
|
<updated>1700814200305</updated>
|
||||||
<workItem from="1700814201341" duration="315000" />
|
<workItem from="1700814201341" duration="315000" />
|
||||||
<workItem from="1700814808669" duration="47000" />
|
<workItem from="1700814808669" duration="47000" />
|
||||||
<workItem from="1700822693197" duration="4588000" />
|
<workItem from="1700822693197" duration="7905000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|
21
src/App.js
21
src/App.js
|
@ -8,7 +8,7 @@ import {
|
||||||
CircularProgress,
|
CircularProgress,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
Modal,
|
Modal, ModalClose,
|
||||||
ModalDialog,
|
ModalDialog,
|
||||||
Sheet,
|
Sheet,
|
||||||
Typography
|
Typography
|
||||||
|
@ -67,8 +67,13 @@ export default function App() {
|
||||||
entering: {opacity: 1},
|
entering: {opacity: 1},
|
||||||
entered: {opacity: 1},
|
entered: {opacity: 1},
|
||||||
}[state],
|
}[state],
|
||||||
|
display: 'flex',
|
||||||
|
width: version !== '' ? '60%' : 'auto',
|
||||||
|
height: version !== '' ? '60%' : 'auto',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<ModalClose/>
|
||||||
|
<Sheet sx={{margin: 'auto'}}>
|
||||||
<Alert style={{display: version !== '' ? 'none' : 'flex'}}
|
<Alert style={{display: version !== '' ? 'none' : 'flex'}}
|
||||||
variant="soft"
|
variant="soft"
|
||||||
color="warning"
|
color="warning"
|
||||||
|
@ -83,23 +88,31 @@ export default function App() {
|
||||||
<Box sx={{flex: 1}}>
|
<Box sx={{flex: 1}}>
|
||||||
<Typography level="title-lg">Still connecting...</Typography>
|
<Typography level="title-lg">Still connecting...</Typography>
|
||||||
<Typography level="body-md">
|
<Typography level="body-md">
|
||||||
nanoMap requires a valid backend to work. If it takes too long, please check
|
nanoMap requires a valid backend to work. If it takes too long, please
|
||||||
|
check
|
||||||
your connection or see our status page.
|
your connection or see our status page.
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
</Alert>
|
</Alert>
|
||||||
<Sheet style={{display: version !== '' ? 'flex' : 'none'}}>
|
<Sheet style={{display: version !== '' ? 'flex' : 'none'}}>
|
||||||
<img src={'icon.jpeg'}
|
<img src={'icon.jpeg'}
|
||||||
style={{height: '150px', display: 'flex', margin: 'auto', borderRadius: '50%'}}
|
style={{
|
||||||
|
height: '150px',
|
||||||
|
display: 'flex',
|
||||||
|
margin: 'auto',
|
||||||
|
borderRadius: '50%'
|
||||||
|
}}
|
||||||
alt={'nanoMap'}/>
|
alt={'nanoMap'}/>
|
||||||
</Sheet>
|
</Sheet>
|
||||||
<DialogTitle style={{display: version !== '' ? 'flex' : 'none'}}
|
<DialogTitle style={{display: version !== '' ? 'flex' : 'none'}}
|
||||||
sx={{margin: 'auto', fontSize: '200%'}}>What's new in
|
sx={{margin: 'auto', fontSize: '200%', textAlign: 'center'}}>What's new
|
||||||
|
in
|
||||||
nanoMap {version}</DialogTitle>
|
nanoMap {version}</DialogTitle>
|
||||||
<DialogContent style={{display: version !== '' ? 'flex' : 'none'}}
|
<DialogContent style={{display: version !== '' ? 'flex' : 'none'}}
|
||||||
sx={{margin: 'auto'}}>
|
sx={{margin: 'auto'}}>
|
||||||
<div dangerouslySetInnerHTML={{__html: intro}}/>
|
<div dangerouslySetInnerHTML={{__html: intro}}/>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
</Sheet>
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
</Modal>
|
</Modal>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -3,10 +3,10 @@ import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {Add} from "@mui/icons-material";
|
import {Add} from "@mui/icons-material";
|
||||||
|
|
||||||
export default function SimulateClick() {
|
export default function SimulateClick({isCandEmpty}) {
|
||||||
return (
|
return (
|
||||||
<ButtonGroup buttonFlex={1} aria-label="flex button group" sx={{zIndex: 'modal'}}>
|
<ButtonGroup buttonFlex={1} aria-label="flex button group" sx={{zIndex: 'modal'}}>
|
||||||
<Button variant={'solid'} color={'primary'} startDecorator={<Add />}>Add</Button>
|
<Button disabled={isCandEmpty} variant={'solid'} color={'primary'} startDecorator={<Add />}>Add</Button>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
);
|
);
|
||||||
}
|
}
|
17
src/UMap.js
17
src/UMap.js
|
@ -1,7 +1,7 @@
|
||||||
import React, {Component, useEffect, useRef, useState} from 'react';
|
import React, {Component, useEffect, useRef, useState} from 'react';
|
||||||
import * as L from 'leaflet';
|
import * as L from 'leaflet';
|
||||||
import SearchIcon from '@mui/icons-material/Search';
|
import SearchIcon from '@mui/icons-material/Search';
|
||||||
import {MapContainer, TileLayer, Marker, Popup, useMap} from 'react-leaflet';
|
import {MapContainer, TileLayer, Marker, Popup, useMap, LayersControl} from 'react-leaflet';
|
||||||
import {useMapEvents} from 'react-leaflet/hooks';
|
import {useMapEvents} from 'react-leaflet/hooks';
|
||||||
import {post} from './Networking';
|
import {post} from './Networking';
|
||||||
import {Autocomplete, CircularProgress, Sheet} from "@mui/joy";
|
import {Autocomplete, CircularProgress, Sheet} from "@mui/joy";
|
||||||
|
@ -11,7 +11,7 @@ const AppleParkLoc=[37.334835049999995,-122.01139165956805];
|
||||||
class Markers extends Component {
|
class Markers extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {markers: [], candMarkers: []};
|
this.state = {markers: [], candMarkers: [], candEmpty: true};
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -26,7 +26,7 @@ class Markers extends Component {
|
||||||
|
|
||||||
addMarker(lat, lng) {
|
addMarker(lat, lng) {
|
||||||
this.setState((prev) => ({
|
this.setState((prev) => ({
|
||||||
markers: [...prev.markers, [lat, lng]], candMarkers: prev.candMarkers,
|
markers: [...prev.markers, [lat, lng]], candMarkers: prev.candMarkers,candEmpty: prev.candEmpty
|
||||||
}));
|
}));
|
||||||
this.getFocus();
|
this.getFocus();
|
||||||
}
|
}
|
||||||
|
@ -35,17 +35,18 @@ class Markers extends Component {
|
||||||
this.setState((prev) => ({
|
this.setState((prev) => ({
|
||||||
candMarkers: [...prev.candMarkers, [lat, lng]],
|
candMarkers: [...prev.candMarkers, [lat, lng]],
|
||||||
markers: prev.markers,
|
markers: prev.markers,
|
||||||
|
candEmpty: false
|
||||||
}));
|
}));
|
||||||
this.getFocus();
|
this.getFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
clearMarkers() {
|
clearMarkers() {
|
||||||
this.setState((prev) => ({markers: [], candMarkers: prev.candMarkers}));
|
this.setState((prev) => ({markers: [], candMarkers: prev.candMarkers, candEmpty: prev.candMarkers}));
|
||||||
this.getFocus();
|
this.getFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCandMarkers(){
|
clearCandMarkers(){
|
||||||
this.setState((prev) => ({markers: prev.markers, candMarkers: []}));
|
this.setState((prev) => ({markers: prev.markers, candMarkers: [], candEmpty: true}));
|
||||||
this.getFocus();
|
this.getFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ function ChangeView({center,zoom}){
|
||||||
export default function UMap() {
|
export default function UMap() {
|
||||||
const markersRef = useRef(null);
|
const markersRef = useRef(null);
|
||||||
const [focus, setFocus]=useState([37.334835049999995,-122.01139165956805]);
|
const [focus, setFocus]=useState([37.334835049999995,-122.01139165956805]);
|
||||||
const zoom=13;
|
const zoom=16;
|
||||||
const sf=(a)=>{setFocus(a);console.log(`triggered focus update, new focus is ${focus}`);};
|
const sf=(a)=>{setFocus(a);console.log(`triggered focus update, new focus is ${focus}`);};
|
||||||
return (
|
return (
|
||||||
<Sheet>
|
<Sheet>
|
||||||
|
@ -162,8 +163,8 @@ export default function UMap() {
|
||||||
<Markers ref={markersRef} focusUpdater={sf}/>
|
<Markers ref={markersRef} focusUpdater={sf}/>
|
||||||
<MapClickHandler mks={markersRef}/>
|
<MapClickHandler mks={markersRef}/>
|
||||||
</MapContainer>
|
</MapContainer>
|
||||||
<Sheet sx={{position: 'absolute', top: '20px', left: '10vw', zIndex: 'modal'}}>
|
<Sheet sx={{position: 'absolute', top: '20px', right: '10vw', zIndex: 'modal'}}>
|
||||||
<SimulateClick />
|
<SimulateClick isCandEmpty={markersRef.current?markersRef.current.state.candEmpty:true} />
|
||||||
<LocationSearch mks={markersRef}/>
|
<LocationSearch mks={markersRef}/>
|
||||||
</Sheet>
|
</Sheet>
|
||||||
</Sheet>
|
</Sheet>
|
||||||
|
|
Loading…
Reference in New Issue