diff --git a/PlotLine.Tests/Browser/narrative-focus-popup.cjs b/PlotLine.Tests/Browser/narrative-focus-popup.cjs index 03994fac..7bd9a51f 100644 --- a/PlotLine.Tests/Browser/narrative-focus-popup.cjs +++ b/PlotLine.Tests/Browser/narrative-focus-popup.cjs @@ -27,6 +27,8 @@ const base=process.env.PD_NARRATIVE_TEST_URL||'http://127.0.0.1:5238'; await p.locator('[data-focus-label]').evaluate(n=>n.textContent='Current Focus: Short'); assert(await toggle.evaluate(n=>{const label=n.querySelector('[data-focus-label]'),b=n.getBoundingClientRect(),l=label.getBoundingClientRect();return b.right-l.right<30;}),'chevron follows short label without unused width'); await open();await p.locator('[data-focus-search]').fill('Departure');await expectOpen();assert.equal(await p.locator('[data-focus-position] option').count(),2); + assert(await p.locator('[data-focus-step="-1"]').isDisabled());assert.equal(await p.locator('[data-focus-step="-1"]').getAttribute('aria-label'),'Previous Scene'); + assert.equal(await p.locator('[data-focus-step="1"]').getAttribute('aria-label'),'Next Scene'); let release;const gate=new Promise(r=>release=r);await p.route('**/NarrativeFocus/Set',async r=>{await gate;await r.continue();}); await p.locator('[data-focus-position]').selectOption('22/32');await expectOpen();assert.match(await p.locator('[data-narrative-status]').textContent(),/Updating/);release();await closed();await p.unroute('**/NarrativeFocus/Set');assert.match(await toggle.textContent(),/Departure/); await open();await p.locator('[data-focus-search]').fill('');await p.locator('[data-focus-step="-1"]').click();await closed(); @@ -44,6 +46,8 @@ const base=process.env.PD_NARRATIVE_TEST_URL||'http://127.0.0.1:5238'; const after=await toggle.boundingBox();assert.equal(after.height,before.height);assert(after.width<=Math.max(before.width,448)); assert(await p.locator('[data-focus-label]').evaluate(n=>n.scrollWidth>n.clientWidth&&getComputedStyle(n).textOverflow==='ellipsis')); await open();const box=await popup.boundingBox();assert(box.x>=0&&box.x+box.width<=width+1,'popup fits viewport'); + const layout=await popup.evaluate(n=>{const elements=['[data-focus-search]','[data-focus-position]','.pd-focus-navigation','[data-focus-recent]'].map(s=>n.querySelector(s).getBoundingClientRect());const buttons=[...n.querySelectorAll('[data-focus-step]')].map(b=>{const r=b.getBoundingClientRect(),i=b.querySelector('svg').getBoundingClientRect();return {top:r.top,height:r.height,iconWidth:i.width,iconHeight:i.height};});return {aligned:elements.every(r=>Math.abs(r.left-elements[0].left)<1&&Math.abs(r.right-elements[0].right)<1),buttons};}); + assert(layout.aligned,'popup fields and navigation row share horizontal edges');assert.equal(layout.buttons[0].top,layout.buttons[1].top);assert.equal(layout.buttons[0].height,layout.buttons[1].height);for(const b of layout.buttons){assert.equal(b.iconWidth,16);assert.equal(b.iconHeight,16);} await p.screenshot({path:`/tmp/pd-focus-popup-${installed?'pwa':'browser'}-${width}-${theme}.png`});await p.keyboard.press('Escape');await closed(); } await open();await p.goto(base+'/Timeline/Index?ProjectID=7&BookID=12');await p.waitForFunction(()=>window.PlotDirectorNarrativeFocus);await closed(); diff --git a/PlotLine/Views/Shared/_NarrativeFocus.cshtml b/PlotLine/Views/Shared/_NarrativeFocus.cshtml index a995d5ff..4151546b 100644 --- a/PlotLine/Views/Shared/_NarrativeFocus.cshtml +++ b/PlotLine/Views/Shared/_NarrativeFocus.cshtml @@ -7,7 +7,7 @@

