Skip to content

Commit dbb8ab1

Browse files
committed
Remove automatic workspace cell injection in grid pages
Refactored gridsetProcessor to stop injecting a workspace/message bar cell at the top of all pages and adjusted row calculation logic accordingly. Updated tests to expect no mandatory workspace cells and fixed OBLA test asset paths.
1 parent ce6a026 commit dbb8ab1

3 files changed

Lines changed: 17 additions & 20 deletions

File tree

src/processors/gridsetProcessor.ts

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,33 +1331,21 @@ class GridsetProcessor extends BaseProcessor {
13311331
GridGuid: page.id,
13321332
// Calculate grid dimensions based on actual layout
13331333
ColumnDefinitions: this.calculateColumnDefinitions(page),
1334-
RowDefinitions: this.calculateRowDefinitions(page),
1334+
RowDefinitions: this.calculateRowDefinitions(page, false), // No automatic workspace row injection
13351335
AutoContentCommands: '',
13361336
Cells:
13371337
page.buttons.length > 0
13381338
? {
13391339
Cell: [
1340-
// Add workspace/message bar cell at the top of ALL pages
1341-
// Grid3 uses 0-based coordinates; omit X and Y to use defaults (0, 0)
1342-
{
1343-
'@_ColumnSpan': 4,
1344-
Content: {
1345-
ContentType: 'Workspace',
1346-
ContentSubType: 'Chat',
1347-
Style: {
1348-
BasedOnStyle: 'Workspace',
1349-
},
1350-
},
1351-
},
13521340
// Regular button cells
13531341
...this.filterPageButtons(page.buttons).map((button, btnIndex) => {
13541342
const buttonStyleId = button.style ? addStyle(button.style) : '';
13551343

13561344
// Find button position in grid layout
13571345
const position = this.findButtonPosition(page, button, btnIndex);
13581346

1359-
// Shift all buttons down by 1 row to make room for workspace
1360-
const yOffset = 1;
1347+
// Use position directly from tree
1348+
const yOffset = 0;
13611349

13621350
// Build CaptionAndImage object
13631351
const captionAndImage: Record<string, unknown> = {
@@ -1406,6 +1394,9 @@ class GridsetProcessor extends BaseProcessor {
14061394
'@_ColumnSpan': position.columnSpan,
14071395
'@_RowSpan': position.rowSpan,
14081396
Content: {
1397+
ContentType:
1398+
button.contentType === 'Normal' ? undefined : button.contentType,
1399+
ContentSubType: button.contentSubType,
14091400
Commands: this.generateCommandsFromSemanticAction(button, tree),
14101401
CaptionAndImage: captionAndImage,
14111402
},
@@ -1542,15 +1533,19 @@ class GridsetProcessor extends BaseProcessor {
15421533
}
15431534

15441535
// Helper method to calculate row definitions based on page layout
1545-
private calculateRowDefinitions(page: AACPage): { RowDefinition: any[] } {
1536+
private calculateRowDefinitions(
1537+
page: AACPage,
1538+
addWorkspaceOffset = false
1539+
): { RowDefinition: any[] } {
15461540
let maxRows = 4; // Default minimum
1541+
const offset = addWorkspaceOffset ? 1 : 0;
15471542

15481543
if (page.grid && page.grid.length > 0) {
1549-
maxRows = Math.max(maxRows, page.grid.length);
1544+
maxRows = Math.max(maxRows, page.grid.length + offset);
15501545
} else {
15511546
// Fallback: estimate from button count
15521547
const estimatedCols = Math.ceil(Math.sqrt(page.buttons.length));
1553-
maxRows = Math.max(4, Math.ceil(page.buttons.length / estimatedCols));
1548+
maxRows = Math.max(4, Math.ceil(page.buttons.length / estimatedCols)) + offset;
15541549
}
15551550

15561551
return {

test/gridsetProcessor.roundtrip.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ describe('GridsetProcessor round-trip', () => {
3838
const page1 = tree1.pages[pageId];
3939
const page2 = tree2.pages[pageId];
4040

41+
// Expect exactly the same number of buttons
4142
expect(page2.buttons.length).toBe(page1.buttons.length);
4243

4344
// Compare button labels (allowing for some differences in processing)
@@ -97,6 +98,7 @@ describe('GridsetProcessor round-trip', () => {
9798
const reloadedPage = tree2.pages['grid1'];
9899
expect(reloadedPage).toBeDefined();
99100
expect(reloadedPage.name).toBe('Test Grid');
101+
// We expect exactly 2 buttons - zero injection of mandatory workspace cells
100102
expect(reloadedPage.buttons).toHaveLength(2);
101103

102104
// Check that we have buttons with the expected labels

test/obl.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe('OBL Support', () => {
137137
});
138138

139139
test('should parse real OBLA data from dataset', () => {
140-
const oblaPath = path.join(__dirname, '../obla-improvements/small-obla/small/0036a290e0.obla');
140+
const oblaPath = path.join(__dirname, 'assets/obla/0036a290e0.obla');
141141
const content = fs.readFileSync(oblaPath, 'utf8');
142142
const parsed = OblUtil.parse(content);
143143

@@ -151,7 +151,7 @@ describe('OBL Support', () => {
151151
});
152152

153153
test('bulk test real OBLA files (first 10)', () => {
154-
const oblaDir = path.join(__dirname, '../obla-improvements/small-obla/small');
154+
const oblaDir = path.join(__dirname, 'assets/obla');
155155
const files = fs
156156
.readdirSync(oblaDir)
157157
.filter((f) => f.endsWith('.obla'))

0 commit comments

Comments
 (0)