diff --git a/applications/visualizer/frontend/src/components/ViewerContainer/CustomEntitiesDropdown.tsx b/applications/visualizer/frontend/src/components/ViewerContainer/CustomEntitiesDropdown.tsx index 2ac152a3..be94bdea 100644 --- a/applications/visualizer/frontend/src/components/ViewerContainer/CustomEntitiesDropdown.tsx +++ b/applications/visualizer/frontend/src/components/ViewerContainer/CustomEntitiesDropdown.tsx @@ -40,7 +40,7 @@ const CustomEntitiesDropdown: React.FC = ({ options setAutocompleteOptions(filteredOptions); }; - const handleOptionClick = (event: React.MouseEvent, option: Option) => { + const handleOptionClick = (_: React.MouseEvent, option: Option) => { onSelect(option); }; diff --git a/applications/visualizer/frontend/src/components/ViewerContainer/CustomListItem.tsx b/applications/visualizer/frontend/src/components/ViewerContainer/CustomListItem.tsx index e57b6abe..6bad2aaf 100644 --- a/applications/visualizer/frontend/src/components/ViewerContainer/CustomListItem.tsx +++ b/applications/visualizer/frontend/src/components/ViewerContainer/CustomListItem.tsx @@ -14,7 +14,7 @@ const CustomListItem = ({ data, showTooltip = true, listType, showExtraActions = const isNeurons = listType === "neurons"; - const handleSwitchChange = (event: React.ChangeEvent, checked: boolean) => { + const handleSwitchChange = (_: React.ChangeEvent, checked: boolean) => { if (onSwitchChange) { onSwitchChange(data.id, checked); } diff --git a/applications/visualizer/frontend/src/components/viewers/TwoD/ContextMenu.tsx b/applications/visualizer/frontend/src/components/viewers/TwoD/ContextMenu.tsx index 81ed78e1..300d822a 100644 --- a/applications/visualizer/frontend/src/components/viewers/TwoD/ContextMenu.tsx +++ b/applications/visualizer/frontend/src/components/viewers/TwoD/ContextMenu.tsx @@ -1,6 +1,7 @@ -import React, {useMemo} from "react"; +import type React from "react"; +import {useMemo} from "react"; import {Menu, MenuItem} from "@mui/material"; -import {NeuronGroup, Workspace} from "../../../models"; +import {type NeuronGroup} from "../../../models"; import {isNeuronClass} from "../../../helpers/twoD/twoDHelpers.ts"; import {useSelectedWorkspace} from "../../../hooks/useSelectedWorkspace.ts"; diff --git a/applications/visualizer/frontend/src/components/viewers/TwoD/TwoDLegend.tsx b/applications/visualizer/frontend/src/components/viewers/TwoD/TwoDLegend.tsx index 02d75b6a..71af2df6 100644 --- a/applications/visualizer/frontend/src/components/viewers/TwoD/TwoDLegend.tsx +++ b/applications/visualizer/frontend/src/components/viewers/TwoD/TwoDLegend.tsx @@ -1,6 +1,6 @@ import {Box, Divider, IconButton, Typography} from "@mui/material"; -import React from "react"; -import {ColoringOptions, getColorMap, legendNodeNameMapping} from "../../../helpers/twoD/coloringHelper"; +import type React from "react"; +import {type ColoringOptions, getColorMap, legendNodeNameMapping} from "../../../helpers/twoD/coloringHelper"; import {LegendType, connectionsLegend, annotationLegend} from "../../../settings/twoDSettings"; import {vars} from "../../../theme/variables"; @@ -10,12 +10,14 @@ interface LegendNodeProps { name: string; color: string; onClick: () => void; + highlighted: boolean } interface LegendConnectionProps { name: string; icon: JSX.Element; onClick: () => void; + highlighted: boolean; } const LegendNode: React.FC = ({ name, color, onClick, highlighted }) => ( diff --git a/applications/visualizer/frontend/src/components/viewers/TwoD/TwoDViewer.tsx b/applications/visualizer/frontend/src/components/viewers/TwoD/TwoDViewer.tsx index de7c36ac..34fbe6a8 100644 --- a/applications/visualizer/frontend/src/components/viewers/TwoD/TwoDViewer.tsx +++ b/applications/visualizer/frontend/src/components/viewers/TwoD/TwoDViewer.tsx @@ -1,5 +1,5 @@ -import React, {useState, useEffect, useRef} from "react"; -import cytoscape, {type Core} from "cytoscape"; +import {useState, useEffect, useRef} from "react"; +import cytoscape, {type Core, type EventHandler} from "cytoscape"; import fcose from "cytoscape-fcose"; import dagre from "cytoscape-dagre"; import {useSelectedWorkspace} from "../../../hooks/useSelectedWorkspace"; @@ -9,7 +9,7 @@ import {applyLayout} from "../../../helpers/twoD/twoDHelpers"; import { CHEMICAL_THRESHOLD, ELECTRICAL_THRESHOLD, - GRAPH_LAYOUTS, LegendType, + GRAPH_LAYOUTS, type LegendType, INCLUDE_ANNOTATIONS, INCLUDE_NEIGHBORING_CELLS, INCLUDE_LABELS, INCLUDE_POST_EMBRYONIC } from "../../../settings/twoDSettings"; @@ -165,13 +165,16 @@ const TwoDViewer = () => { } }; - const handleContextMenu = (event: MouseEvent) => { + const handleContextMenu: EventHandler = (event) => { event.preventDefault(); + const cyEvent = event as any; // Cast to any to access originalEvent + const originalEvent = cyEvent.originalEvent as MouseEvent; + if (workspace.selectedNeurons.size > 0) { setMousePosition({ - mouseX: event.originalEvent.clientX, - mouseY: event.originalEvent.clientY, + mouseX: originalEvent.clientX, + mouseY: originalEvent.clientY, }); } else { setMousePosition(null); diff --git a/applications/visualizer/frontend/src/helpers/twoD/graphRendering.ts b/applications/visualizer/frontend/src/helpers/twoD/graphRendering.ts index 5f1960d2..6a3ea74b 100644 --- a/applications/visualizer/frontend/src/helpers/twoD/graphRendering.ts +++ b/applications/visualizer/frontend/src/helpers/twoD/graphRendering.ts @@ -7,8 +7,8 @@ import { isNeuronCell, isNeuronClass } from './twoDHelpers'; -import {NeuronGroup, Workspace} from "../../models"; -import {Connection} from "../../rest"; +import type {NeuronGroup, Workspace} from "../../models"; +import type {Connection} from "../../rest"; import {LegendType} from "../../settings/twoDSettings.tsx"; @@ -82,7 +82,7 @@ export const computeGraphDifferences = ( // Apply split and join rules to expected nodes and edges expectedNodes = applySplitJoinRulesToNodes(expectedNodes, splitJoinState.split, splitJoinState.join, includeNeighboringCellsAsIndividualCells, workspace); - expectedEdges = applySplitJoinRulesToEdges(expectedEdges, splitJoinState.split, splitJoinState.join, includeNeighboringCellsAsIndividualCells, workspace, expectedNodes, connectionMap); + expectedEdges = applySplitJoinRulesToEdges(expectedEdges, expectedNodes, connectionMap); // Replace individual neurons and edges with groups if necessary expectedNodes = replaceNodesWithGroups(expectedNodes, workspace.neuronGroups, hiddenNodes); @@ -209,7 +209,7 @@ const replaceEdgesWithGroups = ( } }); - groupedConnections.forEach((conn, newEdgeId) => { + groupedConnections.forEach((conn) => { const fullNewEdgeId = getEdgeId(conn, includeAnnotations); edgesToAdd.add(fullNewEdgeId); connectionMap.set(fullNewEdgeId, conn); @@ -249,10 +249,6 @@ const applySplitJoinRulesToNodes = ( // Apply split/join rules to edges const applySplitJoinRulesToEdges = ( expectedEdges: Set, - toSplit: Set, - toJoin: Set, - includeNeighboringCellsAsIndividualCells: boolean, - workspace: Workspace, expectedNodes: Set, connectionMap: Map ) => { diff --git a/applications/visualizer/frontend/src/helpers/twoD/twoDHelpers.ts b/applications/visualizer/frontend/src/helpers/twoD/twoDHelpers.ts index 8976932f..d7b0a8d7 100644 --- a/applications/visualizer/frontend/src/helpers/twoD/twoDHelpers.ts +++ b/applications/visualizer/frontend/src/helpers/twoD/twoDHelpers.ts @@ -1,7 +1,7 @@ import type { Core, ElementDefinition } from "cytoscape"; import type { Connection } from "../../rest"; import type { Workspace } from "../../models/workspace.ts"; -import {annotationLegend, LegendType} from "../../settings/twoDSettings.tsx"; +import {annotationLegend} from "../../settings/twoDSettings.tsx"; import {cellConfig, neurotransmitterConfig} from "./coloringHelper.ts"; export const createEdge = (id: string, conn: Connection, workspace: Workspace, includeAnnotations: boolean): ElementDefinition => { diff --git a/applications/visualizer/frontend/src/models/models.ts b/applications/visualizer/frontend/src/models/models.ts index 2f67409e..0ae6a54a 100644 --- a/applications/visualizer/frontend/src/models/models.ts +++ b/applications/visualizer/frontend/src/models/models.ts @@ -31,4 +31,4 @@ export interface Dataset { export interface Neuron { name: string; // Add other properties as needed -} +} \ No newline at end of file diff --git a/applications/visualizer/frontend/src/theme/twoDStyles.ts b/applications/visualizer/frontend/src/theme/twoDStyles.ts index 9bd23229..d456a46e 100644 --- a/applications/visualizer/frontend/src/theme/twoDStyles.ts +++ b/applications/visualizer/frontend/src/theme/twoDStyles.ts @@ -65,15 +65,14 @@ const EDGE_LABEL_STYLES = [ } ]; -const ANNOTATION_STYLES = Object.entries(annotationLegend).map(([key, { id, color }]) => ({ +const ANNOTATION_STYLES = Object.entries(annotationLegend).map(([, { id, color }]) => ({ selector: `.${id}`, style: { - "line-color": color, - "target-arrow-color": color, + 'line-color': color, + 'target-arrow-color': color, }, })); - export const GRAPH_STYLES = [ { selector: "node",