Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function Chat({ messages, setMessages, query, setQuery, selectedPath, set
if (!canvas) return
setSelectedPath(prev => {
if (prev) {
if (isPathResponse && paths.some((path) => [...path.nodes, ...path.links].every((e: any) => [...prev.nodes, ...prev.links].some((e: any) => e.id === e.id)))) {
if (isPathResponse && paths.some((path) => [...path.nodes, ...path.links].every((e: any) => [...prev.nodes, ...prev.links].some((el: any) => el.id === e.id)))) {
graph.getElements().forEach(link => {
const { id } = link

Expand Down
2 changes: 1 addition & 1 deletion app/components/code-graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export function CodeGraph({
useEffect(() => {
const handleKeyDown = (event: KeyboardEvent) => {
if (event.key === 'Delete') {
if (selectedObj && selectedObjects.length === 0) return
if (selectedObjects.length === 0 && !selectedObj) return
handleRemove([...selectedObjects.map(obj => obj.id), selectedObj?.id].filter(id => id !== undefined), "nodes");
}
};
Expand Down
1 change: 0 additions & 1 deletion app/components/dataPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const excludedProperties = [
"expand",
"collapsed",
"isPath",
"isPathSelected",
"visible",
"index",
"curve",
Expand Down
10 changes: 8 additions & 2 deletions app/components/graphView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ export default function GraphView({
}, [zoomedNodes, cooldownTicks, canvasRef])

const nodeCanvasObject = useCallback((node: GraphNode, ctx: CanvasRenderingContext2D) => {
if (!node.x || !node.y) return
if (node.x === undefined || node.y === undefined) {
node.x = 0;
node.y = 0;
}

const isHovered = !!hoverElement && !('source' in hoverElement) && hoverElement.id === node.id
const isSelected = selectedObjects.some(obj => obj.id === node.id) || selectedObj?.id === node.id
Expand Down Expand Up @@ -231,7 +234,10 @@ export default function GraphView({
}, [selectedObj, selectedObjects, isPathResponse, hoverElement])

const nodePointerAreaPaint = useCallback((node: GraphNode, color: string, ctx: CanvasRenderingContext2D) => {
if (!node.x || !node.y) return
if (node.x === undefined || node.y === undefined) {
node.x = 0;
node.y = 0;
}

ctx.fillStyle = color;
ctx.beginPath();
Expand Down
4 changes: 4 additions & 0 deletions app/components/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ export class Graph {

}
this.nodesMap.set(edgeData.src_node, source)
this.elements.nodes.push(source)
newElements.nodes.push(source)
}

if (!target) {
Expand All @@ -227,6 +229,8 @@ export class Graph {
}
}
this.nodesMap.set(edgeData.dest_node, target)
this.elements.nodes.push(target)
newElements.nodes.push(target)
}

let label = this.labelsMap.get(edgeData.relation)
Expand Down
9 changes: 0 additions & 9 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,4 @@

::-webkit-scrollbar-thumb:hover {
background-color: #a8bbbf;
}

@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
18 changes: 9 additions & 9 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,23 +368,23 @@ export default function Home() {
<header className="flex flex-col text-xl">
<div className="flex items-center justify-between py-4 px-8">
<div className="flex gap-4 items-center">
<Link href="https://www.falkordb.com" target='_blank'>
<Link href="https://www.falkordb.com" target='_blank' rel="noopener noreferrer">
<Image src="/logo_02.svg" alt="FalkorDB" width={27.73} height={23.95} />
</Link>
<h1 className='font-bold text-[22px]'>
CODE GRAPH
</h1>
</div>
<ul className="flex gap-4 items-center font-medium">
<Link title="Home" className="flex gap-2.5 items-center p-4" href="https://www.falkordb.com" target='_blank'>
<Link title="Home" className="flex gap-2.5 items-center p-4" href="https://www.falkordb.com" target='_blank' rel="noopener noreferrer">
<HomeIcon />
<p>Main Website</p>
</Link>
<Link title="Github" className="flex gap-2.5 items-center p-4" href="https://github.com/FalkorDB/code-graph" target='_blank'>
<Link title="Github" className="flex gap-2.5 items-center p-4" href="https://github.com/FalkorDB/code-graph" target='_blank' rel="noopener noreferrer">
<Github />
<p>Github</p>
</Link>
<Link title="Discord" className="flex gap-2.5 items-center p-4" href="https://discord.gg/falkordb" target='_blank'>
<Link title="Discord" className="flex gap-2.5 items-center p-4" href="https://discord.gg/falkordb" target='_blank' rel="noopener noreferrer">
<BoomBox />
<p>Discord</p>
</Link>
Expand Down Expand Up @@ -534,7 +534,7 @@ export default function Home() {
</div>
<div className='flex flex-col md:hidden h-full overflow-hidden' id='mobile'>
<header className='flex justify-center items-center relative bg-gray-100'>
<Link href="https://www.falkordb.com" target='_blank'>
<Link href="https://www.falkordb.com" target='_blank' rel="noopener noreferrer">
<Image priority style={{ width: 'auto', height: '70px', background: "transparent" }} src="/code-graph-logo.svg" alt="FalkorDB" width={0} height={0} />
</Link>
<button className='absolute top-6 right-4' onClick={() => setMenuOpen(prev => !prev)}>
Expand All @@ -546,17 +546,17 @@ export default function Home() {
<div className='absolute bottom-0 top-[70px] left-0 right-0 z-20 bg-white shadow-lg'>
<ul className='h-full flex flex-col gap-16 p-8 items-center'>
<li>
<Link href="https://github.com/FalkorDB/code-graph" target='_blank'>
<Link href="https://github.com/FalkorDB/code-graph" target='_blank' rel="noopener noreferrer">
<p>Github</p>
</Link>
</li>
<li>
<Link href="https://discord.gg/falkordb" target='_blank'>
<Link href="https://discord.gg/falkordb" target='_blank' rel="noopener noreferrer">
<p>Discord</p>
</Link>
</li>
<li>
<Link href="https://www.falkordb.com" target='_blank'>
<Link href="https://www.falkordb.com" target='_blank' rel="noopener noreferrer">
<p>Main Website</p>
</Link>
</li>
Expand Down Expand Up @@ -614,7 +614,7 @@ export default function Home() {
searchNode={searchNode}
cooldownTicks={cooldownTicks}
setCooldownTicks={setCooldownTicks}
onCategoryClick={(name, show) => onCategoryClick(name, show, desktopChartRef)}
onCategoryClick={(name, show) => onCategoryClick(name, show, mobileChartRef)}
handleDownloadImage={handleDownloadImage}
zoomedNodes={zoomedNodes}
setZoomedNodes={setZoomedNodes}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "code-graph",
"version": "0.2.0",
"version": "0.3.0",
"private": true,
"scripts": {
"dev": "HOST=0.0.0.0 PORT=3000 next dev",
Expand Down
Loading