From f96259a378f22dd80075676be34ea5e269ae091f Mon Sep 17 00:00:00 2001 From: Nick Beckley Date: Mon, 16 Nov 2026 15:55:25 +0000 Subject: [PATCH] Implement Writer 3 Phase 2A home and contextual destination shells --- Docs/Writer/Writer3/Help-Coverage.md | 14 ++ Docs/Writer/Writer3/Implementation-Tracker.md | 6 +- Docs/Writer/Writer3/Phase2A-Execution.md | 43 ++++++ .../Browser/writer3-navigation-live.cjs | 32 +++++ PlotLine.Tests/Browser/writer3-navigation.cjs | 57 ++++++++ PlotLine.Tests/Program.cs | 3 +- PlotLine.Tests/RibbonPresentationTests.cs | 2 +- PlotLine.Tests/ToolbarBrowserHost.cs | 30 +++- PlotLine.Tests/WriterDashboardTests.cs | 2 +- PlotLine.Tests/WriterNavigationTests.cs | 54 ++++++++ PlotLine/Controllers/WriterController.cs | 27 ++-- PlotLine/Help/Articles/Workspace/Overview.md | 2 + .../Articles/Workspace/Writer3-dashboard.md | 16 +++ .../Articles/Workspace/Writer3-explore.md | 18 +++ .../Help/Articles/Workspace/Writer3-home.md | 24 ++++ .../Help/Articles/Workspace/Writer3-plan.md | 20 +++ .../Articles/Workspace/Writer3-reflect.md | 18 +++ .../Help/Articles/Workspace/Writer3-review.md | 22 +++ .../Help/Articles/Workspace/Writer3-write.md | 22 +++ PlotLine/Services/ApplicationNavigation.cs | 3 + PlotLine/Services/ApplicationRibbon.cs | 9 +- PlotLine/Services/Writer/WriterSuggestions.cs | 2 +- PlotLine/Services/WriterNavigation.cs | 49 +++++++ .../ApplicationNavigationViewModel.cs | 1 + PlotLine/ViewModels/CoreViewModels.cs | 1 + .../Shared/_ApplicationNavigation.cshtml | 2 +- .../Views/Shared/_ApplicationShell.cshtml | 4 +- PlotLine/Views/Writer/Destination.cshtml | 31 +++++ PlotLine/Views/Writer/Index.cshtml | 128 ++++-------------- PlotLine/Views/Writer/Legacy.cshtml | 111 +++++++++++++++ PlotLine/Views/Writer/_HelpMe.cshtml | 2 +- PlotLine/Views/Writer/_ObjectiveForm.cshtml | 9 ++ .../Views/Writer/_WorkingObjective.cshtml | 12 +- PlotLine/Views/Writer/_Writer3Header.cshtml | 19 +++ PlotLine/Views/Writer/_WriterDashboard.cshtml | 5 + PlotLine/Views/Writer/_WriterExplore.cshtml | 24 ++++ PlotLine/Views/Writer/_WriterPlan.cshtml | 15 ++ PlotLine/Views/Writer/_WriterProgress.cshtml | 9 ++ PlotLine/Views/Writer/_WriterReflect.cshtml | 9 ++ PlotLine/Views/Writer/_WriterReview.cshtml | 18 +++ PlotLine/Views/Writer/_WriterUpcoming.cshtml | 4 + PlotLine/Views/Writer/_WriterWrite.cshtml | 32 +++++ PlotLine/wwwroot/css/writer3.css | 16 +++ PlotLine/wwwroot/js/writer3-navigation.js | 13 ++ 44 files changed, 801 insertions(+), 139 deletions(-) create mode 100644 Docs/Writer/Writer3/Phase2A-Execution.md create mode 100644 PlotLine.Tests/Browser/writer3-navigation-live.cjs create mode 100644 PlotLine.Tests/Browser/writer3-navigation.cjs create mode 100644 PlotLine.Tests/WriterNavigationTests.cs create mode 100644 PlotLine/Help/Articles/Workspace/Writer3-dashboard.md create mode 100644 PlotLine/Help/Articles/Workspace/Writer3-explore.md create mode 100644 PlotLine/Help/Articles/Workspace/Writer3-home.md create mode 100644 PlotLine/Help/Articles/Workspace/Writer3-plan.md create mode 100644 PlotLine/Help/Articles/Workspace/Writer3-reflect.md create mode 100644 PlotLine/Help/Articles/Workspace/Writer3-review.md create mode 100644 PlotLine/Help/Articles/Workspace/Writer3-write.md create mode 100644 PlotLine/Services/WriterNavigation.cs create mode 100644 PlotLine/Views/Writer/Destination.cshtml create mode 100644 PlotLine/Views/Writer/Legacy.cshtml create mode 100644 PlotLine/Views/Writer/_ObjectiveForm.cshtml create mode 100644 PlotLine/Views/Writer/_Writer3Header.cshtml create mode 100644 PlotLine/Views/Writer/_WriterDashboard.cshtml create mode 100644 PlotLine/Views/Writer/_WriterExplore.cshtml create mode 100644 PlotLine/Views/Writer/_WriterPlan.cshtml create mode 100644 PlotLine/Views/Writer/_WriterProgress.cshtml create mode 100644 PlotLine/Views/Writer/_WriterReflect.cshtml create mode 100644 PlotLine/Views/Writer/_WriterReview.cshtml create mode 100644 PlotLine/Views/Writer/_WriterUpcoming.cshtml create mode 100644 PlotLine/Views/Writer/_WriterWrite.cshtml create mode 100644 PlotLine/wwwroot/css/writer3.css create mode 100644 PlotLine/wwwroot/js/writer3-navigation.js diff --git a/Docs/Writer/Writer3/Help-Coverage.md b/Docs/Writer/Writer3/Help-Coverage.md index ffda9cf3..efb0abf6 100644 --- a/Docs/Writer/Writer3/Help-Coverage.md +++ b/Docs/Writer/Writer3/Help-Coverage.md @@ -68,3 +68,17 @@ Phase1: corrected workspace/queue/goal guidance; added workingContext and writin | F60 | Attachments editor | workspace.workingContext | Existing Help tooltip/popup/full article; destination-specific expansion in delivery phase | | F61 | Problem Solver questions, browse and results | workspace.workingContext | Existing Help tooltip/popup/full article; destination-specific expansion in delivery phase | | F62 | Workspace context chooser | workspace.workingContext | Existing Help tooltip/popup/full article; destination-specific expansion in delivery phase | + +## Phase 2A navigation Help + +| Key | Surface | Tooltip / popup / full article | +|---|---|---| +| writer3.home | Writer Home | Existing HelpIconTagHelper micro/quick metadata, browser popup, PWA promoted Help/drawer, full Help article; qualification in Phase2A report | +| writer3.write | Writer Write | Existing HelpIconTagHelper micro/quick metadata, browser popup, PWA promoted Help/drawer, full Help article; qualification in Phase2A report | +| writer3.explore | Writer Explore | Existing HelpIconTagHelper micro/quick metadata, browser popup, PWA promoted Help/drawer, full Help article; qualification in Phase2A report | +| writer3.plan | Writer Plan | Existing HelpIconTagHelper micro/quick metadata, browser popup, PWA promoted Help/drawer, full Help article; qualification in Phase2A report | +| writer3.review | Writer Review | Existing HelpIconTagHelper micro/quick metadata, browser popup, PWA promoted Help/drawer, full Help article; qualification in Phase2A report | +| writer3.reflect | Writer Reflect | Existing HelpIconTagHelper micro/quick metadata, browser popup, PWA promoted Help/drawer, full Help article; qualification in Phase2A report | +| writer3.dashboard | Writer Dashboard | Existing HelpIconTagHelper micro/quick metadata, browser popup, PWA promoted Help/drawer, full Help article; qualification in Phase2A report | + +Existing workspace.overview now describes the preserved Writing desk at /Writer/Overview. Shared workingContext and writingPlans articles remain authoritative for selection and task semantics. No competing Help implementation. diff --git a/Docs/Writer/Writer3/Implementation-Tracker.md b/Docs/Writer/Writer3/Implementation-Tracker.md index 85791b4a..8c5b8df7 100644 --- a/Docs/Writer/Writer3/Implementation-Tracker.md +++ b/Docs/Writer/Writer3/Implementation-Tracker.md @@ -32,7 +32,7 @@ No new workspace shell in this phase. Existing Overview/Journey/Workspaces route - Acceptance: New author entry; existing deep links; keyboard resizing; mobile/PWA; all preservation mappings reachable. - Preservation: all mapped F/I capabilities below; reader/source/privacy/native safeguards remain authoritative. - Help: review existing Markdown keys for affected capabilities; update tooltip, popup and full article together; register coverage. -- Status / Development deployment: Not started — Phase 1 acceptance required; not deployed at tracker creation. +- Status / Development deployment: Phase2A authorised and in progress; Phase2B not started. See Phase2A-Execution.md for route/layout contracts and qualification. ### Phase 3 — Write and Review integration @@ -320,3 +320,7 @@ Legacy rebalance operations remain callable but no replacement rebalance review ## Phase 1 completion — 16 November 2026 Implementation/deployed source: `c769e1119a2542e256374db3c48eeb324c2663ab`. Release `c769e11-20261116T151427Z`. Build and full harness passed (543 PASS records, exit0). Scoped transactional SQL regression and authenticated Development browser/simulated PWA acceptance passed. Live canonical status remained Outlined while legacy DraftStatus remained Planned, confirming presentation repair without conversion. All dedicated fixture projects/account removed; RemainingSyntheticAccounts=0. Physical Windows/installed PWA/multi-monitor acceptance remains manual. See [Phase1 report](Phase1-Report.md) for commands, limits and release evidence. Phase2 is not started and requires explicit acceptance. + +## Phase 2A delivery scope + +User authorised2A only after Phase1 acceptance. [Execution breakdown and layouts](Phase2A-Execution.md). Existing62 features/96 interaction families remain preserved by routes, contextual ribbon and legacy desk; new destination links reuse their recorded destination owners. No retirement or replacement storage. Full integration and resizable companions remain2B/Phases3–4; no fake guidance/schedule/insight results. diff --git a/Docs/Writer/Writer3/Phase2A-Execution.md b/Docs/Writer/Writer3/Phase2A-Execution.md new file mode 100644 index 00000000..7e7703b5 --- /dev/null +++ b/Docs/Writer/Writer3/Phase2A-Execution.md @@ -0,0 +1,43 @@ +# Phase 2A — Home, navigation and application shell + +Authorisation: the user-provided Phase2A kickoff, following Phase1 acceptance. Baseline `5d18f6c`, established shared branch. Scope ends at2A; draggable companions, persisted splitter state, integrated Context/Intent, a creative-guidance engine, visual scheduling and reflective insights are not implemented here. + +## Visual and interaction direction + +The supplied six-screen image is the visual benchmark: existing PlotDirector chrome, restrained gold/orange accents, purposeful compact panels and three dominant Home choices. Use the existing theme variables, Segoe UI typography, SVG icon paths, buttons, menus and Help infrastructure. Retain all user-selectable themes rather than imposing dark mode. No manuscript-specific example names or imagery are production logic. + +Home: book identity/cover and short introduction; three equally weighted cards in one desktop row. Saved focus appears inside Continue Writing. No extra charts, session controls or stacked secondary dashboard below the choices. Narrow screens stack the same choices without horizontal overflow. + +Destinations: same compact book/title/connection header, a main working region and a smaller tools/reference region. Each region may scroll independently on tall desktop viewports; both remain keyboard focusable. Narrow screens use document flow. These are existing-tool entry shells, not simulated integrated Context/Intent panes. There is no splitter or preference persistence in2A. + +Navigation: a single Writer group in the existing ribbon provides Home/Write/Explore/Plan/Review/Reflect. A small contextual group changes with the destination; Utilities retains Workspaces and Display Setup. Dashboard is an overview of Plan/Reflect. No duplicate destination navigation strip below the ribbon. Book-menu switching retains a recognised destination but passes only authorised project/book IDs, never stale chapter/scene/native IDs. + +## Route and preservation contracts + +| Route | Behavior / real existing functionality | +|---|---| +| `/Writer`, `/Writer/Index` | New three-choice Home; legacy workspace/journey/setup queries still dispatch to their actual surface | +| `/Writer/Write` | Saved objective/current chapter or scene; same extracted objective form and session toolbar; chapter/scene links and standalone reference launchers | +| `/Writer/Explore` | Real Problem Solver/questionnaire/browse links; Timeline and existing Character/Relationship/Plot/Map/Floor Plan/Metric tools; works without a project/manuscript | +| `/Writer/Plan` | Existing setup, scoped plan management/preview and real upcoming activities | +| `/Writer/Review` | Accepted-text Reader/focused reading; Audio Review instructions and existing Reader controls; standalone Intent/Evidence and revision queue | +| `/Writer/Reflect` | Actual retained change evidence, Journey, owner-private reports/privacy/export links; forthcoming insights are clearly labelled text | +| `/Writer/Dashboard` | Compact Plan/Reflect overview of actual manuscript progress and upcoming work | +| `/Writer/Overview` | Entire previous desk preserved as `Legacy.cshtml`, including Help Me, recent activity, tasks, queue panels, session controls and Display Setup | +| `/Writer/Workspaces`, `/Writer/Journey` | Existing implementation retained through Legacy view | +| `/Writer/DisplaySetup` | Redirects to the actual retained display panel on Overview | +| `/Writer#display-setup`, `#workspaces`, old objective fragments | Small Home compatibility script replaces URL with matching retained panel/Write route; no chapter/native context copied | +| `/Write`, `/Write/Index` and all plan/chapter/report/Reader/reference routes | Retained; old root Write redirects to Home, with the new Write destination prominently available | + +All new actions reuse the same read/authorisation pipeline and Phase1 context projection. No new database storage or migration. Opening a destination does not call SceneWorkflow_Get or initialise story metadata. Only explicit existing forms start sessions, save objectives or change author data. Live qualification compares core fixture records around navigation; login/window presence and explicit session observations are separate operational data. + +## Coherent batches + +-2A.1: destination route contracts, request-scoped presentation state, contextual Writer ribbon and book-switch whitelist. +-2A.2: Home with real book cover/fallback, saved focus and three functional actions; old desk retained. +-2A.3: six initial shells (five destinations plus Plan/Reflect Dashboard), actual entry points and honest new-book/private-evidence states. Shared objective form avoids parallel save logic. +-2A.4: seven Help articles/keys, preservation Help updates, route/security/unit and responsive browser/PWA/keyboard/back/forward tests, standalone/Reader/Intent regression, Development-only release/acceptance. + +## Qualification status + +Implementation in progress. Build, tests, visual inspection, deployment and final results are recorded in the completion report once executed. Physical Windows, installed PWA and monitor placement are never inferred from Chromium emulation. Phase2B requires separate explicit acceptance. diff --git a/PlotLine.Tests/Browser/writer3-navigation-live.cjs b/PlotLine.Tests/Browser/writer3-navigation-live.cjs new file mode 100644 index 00000000..a0c4df85 --- /dev/null +++ b/PlotLine.Tests/Browser/writer3-navigation-live.cjs @@ -0,0 +1,32 @@ +// Development only, normal login, dedicated disposable owner with one saved focus and a second empty book. +const {chromium}=require('playwright'),fs=require('node:fs'),assert=require('node:assert/strict'); +(async()=>{ + const w=JSON.parse(fs.readFileSync(process.env.PD_WRITER3_IDENTITY));assert(w.Database==='PlotDirector_Development'&&/^pwa-browser-.*@example\.invalid$/.test(w.Email)); + for(const key of ['project','book','chapter','scene','other'])assert(Number.isSafeInteger(w[key])&&w[key]>0); + const b=await chromium.launch(),base='https://dev.plotdirector.com',checks=[]; + try{for(const pwa of[false,true]){ + const c=await b.newContext({viewport:{width:1440,height:1000}});if(pwa)await c.addInitScript(()=>Object.defineProperty(navigator,'standalone',{value:true})); + const p=await c.newPage(),errors=[];p.on('pageerror',e=>errors.push(e.message));p.setDefaultTimeout(20000); + await p.goto(base+'/Account/Login');await p.locator('[name=Email]').fill(w.Email);await p.locator('[name=Password]').fill(w.Password);await Promise.all([p.waitForURL('**/Projects'),p.locator('button[type=submit]').click()]); + for(const book of[w.book,w.other])for(const action of['Index','Write','Explore','Plan','Review','Reflect','Dashboard']){ + const response=await p.goto(`${base}/Writer/${action}?projectId=${w.project}&bookId=${book}`);assert.equal(response.status(),200); + assert.equal(await p.locator('[data-writer-destination]').getAttribute('data-writer-destination'),action==='Index'?'Home':action); + if(action==='Write'&&book===w.book)assert((await p.getByRole('link',{name:'Open current scene',exact:true}).getAttribute('href')).includes('/'+w.scene)); + if(action==='Write'&&book===w.other)assert.equal(await p.getByRole('heading',{name:'Where would you like to begin?',exact:true}).isVisible(),true); + if(action==='Review'&&book===w.other)assert.equal(await p.getByRole('heading',{name:'No chapters to read yet',exact:true}).isVisible(),true); + if(!pwa&&book===w.book&&process.env.PD_WRITER3_SCREENSHOTS){await p.evaluate(()=>window.PlotDirectorApplyApplicationTheme('modern-dark'));fs.mkdirSync(process.env.PD_WRITER3_SCREENSHOTS,{recursive:true});await p.screenshot({path:`${process.env.PD_WRITER3_SCREENSHOTS}/${action==='Index'?'Home':action}-Development.png`,fullPage:true});} + } + for(const [index,action]of[[0,'Write'],[1,'Explore'],[2,'Dashboard']]){await p.goto(`${base}/Writer?projectId=${w.project}&bookId=${w.book}`);await p.locator('.writer3-home-choices>a').nth(index).click();await p.waitForURL(`**/Writer/${action}?*`);assert.equal(new URL(p.url()).searchParams.get('bookId'),String(w.book));} + await p.goto(`${base}/Writer/Write?projectId=${w.project}&bookId=${w.book}`);await p.locator('#appBookMenu').click();await p.locator(`[data-app-book-choice="${w.other}"]`).click();await p.waitForURL(`**/Writer/Write?*bookId=${w.other}*`);assert.equal(await p.getByRole('link',{name:'Open current scene',exact:true}).count(),0); + await p.goBack();assert((await p.getByRole('link',{name:'Open current scene',exact:true}).getAttribute('href')).includes('/'+w.scene));await p.goForward();await p.reload();assert.equal(await p.getByRole('link',{name:'Open current scene',exact:true}).count(),0); + for(const action of['Overview','Journey','Workspaces','WritingPlans','SchedulePreview'])assert.equal((await p.request.get(`${base}/Writer/${action}?projectId=${w.project}&bookId=${w.book}`)).status(),200); + const setup=await p.request.get(`${base}/Writer/DisplaySetup?projectId=${w.project}&bookId=${w.book}`);assert.equal(setup.status(),200);assert(new URL(setup.url()).pathname==='/Writer/Overview'); + for(const action of['Write','Explore','Plan','Review','Reflect'])assert.equal((await p.request.get(`${base}/Writer/${action}?bookId=2147483647`)).status(),404); + await p.goto(`${base}/Writer/Review?projectId=${w.project}&bookId=${w.book}`); + if(pwa){await p.locator('[data-help-open="writer3.review"]:visible').click();await p.waitForFunction(()=>document.querySelector('[data-help-drawer]')?.innerText.includes('Review Your Writing'));} + else{await p.locator('[data-help-key="writer3.review"] button').click();await p.locator('.plotline-help-popover').waitFor();} + for(const key of['home','write','explore','plan','review','reflect','dashboard'])assert.equal((await p.request.get(`${base}/Help/Article/writer3.${key}`)).status(),200); + assert.deepEqual(errors,[]);checks.push(`${pwa?'Simulated PWA':'Browser'}: existing/new book7surfaces,3Home actions, five destinations, contextual scope/back/forward/reload, saved focus isolation,5legacy pages,DisplaySetup,unavailable-book404 and7Help articles pass; no author-data forms submitted.`);await c.close(); + }}finally{await b.close();} + console.log(JSON.stringify({checks,physicalWindows:false,installedPWA:false},null,2)); +})().catch(e=>{console.error(e.message);process.exitCode=1}); diff --git a/PlotLine.Tests/Browser/writer3-navigation.cjs b/PlotLine.Tests/Browser/writer3-navigation.cjs new file mode 100644 index 00000000..f313b8ee --- /dev/null +++ b/PlotLine.Tests/Browser/writer3-navigation.cjs @@ -0,0 +1,57 @@ +// Real MVC/Razor/application-shell navigation, isolated repositories; never a live manuscript. +const {chromium}=require('playwright'); +const assert=require('node:assert/strict'); +const fs=require('node:fs'); +const base='http://127.0.0.1:5238'; +(async()=>{ + const browser=await chromium.launch();let combinations=0; + try{for(const pwa of [false,true]){ + const context=await browser.newContext({viewport:{width:1440,height:1000}}); + if(pwa)await context.addInitScript(()=>Object.defineProperty(navigator,'standalone',{value:true})); + await context.route('**/signalr.min.js',route=>route.fulfill({contentType:'application/javascript',body:fs.readFileSync(require.resolve('@microsoft/signalr/dist/browser/signalr.min.js'))})); + await context.route('**/Writer/Work/State?*',route=>route.fulfill({contentType:'application/json',body:JSON.stringify({defaultPauseOnEdit:true,session:null})})); + const page=await context.newPage(),errors=[];page.on('pageerror',e=>errors.push(e.message)); + for(const theme of ['modern-dark','modern-light','warm-dark','plotdirector'])for(const width of [390,1024,1440]){ + await page.setViewportSize({width,height:1000});await page.addInitScript(theme=>localStorage.setItem('plotdirector.applicationTheme',theme),theme); + for(const destination of ['Index','Write','Explore','Plan','Review','Reflect','Dashboard']){ + await page.goto(`${base}/Writer/${destination}?projectId=7&bookId=12&objective=true&populated=true`); + await page.evaluate(t=>window.PlotDirectorApplyApplicationTheme(t),theme); + const kind=destination==='Index'?'Home':destination; + assert.equal(await page.locator('[data-writer-destination]').getAttribute('data-writer-destination'),kind); + const commands=page.locator('#ribbon-panel-writer [role=group]').first().locator('a'); + assert.deepEqual((await commands.locator('span:not([aria-hidden])').allTextContents()).map(x=>x.trim()),['Home','Write','Explore','Plan','Review','Reflect']); + assert((await page.locator('#ribbon-panel-writer a[aria-current=page]').allTextContents()).some(t=>t.trim()===(destination==='Index'?'Home':destination==='Dashboard'?'Writing Dashboard':destination))); + assert.equal(await page.locator('.writer3 nav').count(),0,'No duplicate destination navigation bar'); + const contrasts=await page.locator('a.writer3-cta').evaluateAll(nodes=>{const lum=s=>{const rgb=s.match(/[\d.]+/g).slice(0,3).map(Number).map(x=>{x/=255;return x<=.04045?x/12.92:((x+.055)/1.055)**2.4});return rgb[0]*.2126+rgb[1]*.7152+rgb[2]*.0722};return nodes.map(n=>{const c=getComputedStyle(n),a=lum(c.color),b=lum(c.backgroundColor);return (Math.max(a,b)+.05)/(Math.min(a,b)+.05)})});assert(contrasts.every(x=>x>=4.5),'Primary action labels must have readable contrast'); + const overflow=await page.evaluate(()=>document.documentElement.scrollWidth>innerWidth+2);assert.equal(overflow,false,`${pwa}/${theme}/${width}/${kind} horizontal overflow`); + if(kind==='Home'){ + assert.equal(await page.locator('.writer3-home-choices>a').count(),3);assert.equal(await page.locator('[data-writer-work],.writer-help,.writer3-stat-grid').count(),0,'Home contains no stacked legacy dashboards/session controls'); + if(width>=1024){const bottom=await page.locator('.writer3-home-choices').evaluate(n=>n.getBoundingClientRect().bottom);assert(bottom<=1000,'All primary choices fit the desktop viewport');} + } + if(!pwa&&theme==='modern-dark'&&width===1440&&process.env.PD_WRITER3_SCREENSHOTS){fs.mkdirSync(process.env.PD_WRITER3_SCREENSHOTS,{recursive:true});await page.screenshot({path:`${process.env.PD_WRITER3_SCREENSHOTS}/${kind}.png`,fullPage:true});} + combinations++; + } + } + await page.setViewportSize({width:1440,height:1000}); + await page.goto(base+'/Writer?projectId=7&bookId=12'); + for(const [index,destination]of [[0,'Write'],[1,'Explore'],[2,'Dashboard']]){ + await page.locator('.writer3-home-choices>a').nth(index).click();await page.waitForURL(`**/Writer/${destination}?*`); + assert.equal(new URL(page.url()).searchParams.get('bookId'),'12');await page.goBack();await page.waitForURL('**/Writer?*'); + } + await page.goto(base+'/Writer/Write?projectId=7&bookId=12&objective=true'); + await page.locator('#appBookMenu').click();await page.locator('[data-app-book-choice="13"]').click();await page.waitForURL('**/Writer/Write?*bookId=13*'); + assert.equal(await page.getByRole('heading',{name:'Where would you like to begin?',exact:true}).isVisible(),true); + assert.equal(await page.getByRole('link',{name:'Open current scene',exact:true}).count(),0,'No stale focus after book switch'); + await page.reload();assert.equal(await page.locator('[data-writer-destination]').getAttribute('data-writer-destination'),'Write'); + await page.goBack();assert.equal(new URL(page.url()).searchParams.get('bookId'),'12');await page.goForward();assert.equal(new URL(page.url()).searchParams.get('bookId'),'13'); + const denied=await page.request.get(base+'/Writer/Explore?bookId=999');assert.equal(denied.status(),404); + await page.goto(base+'/Writer#display-setup');await page.waitForURL('**/Writer/Overview*#display-setup');assert(await page.locator('#display-setup').evaluate(n=>n.open)); + await page.goto(base+'/Writer/Review?projectId=7&bookId=12'); + if(pwa){await page.locator('[data-help-open="writer3.review"]:visible').click();await page.waitForFunction(()=>document.querySelector('[data-help-drawer]')?.innerText.includes('Review Your Writing'));} + else{await page.locator('[data-help-key="writer3.review"] button').click();await page.locator('.plotline-help-popover').waitFor();} + const help=await page.request.get(base+'/Help/Article/writer3.review');assert.equal(help.status(),200); + await page.goto(base+'/Writer?projectId=7&bookId=12');await page.locator('.writer3-home-choices>a').first().focus();assert(await page.locator('.writer3-home-choices>a').first().evaluate(n=>n.matches(':focus-visible')));await page.keyboard.press('Enter');await page.waitForURL('**/Writer/Write?*'); + assert.deepEqual(errors,[]);await context.close(); + }}finally{await browser.close();} + console.log(`PASS Writer3: ${combinations} destination/theme/width/browser/PWA combinations; Home actions, contextual ribbon, authorisation, book switching, reload/back/forward, keyboard focus, Help, legacy fragments and viewport fit.`); +})().catch(e=>{console.error(e.stack);process.exitCode=1}); diff --git a/PlotLine.Tests/Program.cs b/PlotLine.Tests/Program.cs index 19a207f5..af34eae6 100644 --- a/PlotLine.Tests/Program.cs +++ b/PlotLine.Tests/Program.cs @@ -170,6 +170,7 @@ var tests = new (string Name, Action Test)[] ("Release triage and browser-only onboarding preserve author decisions", ReleaseSprintTests.Run), ("Approved native import source and confirmation remain safe", () => NativeImportTests.Run().GetAwaiter().GetResult()), ("Native installation renewal and revocation remain account/security scoped", () => NativeInstallationTests.Run().GetAwaiter().GetResult()), + ("Writer 3 destination navigation and scope",()=>WriterNavigationTests.Run().GetAwaiter().GetResult()), ("Writer foundation context, queue scope and planning",()=>WriterFoundationTests.Run().GetAwaiter().GetResult()), ("Writer dashboard book scope",()=>WriterDashboardTests.Run().GetAwaiter().GetResult()), ("Writing activity measurement", WritingActivityTests.Run), @@ -2166,7 +2167,7 @@ static void WritingWorkspaceLauncherUsesProgressiveScreenPlacement() var root = Path.Combine(AppContext.BaseDirectory, "../../../../PlotLine"); var script = File.ReadAllText(Path.Combine(root, "wwwroot/js/writing-workspace.js")); var launcher = File.ReadAllText(Path.Combine(root, "wwwroot/js/writing-workspace-launcher.js")); - var view = File.ReadAllText(Path.Combine(root, "Views/Writer/Index.cshtml")); + var view = File.ReadAllText(Path.Combine(root, "Views/Writer/Legacy.cshtml")); Assert(script.Contains("getScreenDetails", StringComparison.Ordinal), "Workspace launcher should use the Window Management API when available."); Assert(script.Contains("window-management", StringComparison.Ordinal), "Workspace launcher should check/request window-management permission."); diff --git a/PlotLine.Tests/RibbonPresentationTests.cs b/PlotLine.Tests/RibbonPresentationTests.cs index b3ad65f6..15967435 100644 --- a/PlotLine.Tests/RibbonPresentationTests.cs +++ b/PlotLine.Tests/RibbonPresentationTests.cs @@ -22,7 +22,7 @@ internal static class RibbonPresentationTests var view = Path.Combine(root.FullName, "PlotLine", "Views", command.Controller, action + ".cshtml"); if (!File.Exists(view)) continue; // Downloads and controller redirects have no page furniture. var markup = File.ReadAllText(view); - if (!markup.Contains("data-pwa-") && !markup.Contains("_StoryCalendarSurface")) throw new Exception($"Navigation destination has no contextual classification: {command.Controller}/{action}"); + if (!markup.Contains("data-pwa-") && !markup.Contains("_StoryCalendarSurface") && !markup.Contains("_Writer3Header")) throw new Exception($"Navigation destination has no contextual classification: {command.Controller}/{action}"); } if (RibbonPresentation.Icons.Select(icon => icon.Key).Distinct().Count() != RibbonPresentation.Icons.Count()) throw new Exception("Icon catalog keys must be unique."); } diff --git a/PlotLine.Tests/ToolbarBrowserHost.cs b/PlotLine.Tests/ToolbarBrowserHost.cs index d96628af..f65a8545 100644 --- a/PlotLine.Tests/ToolbarBrowserHost.cs +++ b/PlotLine.Tests/ToolbarBrowserHost.cs @@ -92,6 +92,20 @@ internal static class ToolbarBrowserHost WriteNext = [new() { ProjectID = 7, BookID = 12, BookTitle = "A Distant Shore", ChapterID = 21, ChapterNumber = 1, SceneID = 101, SceneNumber = 1, SceneTitle = "The crossing", RevisionStatusName = "Outlined", Summary = "A synthetic writing task." }] }; + private static WriterDashboardViewModel Writer3Fixture(HttpContext context) + { + var model = WriterFixture(); + var book = int.TryParse(context.Request.Query["bookId"], out var requested) ? requested : 12; + model.BookID = book; + model.Book = new(){BookID=book,ProjectID=7,BookTitle=book==12?"A Distant Shore":"The Return",ChapterCount=book==12?2:0,SceneCount=book==12?2:0,CurrentWordCount=book==12?12400:0}; + if(book==12){ + model.ObjectiveChoices=[new(){ChapterID=21,ChapterTitle="The crossing",SceneID=31,SceneTitle="Arrival"},new(){ChapterID=22,ChapterTitle="The harbour",SceneID=32,SceneTitle="Departure"}]; + if(context.Request.Query["objective"]=="true")model.Objective=new(){BookID=12,ChapterID=21,SceneID=31,Activity="Revising",ChapterTitle="The crossing",SceneTitle="Arrival"}; + if(context.Request.Query["populated"]=="true")model.Activity=new(){BookID=12,Totals=new(){Added=120,Removed=30,HasAcceptedEvidence=true,RecordedEvents=2}}; + }else model.WriteNext=[]; + return model; + } + private static async Task RenderFullAsync(HttpContext context, string controller, string actionName, object model) { context.Request.RouteValues["controller"] = controller; @@ -130,8 +144,14 @@ internal static class ToolbarBrowserHost FixtureProxy((name, args) => name == "ListByProjectAsync" ? Task.FromResult>([new() { BookID = 12, ProjectID = 7, BookTitle = "A Distant Shore" }, new() { BookID = 13, ProjectID = 7, BookTitle = "The Return" }]) : throw new NotSupportedException(name)), services.GetRequiredService())); + builder.Services.AddSingleton(FixtureProxy((name,args)=>name switch { + "ListByProjectAsync" => Task.FromResult>([new(){BookID=12,ProjectID=7,BookTitle="A Distant Shore"},new(){BookID=13,ProjectID=7,BookTitle="The Return"}]), + "GetAsync" => Task.FromResult((int)args![0]! is 12 or 13 ? new(){BookID=(int)args[0]!,ProjectID=7,BookTitle=(int)args[0]! == 12?"A Distant Shore":"The Return"} : null), + _ => throw new NotSupportedException(name) + })); + builder.Services.AddSingleton(FixtureProxy((name,args)=>Task.FromResult(name=="CanAccessProjectAsync"?(int)args![0]! == 7:(int)args![1]! is 12 or 13))); builder.Services.AddScoped(services => FixtureProxy((name, args) => name switch { - "GetDashboardAsync" => Task.FromResult(WriterFixture()), + "GetDashboardAsync" => Task.FromResult(Writer3Fixture(services.GetRequiredService().HttpContext!)), "GetChapterWorkflowAsync" => Task.FromResult(new() { Project = new() { ProjectID = 7, ProjectName = "The Glass Harbour" }, Book = new() { BookID = 12, ProjectID = 7, BookTitle = "A Distant Shore" }, @@ -186,7 +206,7 @@ internal static class ToolbarBrowserHost model.Work=new(){BookID=12,Year=2026,Month=11,Days=[new(){Day=new(2026,11,14),Added=2000,Removed=2000,Changes=4,Editing=1,EngagedSeconds=300},new(){Day=new(2026,11,15),AudioReview=1,PlaybackSeconds=600}]}; } model.Workspace=context.Request.Query["workspace"].ToString() is "Revision"?"Revision":"WriteNext"; - await RenderFullAsync(context,"Writer","Index",model); + await RenderFullAsync(context,"Writer","Legacy",model); }); app.Urls.Add(Environment.GetEnvironmentVariable("PD_BROWSER_FIXTURE_URL") ?? "http://127.0.0.1:5238"); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.GetFullPath("PlotLine/wwwroot")) }); @@ -327,7 +347,7 @@ internal static class ToolbarBrowserHost { if (context.Request.Query["page"] == "writer" && context.Request.Query["layout"] == "full") { - await RenderFullAsync(context, "Writer", "Index", WriterFixture()); + await RenderFullAsync(context, "Writer", "Legacy", WriterFixture()); return; } var model = new ApplicationNavigationViewModel { ActiveSection = "Calendar", ShowCompanionPresence = true }; @@ -375,7 +395,7 @@ internal static class ToolbarBrowserHost await scripts(); } - if (name == "Writer/Index" && view.View is Microsoft.AspNetCore.Mvc.Razor.RazorView writerView + if (name == "Writer/Legacy" && view.View is Microsoft.AspNetCore.Mvc.Razor.RazorView writerView && writerView.RazorPage.SectionWriters.TryGetValue("Scripts", out var writerSection)) { using var scriptWriter = new StringWriter(); @@ -580,7 +600,7 @@ internal static class ToolbarBrowserHost }); } if (context.Request.Query["page"] == "writer") - surface = await Render("Writer/Index", WriterFixture()); + surface = await Render("Writer/Legacy", WriterFixture()); if (fullLayout) { if (fullView is null || fullModel is null) throw new InvalidOperationException("Full-layout fixture requires a page model."); diff --git a/PlotLine.Tests/WriterDashboardTests.cs b/PlotLine.Tests/WriterDashboardTests.cs index 67cbd618..86024ce0 100644 --- a/PlotLine.Tests/WriterDashboardTests.cs +++ b/PlotLine.Tests/WriterDashboardTests.cs @@ -25,7 +25,7 @@ internal static class WriterDashboardTests Check(await controller.ScheduleSetup(99, 3) is NotFoundResult, "plan setup refuses conflicting project and book"); allowed=false;Check(await controller.Index(null,3) is NotFoundResult,"book-only deep link checks access before metadata"); Check(controller.LegacyWrite(1,3) is RedirectToActionResult redirect&&(int?)redirect.RouteValues!["bookId"]==3,"legacy Write redirect preserves book scope"); - var ribbon=ApplicationRibbon.Categories.Single(c=>c.Key=="writer");Check(ribbon.Groups.SelectMany(g=>g.Commands).Any(c=>c.Action=="Workspaces")&&ribbon.Groups.SelectMany(g=>g.Commands).Any(c=>c.Controller=="WritingActivity"),"Writer contextual commands target implemented workspaces and evidence"); + var commands=WriterNavigation.RibbonGroups("Reflect").SelectMany(g=>g.Commands);Check(commands.Any(c=>c.Action=="Workspaces")&&commands.Any(c=>c.Controller=="WritingActivity"),"Writer contextual commands target implemented workspaces and evidence"); } private static T Proxy(Func action)where T:class {var value=DispatchProxy.Create();((WriterProxy)(object)value).Action=action;return value;} public class WriterProxy:DispatchProxy diff --git a/PlotLine.Tests/WriterNavigationTests.cs b/PlotLine.Tests/WriterNavigationTests.cs new file mode 100644 index 00000000..99977c01 --- /dev/null +++ b/PlotLine.Tests/WriterNavigationTests.cs @@ -0,0 +1,54 @@ +using Microsoft.AspNetCore.Mvc; +using PlotLine.Controllers; +using PlotLine.Data; +using PlotLine.Models; +using PlotLine.Services; +using PlotLine.ViewModels; + +internal static class WriterNavigationTests +{ + public static async Task Run() + { + void Check(bool ok,string why){if(!ok)throw new Exception(why);Console.WriteLine("PASS Writer navigation "+why);} + var allowed=true;int reads=0; + var workspace=NativeWorkflowTests.Proxy((n,a)=> + { + if(n!="GetDashboardAsync")throw new Exception("Navigation attempted a write or workflow initialisation: "+n); + reads++; + return Task.FromResult(new WriterDashboardViewModel{ProjectID=7,Objective=(int?)a![1]==12?new(){BookID=12,ChapterID=21,SceneID=31,SceneTitle="Saved scene",Activity="Revising"}:null}); + }); + var books=NativeWorkflowTests.Proxy((n,a)=>n switch{ + "ListByProjectAsync"=>Task.FromResult>([new(){BookID=12,ProjectID=7,BookTitle="First"},new(){BookID=13,ProjectID=7,BookTitle="Second"}]), + "GetAsync"=>Task.FromResult((int)a![0]! is 12 or 13?new(){BookID=(int)a[0]!,ProjectID=7}:null), + _=>throw new Exception(n)}); + var schedules=NativeWorkflowTests.Proxy((n,a)=>n=="GetTodayDashboardAsync"?Task.FromResult(new WritingScheduleDashboardViewModel()):throw new Exception("Navigation attempted schedule mutation "+n)); + var access=NativeWorkflowTests.Proxy((n,a)=>Task.FromResult(allowed)); + var controller=new WriterController(workspace,schedules,books,access); + var routes=new Dictionary>>{ + ["Home"]=b=>controller.Index(7,b),["Write"]=b=>controller.Write(7,b),["Explore"]=b=>controller.Explore(7,b), + ["Plan"]=b=>controller.Plan(7,b),["Review"]=b=>controller.Review(7,b),["Reflect"]=b=>controller.Reflect(7,b),["Dashboard"]=b=>controller.Dashboard(7,b)}; + foreach(var (destination,load) in routes){ + var first=(ViewResult)await load(12);var model=(WriterDashboardViewModel)first.Model!; + Check(model.Destination==destination&&model.BookID==12&&model.WorkingContext?.Working?.SceneID==31,"destination "+destination+" preserves authorised book and saved working focus"); + var second=(ViewResult)await load(13);model=(WriterDashboardViewModel)second.Model!; + Check(model.BookID==13&&model.Objective==null&&model.WorkingContext?.Working==null,"destination "+destination+" never carries a focus into another book"); + Check(await load(999) is NotFoundResult,"destination "+destination+" refuses unavailable book"); + } + Check(((ViewResult)await controller.Index(7,12,workspace:"Revision")).ViewName=="Legacy"&&((ViewResult)await controller.Index(7,12,journey:true)).ViewName=="Legacy","legacy query routes still reach their actual workspaces/calendar"); + Check(((WriterDashboardViewModel)((ViewResult)await controller.Index(7,12,setup:true)).Model!).Destination=="Write","old objective setup URL reaches Write"); + Check(((ViewResult)await controller.Workspaces(7,12)).ViewName=="Legacy"&&((ViewResult)await controller.Journey(7,12)).ViewName=="Legacy"&&((ViewResult)await controller.Overview(7,12)).ViewName=="Legacy","full legacy desk, Journey and Workspaces remain rendered, not retired"); + allowed=false;Check(await controller.Write(null,12) is NotFoundResult&&await controller.Explore(null,12) is NotFoundResult,"book-only new route checks access before metadata"); + foreach(var destination in WriterNavigation.Destinations){ + Check(WriterNavigation.BookSwitchAction(destination)==destination,"book switching retains "+destination+" without chapter parameters"); + var groups=WriterNavigation.RibbonGroups(destination); + Check(groups[0].Commands.Select(x=>x.Action).SequenceEqual(new[]{"Index","Write","Explore","Plan","Review","Reflect"}),"single existing ribbon exposes all destinations on "+destination); + } + Check(WriterNavigation.BookSwitchAction("write")=="Write" && WriterNavigation.DestinationForAction("schedulepreview")=="Plan","case-insensitive bookmarked routes retain destination context"); + Check(WriterNavigation.BookSwitchAction("SaveObjective")=="Index","book menu never navigates to a mutation action"); + var noBooks=NativeWorkflowTests.Proxy((n,a)=>n=="GetDashboardAsync"?Task.FromResult(new WriterDashboardViewModel()):throw new Exception("Empty-book navigation attempted a write")); + var empty=new WriterController(noBooks,schedules); + Check(((WriterDashboardViewModel)((ViewResult)await empty.Index(null)).Model!).BookID==null,"new author Home has no fabricated book selection"); + Check(((WriterDashboardViewModel)((ViewResult)await empty.Explore(null)).Model!).Destination=="Explore","exploration does not require scenes, plans, project or Word"); + Check(reads>0,"real read paths exercised without calling author-data writes"); + } +} diff --git a/PlotLine/Controllers/WriterController.cs b/PlotLine/Controllers/WriterController.cs index ad176e4e..d27fe782 100644 --- a/PlotLine/Controllers/WriterController.cs +++ b/PlotLine/Controllers/WriterController.cs @@ -14,7 +14,17 @@ public sealed class WriterController( IWritingScheduleService writingSchedule, IBookRepository? bookRepository=null, IProjectAccessService? access=null, WritingActivityRepository? activity=null, WriterObjectiveRepository? objectives=null, WriterWorkRepository? work=null, PlotLine.Services.Writer.IWriterSuggestionProvider? suggestions=null, WriterPlanningRepository? planning=null) : Controller { - public async Task Index(int? projectId,int? bookId=null,string? workspace=null,bool journey=false,int? year=null,int? month=null,DateTime? day=null) + public Task Index(int? projectId, int? bookId = null, string? workspace = null, bool journey = false, int? year = null, int? month = null, DateTime? day = null, bool setup = false) + => LoadDestination(setup ? "Write" : journey || workspace != null ? "Legacy" : "Home", projectId, bookId, workspace, journey, year, month, day); + public Task Write(int? projectId, int? bookId = null) => LoadDestination("Write", projectId, bookId); + public Task Explore(int? projectId, int? bookId = null) => LoadDestination("Explore", projectId, bookId); + public Task Plan(int? projectId, int? bookId = null) => LoadDestination("Plan", projectId, bookId); + public Task Review(int? projectId, int? bookId = null) => LoadDestination("Review", projectId, bookId); + public Task Reflect(int? projectId, int? bookId = null) => LoadDestination("Reflect", projectId, bookId); + public Task Dashboard(int? projectId, int? bookId = null) => LoadDestination("Dashboard", projectId, bookId); + public Task Overview(int? projectId, int? bookId = null) => LoadDestination("Legacy", projectId, bookId); + + private async Task LoadDestination(string destination, int? projectId, int? bookId = null, string? workspace = null, bool journey = false, int? year = null, int? month = null, DateTime? day = null) { if(bookId.HasValue&&!projectId.HasValue&&bookRepository!=null) { @@ -83,11 +93,12 @@ public sealed class WriterController( } } model.Suggestions = (suggestions ?? new PlotLine.Services.Writer.WriterSuggestionProvider()).Suggest(model); - return View("Index",model); + model.Destination = destination; + return View(destination == "Home" ? "Index" : destination == "Legacy" ? "Legacy" : "Destination", model); } - public Task Workspaces(int? projectId,int? bookId,string? workspace=null)=>Index(projectId,bookId,workspace); - public Task Journey(int? projectId,int? bookId,int? year=null,int? month=null,DateTime? day=null)=>Index(projectId,bookId,journey:true,year:year,month:month,day:day); - public IActionResult DisplaySetup(int? projectId,int? bookId)=>Redirect(Url.Action(nameof(Index),new{projectId,bookId})+"#display-setup"); + public Task Workspaces(int? projectId,int? bookId,string? workspace=null)=>LoadDestination("Legacy",projectId,bookId,workspace); + public Task Journey(int? projectId,int? bookId,int? year=null,int? month=null,DateTime? day=null)=>LoadDestination("Legacy",projectId,bookId,journey:true,year:year,month:month,day:day); + public IActionResult DisplaySetup(int? projectId,int? bookId)=>Redirect(Url.Action(nameof(Overview),new{projectId,bookId})+"#display-setup"); [HttpGet("Write"),HttpGet("Write/Index")] public IActionResult LegacyWrite(int? projectId,int? bookId)=>RedirectToAction(nameof(Index),new{projectId,bookId}); @@ -96,11 +107,11 @@ public sealed class WriterController( { if (access == null || !await access.CanAccessEntityAsync("Book", model.BookID)) return NotFound(); if (!ModelState.IsValid || objectives == null || !int.TryParse(User.FindFirstValue(ClaimTypes.NameIdentifier), out var author)) - { TempData["WriterWorkspaceError"] = "Choose a working activity and a place in this book."; return RedirectToAction(nameof(Index), new { bookId = model.BookID, setup = true }); } + { TempData["WriterWorkspaceError"] = "Choose a working activity and a place in this book."; return RedirectToAction(nameof(Write), new { bookId = model.BookID, setup = true }); } try { await objectives.Save(author, model); } catch (SqlException e) when (e.Number == 51000) - { TempData["WriterWorkspaceError"] = "That chapter or scene is no longer available. Choose a place in this book."; return RedirectToAction(nameof(Index), new { bookId = model.BookID, setup = true }); } - return scheduleNow ? RedirectToAction(nameof(ScheduleSetup), new { bookId = model.BookID }) : RedirectToAction(nameof(Index), new { bookId = model.BookID }); + { TempData["WriterWorkspaceError"] = "That chapter or scene is no longer available. Choose a place in this book."; return RedirectToAction(nameof(Write), new { bookId = model.BookID, setup = true }); } + return scheduleNow ? RedirectToAction(nameof(ScheduleSetup), new { bookId = model.BookID }) : RedirectToAction(nameof(Write), new { bookId = model.BookID }); } public async Task Chapter(int id) diff --git a/PlotLine/Help/Articles/Workspace/Overview.md b/PlotLine/Help/Articles/Workspace/Overview.md index b1081abf..5997262b 100644 --- a/PlotLine/Help/Articles/Workspace/Overview.md +++ b/PlotLine/Help/Articles/Workspace/Overview.md @@ -11,6 +11,8 @@ screenshot: # Overview +Writer now opens on [Writer Home](/Help/Article/writer3.home). The existing full desk described here is available through **Writing desk** and **Workspaces** in the Writer ribbon. Its features and saved data remain available. + Writer gathers your saved focus, writing plans, scene queues and recent activity. Choose a project and book in the application bar. Your saved working objective is a return target; it does not change merely because you browse a reference or read a different chapter. diff --git a/PlotLine/Help/Articles/Workspace/Writer3-dashboard.md b/PlotLine/Help/Articles/Workspace/Writer3-dashboard.md new file mode 100644 index 00000000..30dab5a0 --- /dev/null +++ b/PlotLine/Help/Articles/Workspace/Writer3-dashboard.md @@ -0,0 +1,16 @@ +--- +title: Writing Dashboard +category: Workspace +tags: writer, navigation, dashboard +contextKey: writer3.dashboard +micro: See recorded progress and planned work together. +quickTitle: Writing Dashboard +quickSummary: See recorded progress and planned work together. +screenshot: +--- + +# Overview + +Writing Dashboard is a compact overview within Plan and Reflect. Your manuscript shows actual retained accepted changes where available and labelled catalogue/snapshot word counts. Your next writing time shows saved planned activities or existing workflow tasks; it does not claim work has happened. + +Open Plan to create/manage availability and activities. Open Reflect to inspect recorded changes, Journey and reports. For a new book or disabled/private evidence, empty states explain what is unavailable without inventing progress or insights. Home and all five destinations remain directly available through the Writer ribbon. diff --git a/PlotLine/Help/Articles/Workspace/Writer3-explore.md b/PlotLine/Help/Articles/Workspace/Writer3-explore.md new file mode 100644 index 00000000..1c67b93c --- /dev/null +++ b/PlotLine/Help/Articles/Workspace/Writer3-explore.md @@ -0,0 +1,18 @@ +--- +title: Explore Your Story +category: Workspace +tags: writer, navigation, explore +contextKey: writer3.explore +micro: Start with a concern or inspect your saved story references. +quickTitle: Explore Your Story +quickSummary: Start with a concern or inspect your saved story references. +screenshot: +--- + +# Overview + +Explore offers real entry points to the existing Problem Solver questionnaire, its browsable guidance and the story Timeline. It does not generate a new creative analysis merely by opening this page. + +You can use the Problem Solver before you have a project or scenes. Its questions and editorial guidance are separate from manuscript-aware evidence assessment. Saved character, relationship, plot, map, floor-plan and metric tools are linked directly when a project is selected. Some of those tools are project-wide and may include other books. + +The full specialist workspaces retain their existing editing, permissions and source records. No suggested interpretation silently updates a story fact. Guided idea capture and richer manuscript-aware journeys are later work, not simulated controls here. diff --git a/PlotLine/Help/Articles/Workspace/Writer3-home.md b/PlotLine/Help/Articles/Workspace/Writer3-home.md new file mode 100644 index 00000000..20994e94 --- /dev/null +++ b/PlotLine/Help/Articles/Workspace/Writer3-home.md @@ -0,0 +1,24 @@ +--- +title: Writer Home +category: Workspace +tags: writer, navigation, home +contextKey: writer3.home +micro: Choose Write, Explore or your Writing Dashboard. +quickTitle: Writer Home +quickSummary: Choose Write, Explore or your Writing Dashboard. +screenshot: +--- + +# Overview + +Writer Home is a starting point for the selected book. The three main actions are equal choices: Continue Writing opens Write with your saved chapter or scene where available; Explore Your Story opens guidance and existing story references; Writing Dashboard brings together recorded progress and planned work. + +# Getting started + +Choose your book in the application bar. Without a saved objective, Write lets you choose an activity and optional chapter/scene. Explore does not require scenes, a plan or Word. A new book has honest empty states rather than invented activity. + +# Navigation and existing tools + +The Writer ribbon takes you directly to Home, Write, Explore, Plan, Review and Reflect. Writing Dashboard is a Plan/Reflect overview. Utilities retains Workspaces and Display Setup; Writing desk opens the previous full desk with its Help Me suggestions, activity and planning controls. Writing Journey, writing plans and reports retain their existing routes. + +Changing books within a destination reloads that destination with the new book’s own saved objective. No chapter, scene or Word selection is copied across books. Context and Intent remain separate reference windows. diff --git a/PlotLine/Help/Articles/Workspace/Writer3-plan.md b/PlotLine/Help/Articles/Workspace/Writer3-plan.md new file mode 100644 index 00000000..99a2a93c --- /dev/null +++ b/PlotLine/Help/Articles/Workspace/Writer3-plan.md @@ -0,0 +1,20 @@ +--- +title: Plan Your Writing +category: Workspace +tags: writer, navigation, plan +contextKey: writer3.plan +micro: Create or manage the existing scoped writing plans and schedules. +quickTitle: Plan Your Writing +quickSummary: Create or manage the existing scoped writing plans and schedules. +screenshot: +--- + +# Overview + +Plan opens existing schedule setup, Writing Plans and scoped Schedule Preview. Work ahead shows up to three saved reviewed activities, or existing workflow tasks when no reviewed activities are listed. Planned minutes are budgets, not measured writing time. + +Create a writing plan saves availability first, then asks you to review actual chapter/scene candidates and confirm budgets. Estimates are optional. Both older workflow tasks and reviewed allocations remain available; completion is author-declared and does not change scene readiness or checklist completion. + +Preview and manage links preserve the book and include project-wide All Books plans. The visual scheduling engine, editable calendar and richer adjustments are later work. Current adjustment controls remain in the existing Edit Plan and review screens. + +[Writing plans and recorded work](/Help/Article/workspace.writingPlans) diff --git a/PlotLine/Help/Articles/Workspace/Writer3-reflect.md b/PlotLine/Help/Articles/Workspace/Writer3-reflect.md new file mode 100644 index 00000000..fcb27fab --- /dev/null +++ b/PlotLine/Help/Articles/Workspace/Writer3-reflect.md @@ -0,0 +1,18 @@ +--- +title: Reflect on Your Writing +category: Workspace +tags: writer, navigation, reflect +contextKey: writer3.reflect +micro: Inspect recorded progress, Journey, sessions and reports. +quickTitle: Reflect on Your Writing +quickSummary: Inspect recorded progress, Journey, sessions and reports. +screenshot: +--- + +# Overview + +Reflect displays retained accepted additions, removals and net change for the last30days, where available. Counts are evidence of accepted changes, not writing quality or continuous concentration. Catalogue word counts are labelled separately from accepted snapshots. + +Writing Journey opens the existing month/year/day calendar, work sessions and return notes. Reports, privacy & exports opens owner-private evidence and existing recording/retention/erasure controls. Collaborators do not gain private report access through this page. + +No retained evidence does not mean no writing took place. A baseline starts from accepted manuscript content; prior activity is not reconstructed. Writing Process and reflective insights are forthcoming; no writing style is inferred or presented as a result in this release. diff --git a/PlotLine/Help/Articles/Workspace/Writer3-review.md b/PlotLine/Help/Articles/Workspace/Writer3-review.md new file mode 100644 index 00000000..8fd6d7be --- /dev/null +++ b/PlotLine/Help/Articles/Workspace/Writer3-review.md @@ -0,0 +1,22 @@ +--- +title: Review Your Writing +category: Workspace +tags: writer, navigation, review +contextKey: writer3.review +micro: Read accepted text, revisit intentions and choose revision work. +quickTitle: Review Your Writing +quickSummary: Read accepted text, revisit intentions and choose revision work. +screenshot: +--- + +# Overview + +Review opens the read-only Manuscript Reader and Focused reading, using your saved focus chapter or the first available chapter. The Reader shows accepted server text, not unsynchronised Word edits. Empty/new chapters explain the need to save and synchronise; no source text is invented. + +# Audio Review + +Open the Reader and expand Reading & Audio Review. Select/start the activity explicitly. Playback requires compatible Windows Companion and a supported player. Opening Review or Reader does not play audio. Pause stops external playback when supported; End review stops tracking and saves your note. + +# Intent and evidence + +Open Intent uses the existing standalone reference window. Its Evidence tab loads saved evidence or explicitly assesses saved scene prose and saved intentions when permitted. Intentions, AI interpretation and author-confirmed checklist completion remain separate. Scenes marked for revision opens the existing Revision workspace. No synchronisation or evidence contract is replaced by this shell. diff --git a/PlotLine/Help/Articles/Workspace/Writer3-write.md b/PlotLine/Help/Articles/Workspace/Writer3-write.md new file mode 100644 index 00000000..525600e6 --- /dev/null +++ b/PlotLine/Help/Articles/Workspace/Writer3-write.md @@ -0,0 +1,22 @@ +--- +title: Write +category: Workspace +tags: writer, navigation, write +contextKey: writer3.write +micro: Return to your saved focus and existing chapter or scene tools. +quickTitle: Write +quickSummary: Return to your saved focus and existing chapter or scene tools. +screenshot: +--- + +# Overview + +Write shows your saved writing activity and chapter/scene, or lets you choose a first focus without a plan. Open current scene or Open current chapter leads to existing editing tools for intentions, notes, checklist, workflow and attachments. Manuscript prose is written in Word, not in this navigation shell. + +# Sessions and references + +The existing session controls are available to the book owner. Starting and ending sessions are explicit; opening Write does not start a session. The selected session chapter remains independent from Reader and reference browsing. Use Open Context and Open Intent for existing standalone windows; Display Setup retains placement and permission controls. + +# Change focus + +Change objective opens the existing activity/chapter/scene form. Saving it changes your return target, not manuscript text or scene Revision Status. A scene must belong to the selected chapter/book. You may choose the whole manuscript. Book switching loads that book’s objective rather than retaining stale IDs. diff --git a/PlotLine/Services/ApplicationNavigation.cs b/PlotLine/Services/ApplicationNavigation.cs index 264f0dbf..b09d86be 100644 --- a/PlotLine/Services/ApplicationNavigation.cs +++ b/PlotLine/Services/ApplicationNavigation.cs @@ -24,6 +24,9 @@ public sealed class ApplicationNavigation(IProjectRepository projects, IBookRepo "ContinuityExplorer" => "Continuity Explorer", "Analytics" or "Dynamics" => "Health", "Archives" => "Archive", _ => controller } }; + var writerDestination = Property(model, "Destination") as string; + result.WriterDestination = controller == "WritingActivity" ? "Reflect" : controller == "WriterPlanning" ? "Plan" + : writerDestination is null or "Legacy" ? WriterNavigation.DestinationForAction(request.RouteValues["action"]?.ToString()) : writerDestination; if (currentUser.UserId is not int userId) return result; var project = Project ?? Property(model, "Project") as Project ?? model as Project; diff --git a/PlotLine/Services/ApplicationRibbon.cs b/PlotLine/Services/ApplicationRibbon.cs index c393fdd8..0d2354d5 100644 --- a/PlotLine/Services/ApplicationRibbon.cs +++ b/PlotLine/Services/ApplicationRibbon.cs @@ -4,11 +4,11 @@ namespace PlotLine.Services; public sealed record RibbonCommand(string Label, string IconKey, string Controller, string Action, string Scope = "project", bool OwnerOnly = false, string? ToolbarKey = null, bool Post = false) { - public bool Available(ApplicationNavigationViewModel model) => (Scope == "global" || model.Project is not null) + public bool Available(ApplicationNavigationViewModel model) => (Scope is "global" or "writerNavigation" || model.Project is not null) && (Scope != "book" && Scope != "chapter" && Scope != "writerBook" || model.Book is not null) && (!OwnerOnly || model.Project?.IsOwner == true); public object Values(ApplicationNavigationViewModel model) => Scope switch { - "writerBook" => new { projectId=model.Project?.ProjectID,bookId=model.Book?.BookID }, + "writerBook" or "writerNavigation" => new { projectId=model.Project?.ProjectID,bookId=model.Book?.BookID }, "global" => new { }, "id" => new { id = model.Project?.ProjectID }, "book" => new { id = model.Book?.BookID }, "chapter" => new { bookId = model.Book?.BookID }, _ => new { projectId = model.Project?.ProjectID } @@ -32,10 +32,7 @@ public static class ApplicationRibbon new("book", "Book", new("Selected book", new("Book overview", "bible", "Books", "Details", "book"), new("Edit book", "writer", "Books", "Edit", "book"), new("Add chapter", "threads", "Chapters", "Create", "chapter")), new("Manuscript review", S("review")), new("Library", S("overview"), new("Add book", "bible", "Books", "Create"))), - new("writer", "Writer", - new("Writing", new("Overview","writer","Writer","Index","writerBook"),new("Writing Journey","calendar","Writer","Journey","writerBook"),new("Writing Plan","calendar","Writer","WritingPlans","writerBook")), - new("Work",new("Workspaces","threads","Writer","Workspaces","writerBook"),new("Reports","metrics","WritingActivity","Index","writerBook",OwnerOnly:true)), - new("Workspace setup",new RibbonCommand("Display Setup","maps","Writer","DisplaySetup","writerBook"))), + new("writer", "Writer", WriterNavigation.RibbonGroups("Home").ToArray()), new("story", "Story", new("Story structure", S("timeline"), S("plotlines"), S("threads"), S("calendar"), S("point")), new("Analysis & planning", S("review"), S("scenarios"), S("continuity"))), new("characters", "Characters", new("Cast", S("characters"), S("names")), new("Connections", S("relationships"))), new("world", "World", new("Setting", S("locations"), S("maps"), S("floorplans")), new("Story world", S("assets"))), diff --git a/PlotLine/Services/Writer/WriterSuggestions.cs b/PlotLine/Services/Writer/WriterSuggestions.cs index 18598044..b025bb22 100644 --- a/PlotLine/Services/Writer/WriterSuggestions.cs +++ b/PlotLine/Services/Writer/WriterSuggestions.cs @@ -8,7 +8,7 @@ public sealed class WriterSuggestionProvider:IWriterSuggestionProvider public IReadOnlyList Suggest(WriterDashboardViewModel model) { var result=new List(); - if(model.Objective is {} objective)result.Add(new("focus",$"Your saved activity is {objective.Activity.ToLowerInvariant()}.","Return to your current focus",objective.SceneID.HasValue?"Scenes":"Writer",objective.SceneID.HasValue?"Edit":objective.ChapterID.HasValue?"Chapter":"Index",objective.SceneID??objective.ChapterID)); + if(model.Objective is {} objective)result.Add(new("focus",$"Your saved activity is {objective.Activity.ToLowerInvariant()}.","Return to your current focus",objective.SceneID.HasValue?"Scenes":"Writer",objective.SceneID.HasValue?"Edit":objective.ChapterID.HasValue?"Chapter":"Write",objective.SceneID??objective.ChapterID)); if(model.PlannedActivities.FirstOrDefault() is {} reviewed)result.Add(new("reviewed",$"Your reviewed plan includes {reviewed.Title} on {reviewed.ScheduledDate:d MMM}.","Open your next planned activity",reviewed.SceneID.HasValue?"Scenes":"Writer",reviewed.SceneID.HasValue?"Edit":"Chapter",reviewed.SceneID??reviewed.ChapterID)); var planned=model.WritingSchedule.TodayTasks.Concat(model.WritingSchedule.UpcomingTasks).FirstOrDefault(); if(planned!=null)result.Add(new("planned",$"Your plan includes {planned.SceneTitle} on {planned.ScheduledDate:d MMM}.","Open this planned scene","Scenes","Edit",planned.SceneID)); diff --git a/PlotLine/Services/WriterNavigation.cs b/PlotLine/Services/WriterNavigation.cs new file mode 100644 index 00000000..77cd9546 --- /dev/null +++ b/PlotLine/Services/WriterNavigation.cs @@ -0,0 +1,49 @@ +namespace PlotLine.Services; + +// Route/presentation metadata only. No persisted global focus or author-data mutation. +public static class WriterNavigation +{ + public static IReadOnlyList Destinations { get; } = Array.AsReadOnly(new[] { "Write", "Explore", "Plan", "Review", "Reflect" }); + private static readonly string[] BookSwitchActions = ["Write", "Explore", "Plan", "Review", "Reflect", "Dashboard", "Overview"]; + public static string BookSwitchAction(string? action) => BookSwitchActions.FirstOrDefault(x => string.Equals(x, action, StringComparison.OrdinalIgnoreCase)) ?? "Index"; + public static string DestinationForAction(string? action) => action?.ToLowerInvariant() switch + { + "write" => "Write", "explore" => "Explore", "plan" => "Plan", "review" => "Review", "reflect" => "Reflect", "dashboard" => "Dashboard", + "writingplans" or "schedulesetup" or "schedulepreview" or "editwritingplan" => "Plan", + "journey" => "Reflect", "workspaces" or "overview" or "legacy" or "chapter" => "Write", _ => "Home" + }; + public static string Purpose(string destination) => destination switch + { + "Write" => "Choose your focus and return to the chapter or scene you are working on.", + "Explore" => "Develop an idea, find a way forward, or look more closely at your story.", + "Plan" => "Decide what you want to work on and make room for it.", + "Review" => "Read accepted manuscript text, revisit intentions and decide what to improve.", + "Reflect" => "See recorded progress and revisit your writing journey.", + "Dashboard" => "Your plans, manuscript and recorded progress at a glance.", + _ => "Choose where you would like to begin today." + }; + public static IReadOnlyList RibbonGroups(string destination) + { + var groups = new List + { + new("Writer", new("Home","overview","Writer","Index","writerNavigation"), + new("Write","writer","Writer","Write","writerNavigation"), + new("Explore","point","Writer","Explore","writerNavigation"), + new("Plan","calendar","Writer","Plan","writerNavigation"), + new("Review","review","Writer","Review","writerNavigation"), + new("Reflect","metrics","Writer","Reflect","writerNavigation")) + }; + var context = destination switch + { + "Write" => new RibbonGroup("Current work", new("Chapters","bible","Books","Details","book"), new("Writing desk","writer","Writer","Overview","writerBook"), new("Writing Plan","calendar","Writer","WritingPlans","writerBook")), + "Explore" => new RibbonGroup("Story exploration", new("Problem Solver","point","WritingProblems","Index","global"), new("Story overview","timeline","Timeline","Index","writerBook")), + "Plan" => new RibbonGroup("Writing plans", new("Writing Plan","calendar","Writer","WritingPlans","writerBook"), new("Schedule Preview","calendar","Writer","SchedulePreview","writerBook")), + "Review" => new RibbonGroup("Reading & review", new("Manuscript Reader","bible","ManuscriptReader","Index","writerBook"), new("Writing desk","writer","Writer","Overview","writerBook")), + "Reflect" => new RibbonGroup("Writing history", new("Writing Journey","calendar","Writer","Journey","writerBook"), new("Reports","metrics","WritingActivity","Index","writerBook",OwnerOnly:true)), + _ => new RibbonGroup("Your writing", new("Writing Dashboard","metrics","Writer","Dashboard","writerBook"), new("Writing desk","writer","Writer","Overview","writerBook")) + }; + groups.Add(context); + groups.Add(new("Utilities", new("Workspaces","threads","Writer","Workspaces","writerBook"), new("Display Setup","maps","Writer","DisplaySetup","writerBook"))); + return groups; + } +} diff --git a/PlotLine/ViewModels/ApplicationNavigationViewModel.cs b/PlotLine/ViewModels/ApplicationNavigationViewModel.cs index 6370fbc8..d0e62a06 100644 --- a/PlotLine/ViewModels/ApplicationNavigationViewModel.cs +++ b/PlotLine/ViewModels/ApplicationNavigationViewModel.cs @@ -11,5 +11,6 @@ public sealed class ApplicationNavigationViewModel public Project? Project { get; set; } public Book? Book { get; set; } public IReadOnlyList Books { get; set; } = []; + public string WriterDestination { get; set; } = "Home"; public string ActiveSection { get; set; } = string.Empty; } diff --git a/PlotLine/ViewModels/CoreViewModels.cs b/PlotLine/ViewModels/CoreViewModels.cs index 55e7cc87..9f353cb7 100644 --- a/PlotLine/ViewModels/CoreViewModels.cs +++ b/PlotLine/ViewModels/CoreViewModels.cs @@ -927,6 +927,7 @@ public sealed class ChapterWorkflowViewModel public sealed class WriterDashboardViewModel { + public string Destination { get; set; } = "Legacy"; public PlotLine.Services.Writer.WriterContext? WorkingContext { get; set; } public IReadOnlyList PlannedActivities { get; set; } = []; public WriterWorkPage? Work { get; set; } diff --git a/PlotLine/Views/Shared/_ApplicationNavigation.cshtml b/PlotLine/Views/Shared/_ApplicationNavigation.cshtml index b1747faf..0c70477d 100644 --- a/PlotLine/Views/Shared/_ApplicationNavigation.cshtml +++ b/PlotLine/Views/Shared/_ApplicationNavigation.cshtml @@ -64,7 +64,7 @@
  • @foreach (var choice in Model.Books) { -
  • Book @choice.BookNumber: @choice.BookDisplayTitle
  • +
  • Book @choice.BookNumber: @choice.BookDisplayTitle
  • } @if (Model.Books.Count == 0) { diff --git a/PlotLine/Views/Shared/_ApplicationShell.cshtml b/PlotLine/Views/Shared/_ApplicationShell.cshtml index 32cab431..0bd6a915 100644 --- a/PlotLine/Views/Shared/_ApplicationShell.cshtml +++ b/PlotLine/Views/Shared/_ApplicationShell.cshtml @@ -59,7 +59,7 @@
  • @foreach (var choice in Model.Books) { -
  • Book @choice.BookNumber: @choice.BookDisplayTitle
  • +
  • Book @choice.BookNumber: @choice.BookDisplayTitle
  • } @if (Model.Books.Count == 0) { @@ -130,7 +130,7 @@ @foreach (var category in ApplicationRibbon.Categories) {