From ea04dcd4b06a38f52d744d5cf6a17e3e13cf54b3 Mon Sep 17 00:00:00 2001 From: Nick Beckley Date: Sun, 1 Nov 2026 22:14:10 +0000 Subject: [PATCH] Keep shared solver visual canvas full width for permanent result pages --- .../Browser/writing-solver-canvas.cjs | 29 +++++++++++++++++++ PlotLine/wwwroot/css/writing-solver.css | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 PlotLine.Tests/Browser/writing-solver-canvas.cjs diff --git a/PlotLine.Tests/Browser/writing-solver-canvas.cjs b/PlotLine.Tests/Browser/writing-solver-canvas.cjs new file mode 100644 index 00000000..c6f0ff6d --- /dev/null +++ b/PlotLine.Tests/Browser/writing-solver-canvas.cjs @@ -0,0 +1,29 @@ +const{chromium}=require('playwright'); +const assert=require('node:assert/strict'); +const fs=require('node:fs'); +const base='https://dev.plotdirector.com'; +(async()=>{const browser=await chromium.launch();try{ + for(const width of [390,768,1440,1920]){ + const page=await browser.newPage({viewport:{width,height:1100}}); + if(process.env.SOLVER_LOCAL_CSS==='true')await page.route('**/css/writing-solver.css*',route=>route.fulfill({contentType:'text/css',body:fs.readFileSync('PlotLine/wwwroot/css/writing-solver.css','utf8')})); + for(const slug of ['comparing-different-story-versions','too-many-storylines-to-manage','']){ + const path='/writing-problems'+(slug?'/'+slug:'');await page.goto(base+path); + const dimensions=await page.locator('.solver-space').evaluate(e=>{const r=e.getBoundingClientRect(),c=e.querySelector('.solver-content').getBoundingClientRect();return{left:r.left,right:r.right,width:r.width,content:c.width,overflow:document.documentElement.scrollWidth>innerWidth,bg:getComputedStyle(e).backgroundImage}}); + assert.equal(dimensions.left,0);assert.equal(dimensions.width,width);assert(!dimensions.overflow); + assert(dimensions.content<= (slug?930:1000));assert(dimensions.bg.includes('writing-solver-desk.png')); + if(slug)assert.equal(new URL(page.url()).pathname,path); + if(slug==='comparing-different-story-versions')await page.screenshot({path:`/tmp/solver-canvas-${process.env.SOLVER_LOCAL_CSS?'candidate':'live'}-${width}.png`}); + console.log('PASS',width,path,JSON.stringify(dimensions)); + } + // Third diagnosis and an interactive question use the same full-width canvas. + await page.goto(base+'/writing-problems');await page.locator('input[name=choices]').first().check();await page.locator('button[type=submit]').click(); + assert.equal(await page.locator('.solver-space').evaluate(e=>e.getBoundingClientRect().width),width); + assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false); + await page.close(); + } + const page=await browser.newPage({viewport:{width:1920,height:1100}}); + if(process.env.SOLVER_LOCAL_CSS==='true')await page.route('**/css/writing-solver.css*',r=>r.fulfill({contentType:'text/css',body:fs.readFileSync('PlotLine/wwwroot/css/writing-solver.css','utf8')})); + const graph=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Candidates/curated-v2-stage1-repair/writing-solver-curated-v2-stage1-repair.json')); + const third=graph.solutions.find(s=>s.id==='d02').slug;await page.goto(base+'/writing-problems/'+third);assert.equal(await page.locator('.solver-space').evaluate(e=>e.getBoundingClientRect().width),1920); + console.log('PASS third diagnosis',third); +}finally{await browser.close();}})().catch(e=>{console.error(e);process.exit(1)}); diff --git a/PlotLine/wwwroot/css/writing-solver.css b/PlotLine/wwwroot/css/writing-solver.css index 4afea17f..c4c0df99 100644 --- a/PlotLine/wwwroot/css/writing-solver.css +++ b/PlotLine/wwwroot/css/writing-solver.css @@ -57,7 +57,7 @@ html[data-site-theme="public"] { @media(max-width:600px) { .solver-space { padding:30px 20px; min-height:800px; background-image:linear-gradient(#fcf3e5e8,#fcf3e5 240px),url('/images/public/writing-solver-desk.png'); background-size:auto 300px; background-repeat:no-repeat; }.solver-choices--areas { grid-template-columns:1fr; gap:10px; }.solver-choices--areas .solver-choice { min-height:90px; padding:15px 35px 15px 16px; }.solver-wide { display:none; }.solver-icon { width:38px; min-width:38px; height:38px; }.solver-choices--areas .solver-choice strong { font-size:1.35rem; }.solver-help { font-size:.95rem; }.solver-controls { justify-content:space-between; gap:12px; }.solver-controls .marketing-btn { padding:13px 22px; font-size:1rem; }.solver-promises span { margin:0 6px; }.solver-features { grid-template-columns:1fr; }.solver-features>div:first-child { grid-column:auto; }.solver-content h1 { overflow-wrap:break-word; }.solver-trail span:not(:first-child) { max-width:100%; } } @media(prefers-reduced-motion:reduce) { scroll-behavior:auto; .marketing-btn { transition:none; transform:none; } } } -html[data-site-theme="public"] main.marketing-shell > section.solver-space { max-width:none; width:100%; } +html[data-site-theme="public"] main.marketing-shell > .solver-space { max-width:none; width:100%; } html[data-site-theme="public"] .public-footer { background:#f0e5d4; } html[data-site-theme="public"] .solver-neutral { max-width:760px; margin-inline:auto; }