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
251 changes: 249 additions & 2 deletions bun.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/app-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"decode-formdata": "^0.9.0",
"deepsignal": "^1.6.0",
"dinero.js": "2.0.2",
"ego-graph": "workspace:*",
"embla-carousel-react": "^8.6.0",
"firebase": "^12.13.0",
"i18next": "^26.3.0",
Expand Down
24 changes: 3 additions & 21 deletions packages/app-builder/src/components/Graph/GraphImpl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
type NodeMouseHandler,
ReactFlow,
} from '@xyflow/react';
import { reachableNodeIds } from 'ego-graph';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { Icon } from 'ui-icons';
import { type GraphData } from '../../routes/_app/_builder/test-graph/-data';
Expand All @@ -19,21 +20,15 @@ import {
PIVOT_TYPE_ATTRIBUTES,
useCustomerGraph,
} from './CustomerGraphContext';
import { clusterGraphElements } from './cluster-graph';
import { createGraphTypeHelpers } from './data-model-map';
import { graphEdgeTypes, graphNodeTypes } from './GraphComponents';
import { withBestHandles } from './graph-handles';
import { type GraphObjectRef, nodeKey, parseNodeKey } from './graph-keys';
import { clusterGraphElements, type GraphLayoutMode, layoutByMode, withBestHandles } from './graph-layout';
import { type GraphRfEdge, type GraphRfNode } from './graph-rf-types';
import { reachableNodeIds } from './graph-traversal';
import { layoutGraphElements as layoutGraphElementsRadDagre } from './layout-graph';
import { layoutGraphElements as layoutGraphElementsBalanced } from './layout-graph-2';
import { layoutGraphElements as layoutGraphElementsRadial } from './layout-graph-3';
import { toFlatFlowElements } from './utils';
import '@xyflow/react/dist/style.css';
import { match } from 'ts-pattern';

export type GraphLayoutMode = 'rad-dagre' | 'balanced' | 'radial';
export type { GraphLayoutMode };

/** Re-run layout once React Flow has measured node sizes (must be a ReactFlow child). */
function GraphMeasuredLayout({
Expand Down Expand Up @@ -62,19 +57,6 @@ function resolveStartKey(nodes: GraphRfNode[], fallback: string): string {
return start?.id ?? fallback;
}

function layoutByMode(
mode: GraphLayoutMode,
nodes: GraphRfNode[],
edges: GraphRfEdge[],
startKey: string,
): { nodes: GraphRfNode[]; edges: GraphRfEdge[] } {
return match(mode)
.with('balanced', () => layoutGraphElementsBalanced(nodes, edges, startKey))
.with('rad-dagre', () => layoutGraphElementsRadDagre(nodes, edges, startKey))
.with('radial', () => layoutGraphElementsRadial(nodes, edges, startKey))
.exhaustive();
}

type VisibilityFilters = Pick<
CustomerGraphContextValue,
'showPersons' | 'showCompanies' | 'attributes' | 'hiddenNodeIds'
Expand Down
267 changes: 0 additions & 267 deletions packages/app-builder/src/components/Graph/cluster-graph.spec.ts

This file was deleted.

Loading