Skip to content

Commit

Permalink
CELE-32 chore: Fix building
Browse files Browse the repository at this point in the history
  • Loading branch information
afonsobspinto committed Aug 1, 2024
1 parent 76a54a9 commit 17dcc23
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const CustomEntitiesDropdown: React.FC<CustomEntitiesDropdownProps> = ({ options
setAutocompleteOptions(filteredOptions);
};

const handleOptionClick = (event: React.MouseEvent, option: Option) => {
const handleOptionClick = (_: React.MouseEvent, option: Option) => {
onSelect(option);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const CustomListItem = ({ data, showTooltip = true, listType, showExtraActions =

const isNeurons = listType === "neurons";

const handleSwitchChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => {
const handleSwitchChange = (_: React.ChangeEvent<HTMLInputElement>, checked: boolean) => {
if (onSwitchChange) {
onSwitchChange(data.id, checked);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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<LegendNodeProps> = ({ name, color, onClick, highlighted }) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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";
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";


Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -249,10 +249,6 @@ const applySplitJoinRulesToNodes = (
// Apply split/join rules to edges
const applySplitJoinRulesToEdges = (
expectedEdges: Set<string>,
toSplit: Set<string>,
toJoin: Set<string>,
includeNeighboringCellsAsIndividualCells: boolean,
workspace: Workspace,
expectedNodes: Set<string>,
connectionMap: Map<string, Connection>
) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 => {
Expand Down
2 changes: 1 addition & 1 deletion applications/visualizer/frontend/src/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ export interface Dataset {
export interface Neuron {
name: string;
// Add other properties as needed
}
}
7 changes: 3 additions & 4 deletions applications/visualizer/frontend/src/theme/twoDStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 17dcc23

Please sign in to comment.