From fed3224f0d07426d1761342f26053cc93540e2b4 Mon Sep 17 00:00:00 2001 From: Nick Beckley Date: Sat, 31 Oct 2026 21:11:06 +0000 Subject: [PATCH] Restore stacked Display selectors in browser and PWA --- Docs/Relationships/Workspace.md | 4 +-- .../Browser/relationships-ribbon.cjs | 27 ++++++++++++++---- .../Help/Articles/RelationshipMap/Overview.md | 2 +- PlotLine/Views/RelationshipMap/Index.cshtml | 28 +++++++++---------- .../wwwroot/css/relationship-workspace.css | 9 ++++-- .../wwwroot/js/application-page-context.js | 9 ++++-- PlotLine/wwwroot/js/relationship-workspace.js | 3 -- 7 files changed, 50 insertions(+), 32 deletions(-) diff --git a/Docs/Relationships/Workspace.md b/Docs/Relationships/Workspace.md index 7495a0da..54995dcf 100644 --- a/Docs/Relationships/Workspace.md +++ b/Docs/Relationships/Workspace.md @@ -32,7 +32,7 @@ Not included: cross-device layout storage, automatic importance suggestions, tim The page is now a single bounded application surface beneath the existing ribbon in browser and PWA mode. A page-scoped shell class removes content-width limits and gutters. Height follows the actual ribbon and viewport via ResizeObserver; internal palettes, history and List scroll without extending the document. The application maximise mode has an explicit restore button and Escape fallback, with no browser fullscreen API. -The toolbar contains Map/List, a named focus chip with clear action, Auto-arrange, Layout and Display. The colour key is pinned beneath the right rail. Display exposes network visibility, Story point and maximise/restore; the original selectors are in the Story point dialog. The map's fit, zoom, centre and select/pan controls form a floating vertical toolbar. The right rail shares its space between Supporting characters and contextual detail. Character detail is built from the same canonical response and includes existing avatar, importance, relationship count and selectable connections/history. List is a separate workspace view; no standalone list remains beneath the map. +The toolbar contains Map/List, a named focus chip with clear action, Auto-arrange, Layout and Display. The colour key is pinned beneath the right rail. Display contains the original story-point selectors, network visibility and update action directly in a stacked panel; the PWA ribbon also includes maximise/restore. The map's fit, zoom, centre and select/pan controls form a floating vertical toolbar. The right rail shares its space between Supporting characters and contextual detail. Character detail is built from the same canonical response and includes existing avatar, importance, relationship count and selectable connections/history. List is a separate workspace view; no standalone list remains beneath the map. The timeline retains its existing state resolver, range keyboard navigation and scene defaults. Presentation adds explicit Initial/End buttons, change dots, progress and selected-scene output. Relationship dialogs retain their form and save path, with avatar pairs and subordinate endpoint selectors. Graph nodes retain Cytoscape and category line colours, adding existing portrait paths or generated initials. Node, label, focus, palette and timeline surfaces use the application's semantic theme tokens and update when the active theme changes. @@ -50,4 +50,4 @@ Only in standalone mode, accounted contributions suppress the entire secondary t Workspace commands explicitly select distinct icons from the existing SVG icon catalogue, including new diagram/navigation glyphs where no suitable icon existed. Layout and Display summaries declare their own icons rather than inheriting the first child command's icon. The shared form renderer also honours an explicitly declared field icon. -Display now contains one network-visibility checkbox and two commands: Story point and maximise/restore. The previous GET selectors and update action remain available in a compact Story point dialog. Its network checkbox remains associated with that original GET form, so submitting the selectors preserves network visibility. The colour key is outside the ribbon and fixed beneath the right palette/detail rail. Both browser and PWA Display panels have no scroll container; focused browser tests assert distinct command glyphs and non-scrolling desktop/mobile menus. +Display contains the original Book, Chapter, Scene and Character focus selectors directly, with simple stacked labels, network visibility and Update Map. The PWA uses an opt-in `data-pwa-fields="stacked"` presentation of the same source form: native select lists remain dropdowns even with hundreds of scenes, avoiding nested popup pickers. Browser presentation matches the earlier stacked panel. The intermediate Story point dialog has been removed. The colour key remains fixed below the right rail; neither Display presentation uses a scroll container. Browser tests verify selector visibility, binding to source fields, actual GET submission of book/chapter/scene, and non-scrolling desktop/mobile panels. diff --git a/PlotLine.Tests/Browser/relationships-ribbon.cjs b/PlotLine.Tests/Browser/relationships-ribbon.cjs index af571ae9..ee82e4e3 100644 --- a/PlotLine.Tests/Browser/relationships-ribbon.cjs +++ b/PlotLine.Tests/Browser/relationships-ribbon.cjs @@ -17,7 +17,9 @@ const base='http://127.0.0.1:5238'; const shell=app.locator('[data-pwa-context-controls]'); async function command(name){ const target=shell.getByRole('button',{name,exact:true,includeHidden:true});assert.equal(await target.count(),1,'single ribbon command '+name); - await target.evaluate(e=>{for(let n=e.parentElement;n;n=n.parentElement)if(n.tagName==='DETAILS')n.open=true;}); + const menu=target.locator('xpath=ancestor::details[@data-compact="true"]').last(); + if(await menu.count() && !(await menu.evaluate(e=>e.open))) await menu.locator(':scope > summary').click(); + await target.waitFor({state:'visible'}); return target; } for(const name of ['Map','List','Full cast','Details','Add relationship','Auto-arrange','Remove focused from map','Reset layout','Characters','Maximise workspace']) await command(name); @@ -25,14 +27,24 @@ const base='http://127.0.0.1:5238'; assert(await shell.locator('[data-help-open]').count(),'Help uses ribbon help'); assert.equal(await shell.locator('.relationship-map-legend-grid').count(),0,'legend removed from ribbon'); assert(await app.locator('.rw-rail .rw-colour-key').isVisible(),'colour key at bottom of right panel'); - await (await command('Story point…')).click(); assert(await app.locator('#rwStoryDialog').evaluate(e=>e.open)); - assert(await app.locator('#rwStoryDialog select').count()>=4,'story selectors remain available in compact dialog'); await app.locator('#rwCloseStory').click(); + await command('Maximise workspace'); + const display=shell.locator('.pd-context-group[aria-label="Display"] > details > .pd-context-menu-content'); + for (const label of ['Book','Chapter','Scene','Character focus']) assert(await display.getByLabel(label,{exact:true}).isVisible(), 'direct stacked selector '+label); + assert.equal(await display.locator('.pd-context-selector').count(),0,'ordinary select lists, no nested picker menus'); + await display.getByLabel('Book',{exact:true}).selectOption('12'); + await display.getByLabel('Chapter',{exact:true}).selectOption('21'); + await display.getByLabel('Scene',{exact:true}).selectOption('100'); + assert.equal(await app.locator('#bookId').inputValue(),'12','book binding'); + assert.equal(await app.locator('#chapterId').inputValue(),'21','chapter binding'); + assert.equal(await app.locator('#sceneId').inputValue(),'100','scene binding'); + await web.locator('.rw-display > summary').click(); + for (const id of ['bookId','chapterId','sceneId']) assert(await web.locator('#'+id).isVisible(),'browser dropdown '+id); + assert(await web.locator('.rw-display > .rw-menu-panel').evaluate(e=>e.scrollHeight<=e.clientHeight+1),'browser Display does not scroll'); const iconPaths=await shell.locator('button.pd-context-command').evaluateAll(nodes=>nodes.map(n=>n.querySelector('svg path')?.getAttribute('d'))); assert(iconPaths.every(Boolean),'every command has a relevant icon'); assert.equal(new Set(iconPaths).size,iconPaths.length,'command icons are distinct'); await command('Maximise workspace'); - const display=shell.locator('.pd-context-group[aria-label="Display"] > details > .pd-context-menu-content'); assert(await display.evaluate(e=>e.scrollHeight<=e.clientHeight+1 && e.scrollWidth<=e.clientWidth+1),'Display has no scrolling'); - assert(await (await command('Story point…')).isVisible()); assert(await (await command('Maximise workspace')).isVisible()); + assert(await (await command('Update Map')).isVisible()); assert(await (await command('Maximise workspace')).isVisible()); const geometry=await app.locator('#rwApp').evaluate(e=>({top:e.getBoundingClientRect().top,board:document.getElementById('rwBoard').getBoundingClientRect().top,rows:getComputedStyle(e).gridTemplateRows.split(' ').length})); assert.equal(geometry.rows,1,'no reserved toolbar grid row');assert(Math.abs(geometry.board-geometry.top)<2,'palettes start immediately, recovered space used'); await (await command('List')).click();assert(await app.locator('#rwListPanel').isVisible());assert.equal(await (await command('List')).getAttribute('aria-pressed'),'true'); @@ -54,6 +66,11 @@ const base='http://127.0.0.1:5238'; assert(await app.locator('.rw-toolbar').isHidden()); await command('Maximise workspace'); assert(await display.evaluate(e=>e.scrollHeight<=e.clientHeight+1 && e.scrollWidth<=e.clientWidth+1),'mobile Display has no scrolling'); + await app.route('**/RelationshipMap?**', route=>route.fulfill({contentType:'text/html',body:'Submitted fixture'})); + const submitted=app.waitForRequest(request=>new URL(request.url()).pathname==='/RelationshipMap'); + await (await command('Update Map')).click(); + const query=new URL((await submitted).url()).searchParams; + assert.equal(query.get('projectId'),'7');assert.equal(query.get('bookId'),'12');assert.equal(query.get('chapterId'),'21');assert.equal(query.get('sceneId'),'100'); await app.goto(base+'/fixture');assert.equal(await app.locator('[data-pwa-context-controls]').getByRole('button',{name:'Add relationship',exact:true}).count(),0,'navigation clears relationship contributions'); assert.deepEqual(errors,[]);console.log('PASS Relationships ribbon: browser fallback, PWA controls/state/menus, recovered height, mobile overflow and navigation cleanup'); } finally {await browser.close();} diff --git a/PlotLine/Help/Articles/RelationshipMap/Overview.md b/PlotLine/Help/Articles/RelationshipMap/Overview.md index 884727cc..9b770bc6 100644 --- a/PlotLine/Help/Articles/RelationshipMap/Overview.md +++ b/PlotLine/Help/Articles/RelationshipMap/Overview.md @@ -37,7 +37,7 @@ Drag empty canvas to pan. Use **+ / −**, Ctrl/Cmd-wheel, or a two-finger pinch Installed PWA users can right-click palette characters, map characters, connections or canvas to access the existing application command menu. The same actions are available through buttons, with no right-click required. Select a connection to inspect its history or edit it at the timeline point. **Map / List** switches between workspace views of the same relationship state. The right rail switches between Supporting characters and contextual Details. Focusing a character shows their relationship count, connections, editing actions and history; selecting a connection shows its current state, notes and history. -Positions, focus, zoom, pan and palette collapse are remembered in this browser for the project/book. They do not sync to other devices. On smaller screens, **Characters** opens a searchable drawer containing the whole cast, and **Details** opens the contextual panel. Selecting a character closes the drawer and returns to the map. The canvas and timeline remain the primary surface. **Display** contains Show full network, **Story point…**, and maximise/restore. Story point opens the existing book/chapter/scene and focus selectors in a separate dialog. The relationship colour key stays at the bottom of the right panel. +Positions, focus, zoom, pan and palette collapse are remembered in this browser for the project/book. They do not sync to other devices. On smaller screens, **Characters** opens a searchable drawer containing the whole cast, and **Details** opens the contextual panel. Selecting a character closes the drawer and returns to the map. The canvas and timeline remain the primary surface. **Display** opens a panel with Book, Chapter, Scene and Character focus select lists stacked under simple labels, followed by Show full network and **Update Map**. These controls are directly available in both browser and PWA mode; choose the story point and select Update Map. The relationship colour key stays at the bottom of the right panel. # Example diff --git a/PlotLine/Views/RelationshipMap/Index.cshtml b/PlotLine/Views/RelationshipMap/Index.cshtml index 8f3455d4..b4d14cee 100644 --- a/PlotLine/Views/RelationshipMap/Index.cshtml +++ b/PlotLine/Views/RelationshipMap/Index.cshtml @@ -24,18 +24,7 @@
Display
-
-
- -
- - - -

Story point and focus

-
+
@@ -61,10 +50,19 @@
- + + Project Start - -
+ + + + + + +