From 336c7efb0454c75955c0126d4c43e76ba9418cda Mon Sep 17 00:00:00 2001 From: Diogo Correia Date: Tue, 17 Dec 2024 15:24:59 +0000 Subject: [PATCH] CELE-116 Code review changes --- .../{viewers/ThreeD => }/CustomFormControlLabel.tsx | 4 ++-- .../src/components/viewers/EM/EMStackTilesViewer.tsx | 3 +-- .../frontend/src/components/viewers/EM/SceneControls.tsx | 5 ++--- .../frontend/src/components/viewers/ThreeD/SceneControls.tsx | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) rename applications/visualizer/frontend/src/components/{viewers/ThreeD => }/CustomFormControlLabel.tsx (91%) diff --git a/applications/visualizer/frontend/src/components/viewers/ThreeD/CustomFormControlLabel.tsx b/applications/visualizer/frontend/src/components/CustomFormControlLabel.tsx similarity index 91% rename from applications/visualizer/frontend/src/components/viewers/ThreeD/CustomFormControlLabel.tsx rename to applications/visualizer/frontend/src/components/CustomFormControlLabel.tsx index 0ee2b15b..ef957d7e 100644 --- a/applications/visualizer/frontend/src/components/viewers/ThreeD/CustomFormControlLabel.tsx +++ b/applications/visualizer/frontend/src/components/CustomFormControlLabel.tsx @@ -1,7 +1,7 @@ import HelpOutlineIcon from "@mui/icons-material/HelpOutline"; import { Box, FormControlLabel, Stack, Tooltip, Typography } from "@mui/material"; -import { vars } from "../../../theme/variables.ts"; // Adjust the import path as needed -import CustomSwitch from "../../ViewerContainer/CustomSwitch.tsx"; +import { vars } from "./../theme/variables.ts"; // Adjust the import path as needed +import CustomSwitch from "./ViewerContainer/CustomSwitch.tsx"; interface CustomFormControlLabel { label: React.ReactNode; diff --git a/applications/visualizer/frontend/src/components/viewers/EM/EMStackTilesViewer.tsx b/applications/visualizer/frontend/src/components/viewers/EM/EMStackTilesViewer.tsx index 80539280..05970abe 100644 --- a/applications/visualizer/frontend/src/components/viewers/EM/EMStackTilesViewer.tsx +++ b/applications/visualizer/frontend/src/components/viewers/EM/EMStackTilesViewer.tsx @@ -105,8 +105,7 @@ function synapsesStyle(feature: FeatureLike, workspace: Workspace): Style { type LayerSelector = [VectorLayer | undefined, (feature: Feature, next: () => void) => void]; function selectAcrossLayers(position: Coordinate, ...selectors: LayerSelector[]) { - for (let i = 0; i < selectors.length; i++) { - const [layer, handler] = selectors[i]; + for (const [layer, handler] of selectors) { const source = layer?.getSource(); const features = source?.getFeaturesAtCoordinate(position); if (!features || features.length === 0) { diff --git a/applications/visualizer/frontend/src/components/viewers/EM/SceneControls.tsx b/applications/visualizer/frontend/src/components/viewers/EM/SceneControls.tsx index bea37d67..20a69e66 100644 --- a/applications/visualizer/frontend/src/components/viewers/EM/SceneControls.tsx +++ b/applications/visualizer/frontend/src/components/viewers/EM/SceneControls.tsx @@ -4,7 +4,7 @@ import ZoomOutIcon from "@mui/icons-material/ZoomOut"; import { Box, Divider, IconButton, Popover, Typography } from "@mui/material"; import Tooltip from "@mui/material/Tooltip"; import { useState } from "react"; -import CustomFormControlLabel from "../ThreeD/CustomFormControlLabel"; +import CustomFormControlLabel from "../../CustomFormControlLabel"; import { vars } from "../../../theme/variables.ts"; const { gray500 } = vars; @@ -41,8 +41,7 @@ function SceneControls({ onZoomIn, onResetView, onZoomOut, onPrint, layers }: Sc setAnchorEl(null); }; - const layersControlsElems = Object.keys(layers).map((key) => { - const { label, checked, onToggle } = layers[key as keyof LayersControlsHandlers]; + const layersControlsElems = Object.entries(layers).map(([key, { label, checked, onToggle }]) => { return (