Skip to content

Commit 1b13e7d

Browse files
committed
feat: enhance GraphVisualization and global styles
- Increased font size in globals.css for improved readability. - Refactored loadGraphStructure and loadNodeDetails functions to use useCallback for better performance. - Adjusted node layout parameters in GraphVisualization for enhanced spacing and visual clarity. - Added a Background component to the graph visualization for improved aesthetics. These changes collectively enhance the user experience and visual presentation of the dashboard. auth: @nk-ag
1 parent d09f74b commit 1b13e7d

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

dashboard/src/app/globals.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@
162162
* {
163163
@apply border-border outline-ring/50;
164164
}
165+
html {
166+
font-size: 25px; /* Increased from default 16px */
167+
}
165168
body {
166169
@apply bg-background text-foreground font-sans;
167170
}

dashboard/src/components/GraphVisualization.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const GraphVisualization: React.FC<GraphVisualizationProps> = ({
129129
const [isLoadingNodeDetails, setIsLoadingNodeDetails] = useState(false);
130130
const [nodeDetailsError, setNodeDetailsError] = useState<string | null>(null);
131131

132-
const loadGraphStructure = async () => {
132+
const loadGraphStructure = useCallback(async () => {
133133
setIsLoading(true);
134134
setError(null);
135135

@@ -141,9 +141,9 @@ export const GraphVisualization: React.FC<GraphVisualizationProps> = ({
141141
} finally {
142142
setIsLoading(false);
143143
}
144-
};
144+
}, [namespace, runId]);
145145

146-
const loadNodeDetails = async (nodeId: string, graphName: string) => {
146+
const loadNodeDetails = useCallback(async (nodeId: string, graphName: string) => {
147147
setIsLoadingNodeDetails(true);
148148
setNodeDetailsError(null);
149149

@@ -155,13 +155,13 @@ export const GraphVisualization: React.FC<GraphVisualizationProps> = ({
155155
} finally {
156156
setIsLoadingNodeDetails(false);
157157
}
158-
};
158+
}, [namespace, runId]);
159159

160160
useEffect(() => {
161161
if (namespace && runId) {
162162
loadGraphStructure();
163163
}
164-
}, [namespace, runId]);
164+
}, [namespace, runId, loadGraphStructure]);
165165

166166
// Convert graph data to React Flow format with horizontal layout
167167
const { nodes, edges } = useMemo(() => {
@@ -239,11 +239,11 @@ export const GraphVisualization: React.FC<GraphVisualizationProps> = ({
239239

240240
// Convert to React Flow nodes with horizontal positioning
241241
const reactFlowNodes: Node[] = [];
242-
const layerWidth = 400; // Increased horizontal spacing between layers
243-
const nodeHeight = 150; // Increased vertical spacing between nodes
242+
const layerWidth = 450; // Increased horizontal spacing between layers
243+
const nodeHeight = 250; // Increased vertical spacing between nodes
244244

245245
layers.forEach((layer, layerIndex) => {
246-
const layerX = layerIndex * layerWidth + 150;
246+
const layerX = layerIndex * layerWidth + 200;
247247
const totalHeight = layer.length * nodeHeight;
248248
const startY = (800 - totalHeight) / 2; // Center vertically
249249

@@ -309,7 +309,7 @@ export const GraphVisualization: React.FC<GraphVisualizationProps> = ({
309309
if (graphData?.graph_name) {
310310
loadNodeDetails(graphNode.id, graphData.graph_name);
311311
}
312-
}, [graphData?.graph_name]);
312+
}, [graphData?.graph_name, loadNodeDetails]);
313313

314314
if (isLoading) {
315315
return (
@@ -427,6 +427,7 @@ export const GraphVisualization: React.FC<GraphVisualizationProps> = ({
427427
nodesConnectable={false}
428428
nodesDraggable={false}
429429
>
430+
<Background color="#031035" />
430431
<Controls />
431432
</ReactFlow>
432433
</div>

dashboard/src/components/ui/badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority"
55
import { cn } from "@/lib/utils"
66

77
const badgeVariants = cva(
8-
"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
8+
"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-bold w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
99
{
1010
variants: {
1111
variant: {

0 commit comments

Comments
 (0)