Skip to content

Commit

Permalink
move to Map/Device folder
Browse files Browse the repository at this point in the history
  • Loading branch information
erasta committed Nov 19, 2024
1 parent 94a2355 commit 3703b3e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 33 deletions.
2 changes: 1 addition & 1 deletion client/src/App/DevicePlanner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MapShower } from '../Map/MapShower';
import { DeviceTable } from '../DeviceTable/DeviceTable';
import { Stack } from '@mui/material';
import { MapPlacer } from '../Map/MapPlacer';
import { DeviceMarkersShown } from '../Map/DeviceMarkersShown';
import { DeviceMarkersShown } from '../Map/Device/DeviceMarkersShown';
import { MapPositionOnUrl } from '../Map/MapPositionOnUrl';
import { EditToolBox } from '../EditToolBox/EditToolBox';
import { useContext, useState } from 'react';
Expand Down
27 changes: 27 additions & 0 deletions client/src/Map/Device/DeviceLocationEdit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, { useState } from "react";
import { Stack, Typography } from "@mui/material";

export const DeviceLocationEdit = ({ devLocation }) => {
const [isEditLocation, setIsEditLocation] = useState<boolean>(false);
return (
<>
{
isEditLocation
? null
: (
<Stack direction='row'>
<Typography variant='overline'>
{devLocation.map(x => Math.round(x * 1e7) / 1e7).join(',')}
</Typography>
{/* <ButtonTooltip
// tooltip={'Edit location'}
// onClick={() => setIsEditLocation(true)}
>
<Edit />
</ButtonTooltip> */}
</Stack>
)
}
</>
)
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Marker, Popup, Tooltip } from "react-leaflet";
import { SingleDevicePropertiesView } from "./SingleDevicePropertiesView";
import { useContext, useEffect, useRef } from "react";
import { usePopupSwitch } from "./PopupSwitchContext";
import { experimentContext } from "../Context/ExperimentProvider";
import { usePopupSwitch } from "../PopupSwitchContext";
import { experimentContext } from "../../Context/ExperimentProvider";
import { renderToStaticMarkup } from "react-dom/server";
import { divIcon } from "leaflet";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faMapMarkerAlt } from "@fortawesome/free-solid-svg-icons";
import { IconDeviceByName } from "../Experiment/IconPicker";
import { IconDeviceByName } from "../../Experiment/IconPicker";

export const DeviceMarker = ({ deviceOnTrial, setDeviceOnTrial, showDeviceNames }) => {
const { selection, setLocationsToDevices, currTrial } = useContext(experimentContext);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useContext } from "react";
import { experimentContext } from "../Context/ExperimentProvider";
import { RealMapName } from "../constants/constants";
import { experimentContext } from "../../Context/ExperimentProvider";
import { RealMapName } from "../../constants/constants";
import { DeviceMarker } from "./DeviceMarker";
import { PopupSwitchProvider } from "./PopupSwitchContext";
import { AreaMarkListener } from "./AreaMarkListener";
import { PopupSwitchProvider } from "../PopupSwitchContext";
import { AreaMarkListener } from "../AreaMarkListener";

export const DeviceMarkersShown = ({ showDeviceNames }) => {
const { currTrial, setTrialData, selection, setSelection, hiddenDeviceTypes } = useContext(experimentContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ import {
Edit,
LocationOff,
} from "@mui/icons-material";
import { ButtonTooltip } from '../Utils/ButtonTooltip';
import { experimentContext } from '../Context/ExperimentProvider';
import { SelectDeviceButton } from '../Experiment/SelectDeviceButton';
import { AttributeItemList } from '../Experiment/AttributeItemList';
import { SCOPE_TRIAL } from '../Experiment/AttributeType';
import { AddContainedButton } from '../Experiment/Contained/AddContainedButton';
import { ContainedDevice } from '../Experiment/Contained/ContainedDevice';
import { ButtonTooltip } from '../../Utils/ButtonTooltip';
import { experimentContext } from '../../Context/ExperimentProvider';
import { SelectDeviceButton } from '../../Experiment/SelectDeviceButton';
import { AttributeItemList } from '../../Experiment/AttributeItemList';
import { SCOPE_TRIAL } from '../../Experiment/AttributeType';
import { AddContainedButton } from '../../Experiment/Contained/AddContainedButton';
import { ContainedDevice } from '../../Experiment/Contained/ContainedDevice';
import { DeviceLocationEdit } from './DeviceLocationEdit';

export const SingleDevicePropertiesView = ({ deviceOnTrial, setDeviceOnTrial, children }) => {
const [isEditLocation, setIsEditLocation] = useState(false);

const { currTrial, setLocationsToDevices, setTrialData } = useContext(experimentContext);
const experiment = currTrial.experiment || {};
const { deviceTypeName, deviceItemName } = deviceOnTrial;
Expand Down Expand Up @@ -45,22 +44,9 @@ export const SingleDevicePropertiesView = ({ deviceOnTrial, setDeviceOnTrial, ch
{deviceTypeName}
</Typography>
<br />
{
isEditLocation
? null
: <Stack direction='row'>
<Typography variant='overline'>
{devLocation.map(x => Math.round(x * 1e7) / 1e7).join(',')}
</Typography>
{/* <ButtonTooltip
// tooltip={'Edit location'}
// onClick={() => setIsEditLocation(true)}
>
<Edit />
</ButtonTooltip> */}
</Stack>
}
<br />
<DeviceLocationEdit
devLocation={devLocation}
/>
{deviceItem
? <AttributeItemList
attributeTypes={deviceType.attributeTypes}
Expand Down

0 comments on commit 3703b3e

Please sign in to comment.