Skip to content

Commit

Permalink
Merge branch 'main' into fix-create-graph
Browse files Browse the repository at this point in the history
  • Loading branch information
AviAvni authored Apr 21, 2024
2 parents 9ef48c9 + 90574b8 commit c425f82
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 47 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
[![Discord](https://img.shields.io/discord/1146782921294884966?style=flat-square)](https://discord.gg/6M4QwDXn2w)
[![Workflow](https://github.com/FalkorDB/falkordb-browser/actions/workflows/nextjs.yml/badge.svg?branch=main)](https://github.com/FalkorDB/falkordb-browser/actions/workflows/nextjs.yml)

# FalkorDB-Browser

[![Try Free](https://img.shields.io/badge/Try%20Free-FalkorDB%20Cloud-FF8101?labelColor=FDE900&style=for-the-badge&link=https://app.falkordb.cloud)](https://app.falkordb.cloud)

FalkorDB-Browser is a visualization UI for FalkorDB.

To see a running demo check: https://browser.falkordb.com/
To see a running demo, check: https://browser.falkordb.com/

![image](https://github.com/FalkorDB/falkordb-browser/assets/753206/51a81ef9-6bb2-40ce-ad9b-6381978c7562)

Expand Down
1 change: 0 additions & 1 deletion app/api/graph/[graph]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export async function PATCH(request: NextRequest, { params }: { params: { graph:
if (!newName) throw (new Error("Missing parameter 'newName'"))

const data = await client.connection.renameNX(graphId, newName);
console.log(data);

if (!data) throw (new Error(`${newName} already exists`))

Expand Down
9 changes: 5 additions & 4 deletions app/graph/DataPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";

interface Props {
Expand All @@ -17,9 +17,10 @@ const excludedProperties = new Set([
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export default function DataPanel({ object }: Props) {
const rowClass = "dark:hover:bg-slate-700 hover:bg-gray-400 border-y-[1px] border-y-gray-700"

const type = object.source ? "edge" : "node"
return (
<Table>
<TableCaption>{type} properties</TableCaption>
<TableHeader>
<TableRow className={rowClass}>
<TableHead>Field</TableHead>
Expand All @@ -38,10 +39,10 @@ export default function DataPanel({ object }: Props) {
const text = cellIndex === 1 ? JSON.parse(strCell) : strCell
return (
// eslint-disable-next-line react/no-array-index-key
<TableCell key={cellIndex}>
<TableCell className="max-w-10" key={cellIndex}>
<TooltipProvider>
<Tooltip>
<TooltipTrigger className="max-w-96 truncate">
<TooltipTrigger className="w-full truncate" >
{text}
</TooltipTrigger>
<TooltipContent>
Expand Down
55 changes: 20 additions & 35 deletions app/graph/toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { CircleDot, ZoomIn, ZoomOut } from "lucide-react";
import { cn } from "@/lib/utils"

Expand All @@ -22,39 +21,25 @@ export default function Toolbar({ chartRef, className = "" }: {
}

return (
<TooltipProvider>
<ul className={cn("flex flex-row gap-2", className)}>
<li>
<Tooltip>
<TooltipTrigger className="text-gray-600 dark:text-gray-400 rounded-lg border border-gray-300 p-2" onClick={() => handleZoomClick(1.1)}>
<ZoomIn />
</TooltipTrigger>
<TooltipContent>
<p>Zoom In</p>
</TooltipContent>
</Tooltip>
</li>
<li>
<Tooltip>
<TooltipTrigger className="text-gray-600 dark:text-gray-400 rounded-lg border border-gray-300 p-2" onClick={() => handleZoomClick(0.9)}>
<ZoomOut />
</TooltipTrigger>
<TooltipContent>
<p>Zoom Out</p>
</TooltipContent>
</Tooltip>
</li>
<li>
<Tooltip>
<TooltipTrigger className="text-gray-600 dark:text-gray-400 rounded-lg border border-gray-300 p-2" onClick={handleCenterClick}>
<CircleDot />
</TooltipTrigger>
<TooltipContent>
<p>Center</p>
</TooltipContent>
</Tooltip>
</li>
</ul>
</TooltipProvider>
<ul className={cn("flex flex-row gap-2", className)}>
<li>
<button title="Zoom In" type="button" className="text-gray-600 dark:text-gray-400 rounded-lg border border-gray-300 p-2" onClick={() => handleZoomClick(1.1)}>
{ /* eslint-disable jsx-a11y/control-has-associated-label */}
< ZoomIn />
</button>
</li>
<li>
<button title="Zoom Out" type="button" className="text-gray-600 dark:text-gray-400 rounded-lg border border-gray-300 p-2" onClick={() => handleZoomClick(0.9)}>
{ /* eslint-disable jsx-a11y/control-has-associated-label */}
<ZoomOut />
</button>
</li>
<li>
<button title="Center" type="button" className="text-gray-600 dark:text-gray-400 rounded-lg border border-gray-300 p-2" onClick={() => handleCenterClick()}>
{ /* eslint-disable jsx-a11y/control-has-associated-label */}
<CircleDot />
</button>
</li>
</ul>
)
}
8 changes: 4 additions & 4 deletions app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import useScreenSize from "./useScreenSize";
export default function NextAuthProvider({ children }: { children: React.ReactNode }) {

const { screenSize } = useScreenSize();
const isSmallScreen = screenSize === 'sm' || screenSize === 'xs'
const isSmallScreen = screenSize === 'sm' || screenSize === 'xs' || screenSize === 'md'

const [isCollapsed, setCollapsed] = useState(isSmallScreen)
const navPanel = useRef<ImperativePanelHandle>(null)
Expand All @@ -35,8 +35,8 @@ export default function NextAuthProvider({ children }: { children: React.ReactNo
}
}
}
const panelSize = 9
const collapsedSize = 3
const panelSize = isSmallScreen ? 7 : 9
const collapsedSize = isSmallScreen ? 7 : 3

return (
<SessionProvider>
Expand All @@ -51,7 +51,7 @@ export default function NextAuthProvider({ children }: { children: React.ReactNo
minSize={panelSize}
onCollapse={() => { setCollapsed(true) }}
onExpand={() => { setCollapsed(false) }}>
<button type="button" className="fixed top-[50%] left-2" onClick={() => onExpand()}>
<button title={isCollapsed ? "open" : "close"} type="button" className="fixed top-[50%] left-2" onClick={() => onExpand()}>
{isCollapsed ? <ChevronRight /> : <ChevronLeft />}
</button>
<Navbar collapsed={isCollapsed} />
Expand Down
5 changes: 3 additions & 2 deletions components/custom/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function Navbar({ collapsed }: { collapsed: boolean }) {
const [mounted, setMounted] = useState(false)
const pathName = usePathname()
const darkmode = theme === "dark" || (theme === "system" && systemTheme === "dark")

useEffect(() => {
setMounted(true)
}, [])
Expand All @@ -62,6 +62,7 @@ export default function Navbar({ collapsed }: { collapsed: boolean }) {
// eslint-disable-next-line react/no-array-index-key
<li key={index}>
<Link
title={link.name}
className={cn("underline underline-offset-2 flex gap-2", pathName === link.href ? '' : 'text-blue-300')}
href={link.href} onClick={link.onClick}
>
Expand All @@ -81,7 +82,7 @@ export default function Navbar({ collapsed }: { collapsed: boolean }) {
<li key={0}>
{
mounted &&
<button type="button" className="flex flex-row items-center gap-2 underline underline-offset-2 text-blue-300" onClick={() => setTheme(darkmode ? "light" : "dark")}>
<button title="Theme" type="button" className="flex flex-row items-center gap-2 underline underline-offset-2 text-blue-300" onClick={() => setTheme(darkmode ? "light" : "dark")}>
{
darkmode ? <Sun /> : <Moon />
}
Expand Down

0 comments on commit c425f82

Please sign in to comment.