Current narrative location. Saved objectives and local Scene Explorers keep their own targets.

-
+

@Html.AntiForgeryToken() diff --git a/PlotLine/wwwroot/css/application-shell.css b/PlotLine/wwwroot/css/application-shell.css index 5e5183d3..f4b78b7a 100644 --- a/PlotLine/wwwroot/css/application-shell.css +++ b/PlotLine/wwwroot/css/application-shell.css @@ -368,7 +368,7 @@ html[data-app-theme] .app-layout :is( background-color: var(--pd-section); border-color: var(--pd-border); } -html[data-app-theme] .app-layout :is(.workspace-heading .button-row, .timeline-filter) .btn { +html[data-app-theme] .app-layout :is(.workspace-heading .button-row, .timeline-filter, .pd-focus-navigation) .btn { --bs-btn-color: var(--pd-text); --bs-btn-bg: transparent; --bs-btn-border-color: var(--pd-border); @@ -385,17 +385,17 @@ html[data-app-theme] .app-layout :is(.workspace-heading .button-row, .timeline-f border-color: var(--bs-btn-border-color); color: var(--bs-btn-color); } -html[data-app-theme] .app-layout :is(.workspace-heading .button-row, .timeline-filter) .btn:is(:hover, :focus-visible) { +html[data-app-theme] .app-layout :is(.workspace-heading .button-row, .timeline-filter, .pd-focus-navigation) .btn:is(:hover, :focus-visible) { background: var(--bs-btn-hover-bg); border-color: var(--bs-btn-hover-border-color); color: var(--bs-btn-hover-color); } -html[data-app-theme] .app-layout :is(.workspace-heading .button-row, .timeline-filter) .btn:is(:active, .active, .show) { +html[data-app-theme] .app-layout :is(.workspace-heading .button-row, .timeline-filter, .pd-focus-navigation) .btn:is(:active, .active, .show) { background: var(--bs-btn-active-bg); border-color: var(--bs-btn-active-border-color); color: var(--bs-btn-active-color); } -html[data-app-theme] .app-layout :is(.workspace-heading .button-row, .timeline-filter) .btn:disabled { +html[data-app-theme] .app-layout :is(.workspace-heading .button-row, .timeline-filter, .pd-focus-navigation) .btn:disabled { background: var(--bs-btn-disabled-bg); border-color: var(--bs-btn-disabled-border-color); color: var(--bs-btn-disabled-color); diff --git a/PlotLine/wwwroot/css/scene-explorer.css b/PlotLine/wwwroot/css/scene-explorer.css index 3dc688ae..8f620ae8 100644 --- a/PlotLine/wwwroot/css/scene-explorer.css +++ b/PlotLine/wwwroot/css/scene-explorer.css @@ -8,7 +8,10 @@ .pd-shell .pd-narrative-focus .app-context-label{min-width:0;max-width:none;text-align:start;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} .pd-narrative-focus>.dropdown-toggle::after{flex-shrink:0;} .pd-focus-picker{width:min(32rem,88vw);padding:1rem;} -.pd-focus-picker label{display:block;margin-block:.5rem;} +.pd-focus-picker label{display:block;margin-block:.75rem;} +.pd-focus-navigation{flex-wrap:nowrap;gap:.5rem;margin-block:.75rem;} +.pd-focus-navigation .btn{display:inline-flex;align-items:center;justify-content:center;gap:.25rem;} +.pd-focus-navigation .pd-icon{width:16px;height:16px;} .pd-focus-picker select,.pd-focus-picker input{display:block;width:100%;min-width:0;background:var(--bs-body-bg);color:var(--bs-body-color);border:1px solid var(--bs-border-color);border-radius:.25rem;padding:.3rem;} @media(max-width:900px){.pd-narrative-focus{max-width:12rem;}}