Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

UI issues

Guy Ben-Aharon78912a9a5fea
diff --git a/src/context/chartdb-context/chartdb-provider.tsx b/src/context/chartdb-context/chartdb-provider.tsx
index 72b34ed2..bafd9ca2 100644
--- a/src/context/chartdb-context/chartdb-provider.tsx
+++ b/src/context/chartdb-context/chartdb-provider.tsx
@@ -85,7 +85,7 @@ export const ChartDBProvider: React.FC<React.PropsWithChildren> = ({
navigate(`/diagrams/${defaultDiagramId}`);
} else {
await db.updateConfig({ defaultDiagramId: '' });
- navigate('/diagrams');
+ navigate('/');
}
}
}, [db, diagramId, navigate]);
diff --git a/src/dialogs/create-diagram-dialog/create-diagram-dialog.tsx b/src/dialogs/create-diagram-dialog/create-diagram-dialog.tsx
index 7e102186..e0c3ceaf 100644
--- a/src/dialogs/create-diagram-dialog/create-diagram-dialog.tsx
+++ b/src/dialogs/create-diagram-dialog/create-diagram-dialog.tsx
@@ -189,7 +189,7 @@ export const CreateDiagramDialog: React.FC<CreateDiagramDialogProps> = ({
}
}}
type="single"
- className="grid grid-cols-3 grid-flow-row gap-6 xl:grid-cols-5"
+ className="grid grid-cols-3 grid-flow-row gap-6"
>
{renderDatabaseOption(DatabaseType.MYSQL)}
{renderDatabaseOption(DatabaseType.POSTGRESQL)}
@@ -248,18 +248,13 @@ export const CreateDiagramDialog: React.FC<CreateDiagramDialogProps> = ({
<DialogFooter className="flex !justify-between gap-2">
{hasExistingDiagram ? (
<DialogClose asChild>
- <Button
- type="button"
- variant="secondary"
- // onClick={createNewDiagram}
- >
+ <Button type="button" variant="secondary">
Cancel
</Button>
</DialogClose>
) : (
<div></div>
)}
- {/* <DialogClose asChild> */}
<div className="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end sm:space-x-2">
<Button
type="button"
@@ -281,13 +276,11 @@ export const CreateDiagramDialog: React.FC<CreateDiagramDialogProps> = ({
Continue
</Button>
</div>
- {/* </DialogClose> */}
</DialogFooter>
);
case CreateDiagramDialogStep.IMPORT_DATABASE:
return (
<DialogFooter className="flex !justify-between gap-2">
- {/* <DialogClose asChild> */}
<div className="flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2">
<Button
type="button"
@@ -301,7 +294,6 @@ export const CreateDiagramDialog: React.FC<CreateDiagramDialogProps> = ({
Back
</Button>
</div>
- {/* </DialogClose> */}
<div className="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end sm:space-x-2">
<DialogClose asChild>
<Button
@@ -354,7 +346,7 @@ export const CreateDiagramDialog: React.FC<CreateDiagramDialogProps> = ({
}}
>
<DialogContent
- className="flex flex-col min-w-[500px] xl:min-w-[75vw] max-h-[80vh] overflow-y-auto"
+ className="flex flex-col min-w-[500px] xl:min-w-[45vw] overflow-y-auto"
showClose={hasExistingDiagram}
>
{renderHeader()}
diff --git a/src/index.css b/src/index.css
index a90f0749..7ae7a440 100644
--- a/src/index.css
+++ b/src/index.css
@@ -2,3 +2,8 @@
@tailwind components;
@tailwind utilities;
+@layer components {
+ .react-flow.canvas-cursor-default .react-flow__pane {
+ @apply cursor-default;
+ }
+}
diff --git a/src/pages/editor-page/canvas/canvas.tsx b/src/pages/editor-page/canvas/canvas.tsx
index 9a1e44c3..e4241bd0 100644
--- a/src/pages/editor-page/canvas/canvas.tsx
+++ b/src/pages/editor-page/canvas/canvas.tsx
@@ -230,6 +230,7 @@ export const Canvas: React.FC<CanvasProps> = () => {
return (
<div className="flex h-full">
<ReactFlow
+ className="canvas-cursor-default"
nodes={nodes}
edges={edges}
onNodesChange={onNodesChangeHandler}
diff --git a/src/pages/editor-page/canvas/table-node-field.tsx b/src/pages/editor-page/canvas/table-node-field.tsx
index 6d6a9f2c..0049a6c8 100644
--- a/src/pages/editor-page/canvas/table-node-field.tsx
+++ b/src/pages/editor-page/canvas/table-node-field.tsx
@@ -42,18 +42,18 @@ export const TableNodeField: React.FC<TableNodeFieldProps> = ({
}, [tableNodeId, updateNodeInternals, numberOfEdgesToField]);
return (
- <div className="flex relative items-center h-8 text-sm px-3 border-t justify-between hover:bg-primary-foreground group last:rounded-b-lg">
+ <div className="flex relative items-center h-8 text-sm px-3 border-t justify-between hover:bg-slate-100 group last:rounded-b-lg">
{!connection.inProgress && (
<>
<Handle
id={`${RIGHT_HANDLE_ID_PREFIX}${field.id}`}
- className={`!h-3 !w-3 !bg-slate-400 ${!focused ? '!invisible' : ''}`}
+ className={`!h-4 !w-4 !border-2 !bg-pink-600 ${!focused ? '!invisible' : ''}`}
position={Position.Right}
type="source"
/>
<Handle
id={`${LEFT_HANDLE_ID_PREFIX}${field.id}`}
- className={`!h-3 !w-3 !bg-slate-400 ${!focused ? '!invisible' : ''}`}
+ className={`!h-4 !w-4 !border-2 !bg-pink-600 ${!focused ? '!invisible' : ''}`}
position={Position.Left}
type="source"
/>
diff --git a/src/pages/editor-page/canvas/table-node.tsx b/src/pages/editor-page/canvas/table-node.tsx
index 8e45189f..e6ab9ea6 100644
--- a/src/pages/editor-page/canvas/table-node.tsx
+++ b/src/pages/editor-page/canvas/table-node.tsx
@@ -30,7 +30,7 @@ export const TableNode: React.FC<NodeProps<TableNodeType>> = ({
return (
<div
- className={`flex flex-col w-full bg-background border ${selected ? 'border-slate-400' : ''} rounded-lg shadow-sm`}
+ className={`flex flex-col w-full bg-slate-50 border-2 ${selected ? 'border-2 border-pink-600' : ''} rounded-lg shadow-sm`}
onClick={(e) => {
if (e.detail === 2) {
openTableInEditor();
@@ -49,7 +49,7 @@ export const TableNode: React.FC<NodeProps<TableNodeType>> = ({
className="h-2 rounded-t-lg"
style={{ backgroundColor: table.color }}
></div>
- <div className="flex items-center h-9 bg-secondary px-2 justify-between group">
+ <div className="flex items-center h-9 bg-slate-200 px-2 justify-between group">
<div className="flex items-center gap-1">
<Table2 className="h-3.5 w-3.5 text-gray-600" />
<Label className="text-sm font-bold">{table.name}</Label>
diff --git a/src/pages/editor-page/top-navbar/top-navbar.tsx b/src/pages/editor-page/top-navbar/top-navbar.tsx
index 3b814bff..2c399708 100644
--- a/src/pages/editor-page/top-navbar/top-navbar.tsx
+++ b/src/pages/editor-page/top-navbar/top-navbar.tsx
@@ -247,6 +247,7 @@ export const TopNavbar: React.FC<TopNavbarProps> = () => {
</MenubarSub>
<MenubarSeparator />
<MenubarItem
+ className="!text-red-700"
onClick={() =>
showAlert({
title: 'Delete Diagram',