Skip to content

Commit dfbc903

Browse files
spaarke-devclaude
andcommitted
fix(viewer): correct grid cell overflow + improve graph hub positioning
Grid: Previous CSS used table selectors (th/td) which don't match Fluent DataGrid's div-based cells. Now targets [role="gridcell"] and inner content wrapper (> *) with overflow: hidden + textOverflow: ellipsis. Columns should no longer overlap when resized. Graph: Source node offset further to upper-left (-100px from bounds). Hub nodes offset to upper-right (+100px) with 120px vertical spacing between multiple hubs so they don't stack. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0f74980 commit dfbc903

2 files changed

Lines changed: 27 additions & 10 deletions

File tree

src/client/code-pages/DocumentRelationshipViewer/src/components/DocumentGraph.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,17 @@ const DocumentGraphInner: React.FC<DocumentGraphProps> = ({
125125
if (pn.x > maxX) maxX = pn.x;
126126
if (pn.y < minY) minY = pn.y;
127127
}
128-
const spanX = maxX - minX || 1;
128+
129+
// Pin source node to upper-left, hub nodes to upper-right.
130+
// Use fixed pixel offsets from the bounding box edges so positions
131+
// are predictable regardless of force layout randomness.
132+
const SOURCE_X = minX - 100;
133+
const SOURCE_Y = minY - 100;
134+
const HUB_X = maxX + 100;
135+
const HUB_START_Y = minY - 100;
136+
const HUB_Y_SPACING = 120;
137+
138+
let hubIndex = 0;
129139

130140
return inputNodes.map(node => {
131141
const pos = posMap.get(node.id);
@@ -134,16 +144,17 @@ const DocumentGraphInner: React.FC<DocumentGraphProps> = ({
134144

135145
// Pin source node to upper-left corner
136146
if (node.data.isSource) {
137-
x = minX;
138-
y = minY;
147+
x = SOURCE_X;
148+
y = SOURCE_Y;
139149
}
140150

141151
// Pin parent hub nodes (matter, project, invoice, email) to upper-right
142-
// Offset each hub slightly so they don't stack on top of each other
152+
// Each hub gets its own vertical slot so they don't overlap
143153
const hubTypes = ['matter', 'project', 'invoice', 'email'];
144154
if (node.data.nodeType && hubTypes.includes(node.data.nodeType)) {
145-
x = maxX - spanX * 0.05; // slightly inset from right edge
146-
y = minY;
155+
x = HUB_X;
156+
y = HUB_START_Y + hubIndex * HUB_Y_SPACING;
157+
hubIndex++;
147158
}
148159

149160
return {

src/client/code-pages/DocumentRelationshipViewer/src/components/RelationshipGrid.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,19 @@ const useStyles = makeStyles({
7070
},
7171
grid: {
7272
width: '100%',
73-
tableLayout: 'fixed',
74-
'& th, & td': {
75-
paddingRight: '12px',
73+
// Fluent DataGrid resizable columns: cells must clip content to prevent overlap.
74+
// Target both the cell container and its inner content wrapper.
75+
'& [role="gridcell"], & [role="columnheader"]': {
76+
overflow: 'hidden',
77+
boxSizing: 'border-box',
78+
minWidth: 0,
79+
},
80+
// The inner content div inside each cell needs truncation
81+
'& [role="gridcell"] > *, & [role="columnheader"] > *': {
7682
overflow: 'hidden',
7783
textOverflow: 'ellipsis',
7884
whiteSpace: 'nowrap',
79-
boxSizing: 'border-box',
85+
paddingRight: '12px',
8086
},
8187
},
8288
emptyState: {

0 commit comments

Comments
 (0)