Skip to content

Commit 5ca8402

Browse files
committed
fix comments
1 parent 1f6c14b commit 5ca8402

5 files changed

Lines changed: 12 additions & 58 deletions

File tree

app/components/Input.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ export default function Input({ onValueChange, handleSubmit, graph, icon, node,
3838
const timeout = setTimeout(async () => {
3939

4040
if (!node?.name) {
41-
if (!node?.name) {
42-
setOptions([])
43-
}
41+
setOptions([])
4442
setOpen(false)
4543
return
4644
}

app/components/chat.tsx

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import Image from "next/image";
44
import { AlignLeft, ArrowDown, ArrowRight, ChevronDown, Lightbulb, Undo2 } from "lucide-react";
55
import { Path } from "../page";
66
import Input from "./Input";
7-
import { Graph, GraphData } from "./model";
7+
import { Graph, GraphData, Link } from "./model";
88
import { cn } from "@/lib/utils";
99
import { TypeAnimation } from "react-type-animation";
1010
import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
1111
import { prepareArg } from "../utils";
12-
import { NodeObject } from "react-force-graph-2d";
12+
import { NodeObject, ForceGraphMethods } from "react-force-graph-2d";
1313

1414
type PathData = {
1515
nodes: any[]
@@ -25,50 +25,6 @@ enum MessageTypes {
2525
Text,
2626
}
2727

28-
const EDGE_STYLE = {
29-
"line-color": "gray",
30-
"target-arrow-color": "gray",
31-
"opacity": 0.5,
32-
}
33-
34-
35-
const PATH_EDGE_STYLE = {
36-
width: 0.5,
37-
"line-style": "dashed",
38-
"line-color": "#FF66B3",
39-
"arrow-scale": 0.3,
40-
"target-arrow-color": "#FF66B3",
41-
"opacity": 1
42-
}
43-
44-
const SELECTED_PATH_EDGE_STYLE = {
45-
width: 1,
46-
"line-style": "solid",
47-
"line-color": "#FF66B3",
48-
"arrow-scale": 0.6,
49-
"target-arrow-color": "#FF66B3",
50-
};
51-
52-
const NODE_STYLE = {
53-
"border-width": 0.5,
54-
"color": "gray",
55-
"border-color": "black",
56-
"background-color": "gray",
57-
"opacity": 0.5
58-
}
59-
60-
const PATH_NODE_STYLE = {
61-
"border-width": 0.5,
62-
"border-color": "#FF66B3",
63-
"border-opacity": 1,
64-
}
65-
66-
const SELECTED_PATH_NODE_STYLE = {
67-
"border-width": 1,
68-
"border-color": "#FF66B3",
69-
"border-opacity": 1,
70-
};
71-
7228
interface Message {
7329
type: MessageTypes;
7430
text?: string;
@@ -85,7 +41,7 @@ interface Props {
8541
isPathResponse: boolean | undefined
8642
setIsPathResponse: (isPathResponse: boolean | undefined) => void
8743
setData: Dispatch<SetStateAction<GraphData>>
88-
chartRef: any
44+
chartRef: React.MutableRefObject<ForceGraphMethods<Node, Link>>
8945
}
9046

9147
const SUGGESTIONS = [

app/components/code-graph.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Checkbox } from '@/components/ui/checkbox';
1414
import dynamic from 'next/dynamic';
1515
import { Position } from "./graphView";
1616
import { prepareArg } from '../utils';
17-
import { NodeObject } from "react-force-graph-2d";
17+
import { NodeObject, ForceGraphMethods } from "react-force-graph-2d";
1818

1919
const GraphView = dynamic(() => import('./graphView'));
2020

@@ -27,7 +27,7 @@ interface Props {
2727
setOptions: Dispatch<SetStateAction<string[]>>
2828
isShowPath: boolean
2929
setPath: Dispatch<SetStateAction<Path | undefined>>
30-
chartRef: RefObject<any>
30+
chartRef: React.MutableRefObject<ForceGraphMethods<Node, Link>>
3131
selectedValue: string
3232
selectedPathId: number | undefined
3333
setSelectedPathId: (selectedPathId: number) => void
@@ -178,8 +178,6 @@ export function CodeGraph({
178178

179179
const isTarget = graph.Elements.links.some(link => link.target.id === node.id && nodes.some(n => n.id === link.source.id));
180180

181-
debugger
182-
183181
if (!isTarget) return true
184182

185183
const deleted = graph.NodesMap.delete(Number(node.id))

app/components/graphView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import ForceGraph2D from 'react-force-graph-2d';
2+
import ForceGraph2D, { ForceGraphMethods } from 'react-force-graph-2d';
33
import { Graph, GraphData, Link, Node } from './model';
44
import { Dispatch, RefObject, SetStateAction, useEffect, useRef, useState } from 'react';
55
import { Path } from '../page';
@@ -13,7 +13,7 @@ interface Props {
1313
data: GraphData
1414
setData: Dispatch<SetStateAction<GraphData>>
1515
graph: Graph
16-
chartRef: RefObject<any>
16+
chartRef: React.MutableRefObject<ForceGraphMethods<Node, Link>>
1717
selectedObj: Node | Link | undefined
1818
setSelectedObj: Dispatch<SetStateAction<Node | Link | undefined>>
1919
selectedObjects: Node[]

app/components/toolbar.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { CircleDot, Minus, Plus } from "lucide-react";
22
import { cn } from "@/lib/utils"
3-
import { RefObject } from "react";
3+
import { ForceGraphMethods } from "react-force-graph-2d";
4+
import { Node, Link } from "./model";
5+
import { MutableRefObject } from "react";
46

57
interface Props {
6-
chartRef: RefObject<any>
8+
chartRef: MutableRefObject<ForceGraphMethods<Node, Link>>
79
className?: string
810
}
911

0 commit comments

Comments
 (0)