Implement Writer 3 Phase 2A home and contextual destination shells

This commit is contained in:
Nick Beckley 2026-11-16 15:55:25 +00:00
parent 5d18f6cbe2
commit f96259a378
44 changed files with 801 additions and 139 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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});

View File

@ -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});

View File

@ -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.");

View File

@ -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.");
}

View File

@ -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<IBookRepository>((name, args) => name == "ListByProjectAsync"
? Task.FromResult<IReadOnlyList<Book>>([new() { BookID = 12, ProjectID = 7, BookTitle = "A Distant Shore" }, new() { BookID = 13, ProjectID = 7, BookTitle = "The Return" }]) : throw new NotSupportedException(name)),
services.GetRequiredService<ICurrentUserService>()));
builder.Services.AddSingleton(FixtureProxy<IBookRepository>((name,args)=>name switch {
"ListByProjectAsync" => Task.FromResult<IReadOnlyList<Book>>([new(){BookID=12,ProjectID=7,BookTitle="A Distant Shore"},new(){BookID=13,ProjectID=7,BookTitle="The Return"}]),
"GetAsync" => Task.FromResult<Book?>((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<IProjectAccessService>((name,args)=>Task.FromResult(name=="CanAccessProjectAsync"?(int)args![0]! == 7:(int)args![1]! is 12 or 13)));
builder.Services.AddScoped<IWriterWorkspaceService>(services => FixtureProxy<IWriterWorkspaceService>((name, args) => name switch {
"GetDashboardAsync" => Task.FromResult(WriterFixture()),
"GetDashboardAsync" => Task.FromResult(Writer3Fixture(services.GetRequiredService<IHttpContextAccessor>().HttpContext!)),
"GetChapterWorkflowAsync" => Task.FromResult<ChapterWorkflowViewModel?>(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.");

View File

@ -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<T>(Func<string,object?[]?,object?> action)where T:class {var value=DispatchProxy.Create<T,WriterProxy>();((WriterProxy)(object)value).Action=action;return value;}
public class WriterProxy:DispatchProxy

View File

@ -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<IWriterWorkspaceService>((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<IBookRepository>((n,a)=>n switch{
"ListByProjectAsync"=>Task.FromResult<IReadOnlyList<Book>>([new(){BookID=12,ProjectID=7,BookTitle="First"},new(){BookID=13,ProjectID=7,BookTitle="Second"}]),
"GetAsync"=>Task.FromResult<Book?>((int)a![0]! is 12 or 13?new(){BookID=(int)a[0]!,ProjectID=7}:null),
_=>throw new Exception(n)});
var schedules=NativeWorkflowTests.Proxy<IWritingScheduleService>((n,a)=>n=="GetTodayDashboardAsync"?Task.FromResult(new WritingScheduleDashboardViewModel()):throw new Exception("Navigation attempted schedule mutation "+n));
var access=NativeWorkflowTests.Proxy<IProjectAccessService>((n,a)=>Task.FromResult(allowed));
var controller=new WriterController(workspace,schedules,books,access);
var routes=new Dictionary<string,Func<int,Task<IActionResult>>>{
["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<IWriterWorkspaceService>((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");
}
}

View File

@ -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<IActionResult> Index(int? projectId,int? bookId=null,string? workspace=null,bool journey=false,int? year=null,int? month=null,DateTime? day=null)
public Task<IActionResult> 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<IActionResult> Write(int? projectId, int? bookId = null) => LoadDestination("Write", projectId, bookId);
public Task<IActionResult> Explore(int? projectId, int? bookId = null) => LoadDestination("Explore", projectId, bookId);
public Task<IActionResult> Plan(int? projectId, int? bookId = null) => LoadDestination("Plan", projectId, bookId);
public Task<IActionResult> Review(int? projectId, int? bookId = null) => LoadDestination("Review", projectId, bookId);
public Task<IActionResult> Reflect(int? projectId, int? bookId = null) => LoadDestination("Reflect", projectId, bookId);
public Task<IActionResult> Dashboard(int? projectId, int? bookId = null) => LoadDestination("Dashboard", projectId, bookId);
public Task<IActionResult> Overview(int? projectId, int? bookId = null) => LoadDestination("Legacy", projectId, bookId);
private async Task<IActionResult> 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<IActionResult> Workspaces(int? projectId,int? bookId,string? workspace=null)=>Index(projectId,bookId,workspace);
public Task<IActionResult> 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<IActionResult> Workspaces(int? projectId,int? bookId,string? workspace=null)=>LoadDestination("Legacy",projectId,bookId,workspace);
public Task<IActionResult> 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<IActionResult> Chapter(int id)

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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)

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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;

View File

@ -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"))),

View File

@ -8,7 +8,7 @@ public sealed class WriterSuggestionProvider:IWriterSuggestionProvider
public IReadOnlyList<WriterSuggestion> Suggest(WriterDashboardViewModel model)
{
var result=new List<WriterSuggestion>();
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));

View File

@ -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<string> 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<RibbonGroup> RibbonGroups(string destination)
{
var groups = new List<RibbonGroup>
{
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;
}
}

View File

@ -11,5 +11,6 @@ public sealed class ApplicationNavigationViewModel
public Project? Project { get; set; }
public Book? Book { get; set; }
public IReadOnlyList<Book> Books { get; set; } = [];
public string WriterDestination { get; set; } = "Home";
public string ActiveSection { get; set; } = string.Empty;
}

View File

@ -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<WriterPlanActivity> PlannedActivities { get; set; } = [];
public WriterWorkPage? Work { get; set; }

View File

@ -64,7 +64,7 @@
<li><hr class="dropdown-divider" /></li>
@foreach (var choice in Model.Books)
{
<li><a class="dropdown-item @(choice.BookID == book?.BookID ? "active" : null)" aria-current="@(choice.BookID == book?.BookID ? "page" : null)" data-app-book-choice="@choice.BookID" data-app-book-title="@choice.BookDisplayTitle" href="@(Model.ActiveSection == "Writer" ? Url.Action("Index", "Writer", new { projectId = project.ProjectID, bookId = choice.BookID }) : Url.Action("Details", "Books", new { id = choice.BookID }))">Book @choice.BookNumber: @choice.BookDisplayTitle</a></li>
<li><a class="dropdown-item @(choice.BookID == book?.BookID ? "active" : null)" aria-current="@(choice.BookID == book?.BookID ? "page" : null)" data-app-book-choice="@choice.BookID" data-app-book-title="@choice.BookDisplayTitle" href="@(Model.ActiveSection == "Writer" ? Url.Action(WriterNavigation.BookSwitchAction(ViewContext.RouteData.Values["action"]?.ToString()), "Writer", new { projectId = project.ProjectID, bookId = choice.BookID }) : Url.Action("Details", "Books", new { id = choice.BookID }))">Book @choice.BookNumber: @choice.BookDisplayTitle</a></li>
}
@if (Model.Books.Count == 0)
{

View File

@ -59,7 +59,7 @@
<li><hr class="dropdown-divider" /></li>
@foreach (var choice in Model.Books)
{
<li><a class="dropdown-item @(choice.BookID == book?.BookID ? "active" : null)" aria-current="@(choice.BookID == book?.BookID ? "page" : null)" data-app-book-choice="@choice.BookID" data-app-book-title="@choice.BookDisplayTitle" href="@(Model.ActiveSection == "Writer" ? Url.Action("Index", "Writer", new { projectId = project.ProjectID, bookId = choice.BookID }) : Url.Action("Details", "Books", new { id = choice.BookID }))">Book @choice.BookNumber: @choice.BookDisplayTitle</a></li>
<li><a class="dropdown-item @(choice.BookID == book?.BookID ? "active" : null)" aria-current="@(choice.BookID == book?.BookID ? "page" : null)" data-app-book-choice="@choice.BookID" data-app-book-title="@choice.BookDisplayTitle" href="@(Model.ActiveSection == "Writer" ? Url.Action(WriterNavigation.BookSwitchAction(ViewContext.RouteData.Values["action"]?.ToString()), "Writer", new { projectId = project.ProjectID, bookId = choice.BookID }) : Url.Action("Details", "Books", new { id = choice.BookID }))">Book @choice.BookNumber: @choice.BookDisplayTitle</a></li>
}
@if (Model.Books.Count == 0)
{
@ -130,7 +130,7 @@
@foreach (var category in ApplicationRibbon.Categories)
{
<div class="pd-ribbon-panel" id="ribbon-panel-@category.Key" role="tabpanel" aria-labelledby="ribbon-tab-@category.Key" hidden="@(category.Key != selectedCategory)">
@foreach (var group in category.Groups)
@foreach (var group in category.Key == "writer" ? WriterNavigation.RibbonGroups(Model.WriterDestination) : category.Groups)
{
<div class="pd-ribbon-group" role="group" aria-label="@group.Label">
<div class="pd-ribbon-commands">

View File

@ -0,0 +1,31 @@
@model WriterDashboardViewModel
@{
ViewData["Title"] = Model.Destination == "Dashboard" ? "Writing Dashboard" : $"Writer · {Model.Destination}";
ViewData["ProjectSection"] = "Writer";
ViewData["ShellClass"] = "pd-writer writer3-shell";
}
<link rel="stylesheet" href="~/css/writer-work.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/writer3.css" asp-append-version="true" />
<div class="writer3 writer3-destination" data-writer-destination="@Model.Destination" data-writing-workspace-launcher data-compact-writer="true" data-project-id="@Model.ProjectID" data-book-id="@Model.BookID">
<partial name="_Writer3Header" model="Model" />
@if(!Model.BookID.HasValue && Model.Destination != "Explore"){
<section class="writer3-panel writer3-empty"><h2>Begin with a book</h2><p>Select a project and book in the application bar. Your chapters, writing focus and recorded work will stay with that book.</p><a class="btn btn-primary writer3-cta" asp-controller="Projects" asp-action="Index">Open your projects <span aria-hidden="true">→</span></a></section>
}else{
@switch(Model.Destination){
case "Write": <partial name="_WriterWrite" model="Model" /> break;
case "Explore": <partial name="_WriterExplore" model="Model" /> break;
case "Plan": <partial name="_WriterPlan" model="Model" /> break;
case "Review": <partial name="_WriterReview" model="Model" /> break;
case "Reflect": <partial name="_WriterReflect" model="Model" /> break;
case "Dashboard": <partial name="_WriterDashboard" model="Model" /> break;
}
}
</div>
@section Scripts {
<script src="~/js/writing-workspace.js" asp-append-version="true"></script>
<script src="~/js/writing-workspace-launcher.js" asp-append-version="true"></script>
@if(Model.Destination == "Write"){
<script src="~/js/writer-objective.js" asp-append-version="true"></script>
<script src="~/js/writer-work.js" asp-append-version="true"></script>
}
}

View File

@ -1,111 +1,35 @@
@model WriterDashboardViewModel
@{
ViewData["Title"] = Model.Journey ? "Writing Journey" : "Writer";
ViewData["ShellClass"] = "pd-writer";
ViewData["Title"] = "Writer Home";
ViewData["ProjectSection"] = "Writer";
var toolbarKind = Model.Objective?.Activity is "Revising" or "Editing" or "Proofreading" ? "Editing" : Model.Objective?.Activity == "Researching" ? "Planning" : "Writing";
var seed=Model.WriteNext.Concat(Model.ContinueWriting).Concat(Model.RevisionQueue).Concat(Model.PolishingQueue).FirstOrDefault();
var bookId=Model.BookID??seed?.BookID;
var bookTitle=Model.Book?.BookDisplayTitle??seed?.BookDisplayTitle??"Choose a book";
if(string.IsNullOrWhiteSpace(bookTitle)) bookTitle = Model.BookID.HasValue ? "Untitled book" : "Choose a book";
var opportunity=Model.WritingSchedule.TodayTasks.FirstOrDefault()??Model.WritingSchedule.UpcomingTasks.FirstOrDefault();
var showOpportunity = Model.Objective != null || opportunity != null || Model.PlannedActivities.Count > 0;
var totals=Model.Activity?.Totals.HasAcceptedEvidence==true?Model.Activity.Totals:null;
var showWorkspace = Context.Request.RouteValues["action"]?.ToString() == "Workspaces";
var queues=new[]{("WriteNext","Write Next",Model.WriteNext),("InProgress","In Progress",Model.ContinueWriting),("Revision","Revision",Model.RevisionQueue),("FinalPass","Final Pass",Model.PolishingQueue)};
var latestAccepted = Model.Activity?.Events.FirstOrDefault(e => e.Kind != "Observation");
var manuscriptWords = latestAccepted?.WordsAfter ?? Model.Book?.CurrentWordCount;
var days=Model.Activity?.Days??Array.Empty<PlotLine.Models.WritingActivityDay>();
var maximum=Math.Max(1L,days.Select(x=>x.Added+x.Removed).DefaultIfEmpty(1).Max());
ViewData["ShellClass"] = "pd-writer writer3-shell";
var focus = Model.Objective?.SceneTitle ?? Model.Objective?.ChapterTitle;
}
<link rel="stylesheet" href="~/css/writer-work.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/writer-dashboard.css" asp-append-version="true" />
<div class="writer-studio" data-writing-workspace-launcher data-compact-writer="true" data-project-id="@Model.ProjectID" data-book-id="@bookId">
<header class="writer-heading" data-pwa-task>
@if(!string.IsNullOrWhiteSpace(Model.Book?.CoverThumbnailPath)){<img class="writer-book-cover" src="@Url.Content(Model.Book.CoverThumbnailPath)" alt="Cover of @bookTitle" />}else{<div class="writer-book-cover writer-cover-fallback" aria-hidden="true">@(bookTitle[..1])</div>}
<div><p class="eyebrow">@(Model.Journey?"Writing Journey":"Your writing desk")</p><h1>@bookTitle</h1><help-icon key="workspace.overview" /><p class="muted">@(Model.Journey?"Accepted activity and the work ahead.":"Continue your manuscript, review your work, or choose what comes next.")</p></div>
<div class="writer-connection"><span class="writer-status-dot" aria-hidden="true"></span>Companion <strong data-writing-workspace-word aria-live="polite">Checking…</strong><a href="#display-setup">Connection &amp; Display Setup</a></div>
</header>
@if(TempData["WriterWorkspaceMessage"] is string message){<p class="alert alert-info" role="status">@message</p>}
@if(TempData["WriterWorkspaceError"] is string error){<p class="alert alert-warning" role="alert">@error</p>}
@if(!Model.Journey)
{
<partial name="_HelpMe" model="Model" />
<div id="working-focus"></div>
<section class="writer-next-grid @(showOpportunity ? "" : "writer-next-single")" aria-label="Current work and next opportunity">
<partial name="_WorkingObjective" model="Model" />
@if(showOpportunity){
<article class="writer-card"><p class="eyebrow">Next Planned Session</p>
@if(Model.PlannedActivities.FirstOrDefault() is {} reviewed){<h2>@reviewed.ScheduledDate.ToString("ddd d MMM")</h2><p>@reviewed.Kind · @reviewed.Minutes planned minutes</p>@if(reviewed.SceneID.HasValue){<a asp-controller="Scenes" asp-action="Edit" asp-route-id="@reviewed.SceneID">@reviewed.Title</a>}else{<a asp-action="Chapter" asp-route-id="@reviewed.ChapterID">@reviewed.Title</a>}}
else if(opportunity!=null){<h2>@opportunity.ScheduledDate.ToString("ddd d MMM")</h2><p>@opportunity.TaskType · @opportunity.EstimatedMinutes estimated minutes</p><a asp-controller="Scenes" asp-action="Edit" asp-route-id="@opportunity.SceneID">@opportunity.SceneTitle</a><p class="muted">Planned capacity, not measured writing time.</p>}
else{<h2>Plan your writing time</h2><p>No upcoming writing task is scheduled for this book.</p><a class="btn btn-outline-primary" asp-action="ScheduleSetup" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId">Create a writing plan</a>}
<a class="writer-text-link" asp-action="WritingPlans" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId">Manage writing plans</a>
</article>
}
</section>
@if(!Model.ActivityIsPrivate)
{
<section class="writer-card writer-progress" aria-label="Writing Progress">
<div><p class="eyebrow">Writing Progress · last 30 days</p><h2>Your Manuscript</h2>
<p>@(manuscriptWords?.ToString("N0") ?? "—") @(latestAccepted != null ? "words at last accepted snapshot" : "catalogued words") · @(Model.Book?.ChapterCount ?? 0) @(Model.Book?.ChapterCount == 1 ? "chapter" : "chapters") · @(Model.Book?.SceneCount ?? 0) @(Model.Book?.SceneCount == 1 ? "scene" : "scenes")</p>@if(bookId.HasValue){<a asp-controller="Books" asp-action="Details" asp-route-id="@bookId" asp-fragment="chapters">Open Chapters</a>}</div>
@if(totals != null && (totals.Added > 0 || totals.Removed > 0))
{
<div class="writer-activity-graphic"><div class="writer-change-track"><span class="writer-change-added" style="flex:@totals.Added"></span><span class="writer-change-removed" style="flex:@totals.Removed"></span></div><p><strong>+@totals.Added.ToString("N0")</strong> added · <strong>−@totals.Removed.ToString("N0")</strong> removed · <strong>@totals.Net.ToString("+0;-0;0")</strong> net</p></div>
}
else{<p class="writer-empty">@(totals?.HasAcceptedEvidence == true ? "Tracking begins at your manuscript baseline. New accepted changes will appear here." : "Manuscript change tracking begins with an accepted baseline. Earlier writing cannot be reconstructed.")</p>}
@if(queues.Any(q=>q.Item3.Count>0)){
<div class="writer-workflow-progress" aria-label="Scenes in writing workspace queues">@foreach(var q in queues.Where(x=>x.Item3.Count>0)){<span class="writer-stage-@q.Item1" style="flex:@q.Item3.Count" title="@q.Item2: @q.Item3.Count scenes"></span>}</div>
<div class="writer-workflow-strip" aria-label="Scene workflow stages">@foreach(var q in queues){<a asp-action="Workspaces" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId" asp-route-workspace="@q.Item1"><strong>@q.Item3.Count</strong> @q.Item2</a>}</div>
}
@if(bookId.HasValue){<a asp-controller="WritingActivity" asp-action="Index" asp-route-bookId="@bookId">Reports &amp; activity settings</a>}
</section>
}
}
@if(Model.Journey){<partial name="_JourneyCalendar" model="Model" />}
else{
<section class="writer-card writer-journey @(Model.Journey ? "" : "writer-journey-compact")" aria-labelledby="writer-journey-title">
<div class="writer-section-heading"><div><p class="eyebrow">@(Model.Journey ? "Writing calendar · last 28 days" : "Activity summary · last 28 days")</p><h2 id="writer-journey-title">Recent Activity</h2></div><a asp-action="Journey" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId">Writing Journey</a></div>
@if((totals==null||totals.RecordedEvents==0)&&!(Model.Work?.Days.Any(d=>d.Day>=DateTime.UtcNow.Date.AddDays(-27)&&d.Intensity>0)??false))
{
<p class="writer-empty">@(!Model.Journey?"No new accepted changes yet.":Model.Activity?.Totals.HasAcceptedEvidence==true?"No accepted change is recorded in this period. Retained baseline evidence is available in activity settings.":"Your accepted manuscript can become the starting point. Earlier writing will not be counted as new activity.")</p>
@if(Model.Journey&&bookId.HasValue&&!Model.ActivityIsPrivate){<a class="btn btn-outline-primary" asp-controller="WritingActivity" asp-action="Index" asp-route-bookId="@bookId">Activity &amp; baseline settings</a>}
}
else
{
<div class="writer-calendar" aria-label="Daily observed changes; receipt dates in UTC">
@for(var i=27;i>=0;i--){var date=DateTime.UtcNow.Date.AddDays(-i);var day=days.FirstOrDefault(x=>x.Day.Date==date);var rhythm=Model.Work?.Days.FirstOrDefault(x=>x.Day.Date==date);var observed=day!=null||rhythm?.Intensity>0;<a class="writer-day @(!observed?"writer-day-unobserved":"writer-day-observed")" asp-controller="Writer" asp-action="Journey" asp-route-bookId="@bookId" asp-route-year="@date.Year" asp-route-month="@date.Month" asp-route-day="@date.ToString("yyyy-MM-dd")" aria-label="@date.ToString("d MMM yyyy"): @(!observed?"no retained activity":rhythm!=null?$"{rhythm.Changes} accepted changes, {rhythm.Planning} planning, {rhythm.Reading} reading and {rhythm.PlaybackSeconds:0} observed audio seconds":$"{day!.Changes} changes, {day.Added} added, {day.Removed} removed")">@if(Model.Journey){<span>@date.ToString("ddd")</span><strong>@date.Day</strong><small>@(day==null?"—":$"+{day.Added} / −{day.Removed}")</small>}</a>}
</div>
}
@if(Model.ActivityIsPrivate){<p class="muted">Activity evidence is private to the book owner. Your existing writing workspaces remain available.</p>}
@if(Model.Journey&&Model.Activity?.Events.Count>0)
{
<details class="mt-3"><summary>Recent activity · source evidence</summary><ul class="writer-recent">@foreach(var e in Model.Activity.Events.Take(5)){<li><a asp-controller="WritingActivity" asp-action="Index" asp-route-bookId="@bookId" asp-route-day="@e.ReceivedUtc.ToString("yyyy-MM-dd")">@e.ReceivedUtc.ToString("d MMM HH:mm") UTC · @e.Kind</a><span>@e.Source · @(e.Kind=="Change"?$"+{e.Added} / −{e.Removed}":e.Coverage)</span></li>}</ul></details>
}
@if(Model.Journey&&Model.WritingSchedule.UpcomingTasks.Count>0){<h3 class="mt-3">Planned work ahead</h3><ul>@foreach(var item in Model.WritingSchedule.UpcomingTasks){<li>@item.ScheduledDate.ToString("ddd d MMM") · <a asp-controller="Scenes" asp-action="Edit" asp-route-id="@item.SceneID">@item.SceneTitle</a> · @item.TaskType</li>}</ul>}
</section>
}
@if(bookId.HasValue&&!Model.ActivityIsPrivate){<partial name="_WriterWorkToolbar" model="new PlotLine.Models.WriterWorkToolbar(bookId.Value, Model.Objective?.ChapterID, Model.Objective?.ChapterTitle, Model.ObjectiveChoices, toolbarKind)" />}
<section class="writer-card writer-workspaces" id="workspaces" aria-labelledby="writer-workspace-title">
<div class="writer-section-heading"><div><p class="eyebrow">Workspaces</p><h2 id="writer-workspace-title">Choose your next step <help-icon key="workspace.workingContext" /></h2></div>@if(bookId.HasValue){<a asp-controller="Books" asp-action="Details" asp-route-id="@bookId" asp-fragment="chapters">Browse chapters</a>}</div>
<details class="writer-queue-details" open="@showWorkspace"><summary>Chapter and scene workspaces</summary>
<nav class="writer-tabs" aria-label="Writing workspaces">@foreach(var q in queues){<a asp-action="Workspaces" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId" asp-route-workspace="@q.Item1" aria-current="@(Model.Workspace==q.Item1?"page":null)">@q.Item2 <span>@q.Item3.Count</span></a>}<a asp-action="Workspaces" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId" asp-route-workspace="StoryHealth" aria-current="@(Model.Workspace=="StoryHealth"?"page":null)">Story Health <span>@Model.StoryHealthReminders.Count</span></a></nav>
@foreach(var q in queues){<div data-writer-queue="@q.Item1" hidden="@(Model.Workspace!=q.Item1)"><partial name="_WriterSceneQueue" model="q.Item3" /></div>}
<div hidden="@(Model.Workspace!="StoryHealth")">@if(Model.StoryHealthReminders.Count==0){<p class="muted">No current book reminders are listed. You can also review project story health.</p>}@foreach(var reminder in Model.StoryHealthReminders){<article class="writer-reminder"><span class="status-pill">@reminder.Category</span>@if(reminder.SceneID.HasValue){<a asp-controller="Scenes" asp-action="Edit" asp-route-id="@reminder.SceneID">@reminder.Title</a>}else if(reminder.EntityType=="Chapter"){<a asp-action="Chapter" asp-route-id="@reminder.EntityID">@reminder.Title</a>}else{<strong>@reminder.Title</strong>}<p>@reminder.Detail</p></article>}<a asp-controller="Analytics" asp-action="Index" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId">Project story health</a></div>
</details>
</section>
@if(Model.WritingSchedule.TodayTasks.Count>0){<details class="writer-card"><summary>Today's planned writing · @Model.WritingSchedule.TodayTasks.Count tasks</summary>@foreach(var task in Model.WritingSchedule.TodayTasks){<article class="writer-planned-task"><a asp-controller="Scenes" asp-action="Edit" asp-route-id="@task.SceneID">@task.SceneTitle</a><span>@task.TaskType · @task.EstimatedMinutes estimated minutes</span><form asp-action="MarkScheduleItemComplete" method="post"><input type="hidden" name="writingScheduleItemId" value="@task.WritingScheduleItemID" /><input type="hidden" name="projectId" value="@Model.ProjectID" /><input type="hidden" name="bookId" value="@bookId" /><button class="btn btn-sm btn-outline-primary">Mark complete</button></form><form asp-action="SkipScheduleItem" method="post"><input type="hidden" name="writingScheduleItemId" value="@task.WritingScheduleItemID" /><input type="hidden" name="projectId" value="@Model.ProjectID" /><input type="hidden" name="bookId" value="@bookId" /><button class="btn btn-sm btn-outline-secondary">Skip</button></form></article>}<p class="muted">Task completion is author-declared, not measured writing time.</p></details>}
<details class="writer-card writer-display-setup" id="display-setup"><summary>Word Companion &amp; Display Setup</summary>
<p class="muted">Open Context and Intent as reference windows. Linked Word controls appear when a document is connected. Display placement depends on browser permission and popup support; moving Word itself is controlled by Windows.</p>
<div class="writing-workspace-status-grid"><div>Selected book <strong data-writing-workspace-book>Waiting for Word</strong></div><div>Context <strong data-writing-workspace-context>Checking…</strong></div><div>Intent <strong data-writing-workspace-intent>Checking…</strong></div><div>Layout <strong data-writing-workspace-layout>Adaptive</strong></div></div>
<p class="muted" data-writing-workspace-message aria-live="polite">Choose reference windows or detect displays.</p>
<div class="writing-workspace-display-controls" data-writing-workspace-display-controls><label>Context display<select class="form-select" data-writing-context-display><option value="left">Left display</option><option value="primary">Primary display</option><option value="right">Right display</option></select></label><label>Intent display<select class="form-select" data-writing-intent-display><option value="right">Right display</option><option value="primary">Primary display</option><option value="left">Left display</option></select></label><button class="btn btn-outline-primary" data-detect-writing-displays type="button">Detect displays</button></div>
<div class="button-row"><button class="btn btn-primary" data-start-writing-workspace type="button" hidden>Start / Reapply Workspace</button><button class="btn btn-outline-primary" data-open-writing-context type="button">Open Context</button><button class="btn btn-outline-primary" data-open-writing-intent type="button">Open Intent</button><button class="btn btn-outline-secondary" data-focus-writing-context type="button" hidden>Focus Context</button><button class="btn btn-outline-secondary" data-focus-writing-intent type="button" hidden>Focus Intent</button></div>
</details>
<link rel="stylesheet" href="~/css/writer3.css" asp-append-version="true" />
<div class="writer3 writer3-home" data-writer-destination="Home" data-writer-legacy-url="@Url.Action("Overview",new{projectId=Model.ProjectID,bookId=Model.BookID})" data-writer-write-url="@Url.Action("Write",new{projectId=Model.ProjectID,bookId=Model.BookID})" data-writing-workspace-launcher data-compact-writer="true" data-project-id="@Model.ProjectID" data-book-id="@Model.BookID">
<partial name="_Writer3Header" model="Model" />
@if(!Model.BookID.HasValue){<p class="writer3-scope-notice">Select a project and book in the application bar, or <a asp-controller="Projects" asp-action="Index">open your projects</a> to begin. You can explore writing problems before you have a manuscript.</p>}
<section class="writer3-home-choices" aria-label="Choose where to begin">
<a class="writer3-choice" asp-action="Write" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">
<svg class="writer3-choice-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="@ApplicationRibbon.Icon("writer").IconPath" /></svg>
<h2>Continue Writing</h2><p>Work on your chapters, scenes<br class="writer3-desktop-break" /> and manuscript.</p>
<small>@(focus != null ? $"{Model.Objective!.Activity} · {focus}" : Model.Objective != null ? $"{Model.Objective.Activity} · Whole manuscript" : "Choose your first writing focus.")</small>
<span class="writer3-cta">Go to Write <span aria-hidden="true">→</span></span>
</a>
<a class="writer3-choice" asp-action="Explore" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">
<svg class="writer3-choice-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="@ApplicationRibbon.Icon("point").IconPath" /></svg>
<h2>Explore Your Story</h2><p>Develop ideas, solve problems<br class="writer3-desktop-break" /> and discover what happens next.</p><small>No completed plan or linked Word document needed.</small>
<span class="writer3-cta">Go to Explore <span aria-hidden="true">→</span></span>
</a>
<a class="writer3-choice" asp-action="Dashboard" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">
<svg class="writer3-choice-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="@ApplicationRibbon.Icon("metrics").IconPath" /></svg>
<h2>Writing Dashboard</h2><p>See plans, progress, activity<br class="writer3-desktop-break" /> and your writing journey.</p><small>Your recorded work and the work ahead.</small>
<span class="writer3-cta">Open Dashboard <span aria-hidden="true">→</span></span>
</a>
</section>
</div>
@section Scripts {
<script src="~/js/writer3-navigation.js" asp-append-version="true"></script>
<script src="~/js/writing-workspace.js" asp-append-version="true"></script>
<script src="~/js/writing-workspace-launcher.js" asp-append-version="true"></script>
<script src="~/js/writer-work.js" asp-append-version="true"></script>
<script src="~/js/writer-objective.js" asp-append-version="true"></script>
<script>(()=>{const open=()=>{if(location.hash==='#display-setup')document.getElementById('display-setup').open=true;};window.addEventListener('hashchange',open);open();})();</script>
}

View File

@ -0,0 +1,111 @@
@model WriterDashboardViewModel
@{
ViewData["Title"] = Model.Journey ? "Writing Journey" : "Writer";
ViewData["ShellClass"] = "pd-writer";
ViewData["ProjectSection"] = "Writer";
var toolbarKind = Model.Objective?.Activity is "Revising" or "Editing" or "Proofreading" ? "Editing" : Model.Objective?.Activity == "Researching" ? "Planning" : "Writing";
var seed=Model.WriteNext.Concat(Model.ContinueWriting).Concat(Model.RevisionQueue).Concat(Model.PolishingQueue).FirstOrDefault();
var bookId=Model.BookID??seed?.BookID;
var bookTitle=Model.Book?.BookDisplayTitle??seed?.BookDisplayTitle??"Choose a book";
if(string.IsNullOrWhiteSpace(bookTitle)) bookTitle = Model.BookID.HasValue ? "Untitled book" : "Choose a book";
var opportunity=Model.WritingSchedule.TodayTasks.FirstOrDefault()??Model.WritingSchedule.UpcomingTasks.FirstOrDefault();
var showOpportunity = Model.Objective != null || opportunity != null || Model.PlannedActivities.Count > 0;
var totals=Model.Activity?.Totals.HasAcceptedEvidence==true?Model.Activity.Totals:null;
var showWorkspace = Context.Request.RouteValues["action"]?.ToString() == "Workspaces";
var queues=new[]{("WriteNext","Write Next",Model.WriteNext),("InProgress","In Progress",Model.ContinueWriting),("Revision","Revision",Model.RevisionQueue),("FinalPass","Final Pass",Model.PolishingQueue)};
var latestAccepted = Model.Activity?.Events.FirstOrDefault(e => e.Kind != "Observation");
var manuscriptWords = latestAccepted?.WordsAfter ?? Model.Book?.CurrentWordCount;
var days=Model.Activity?.Days??Array.Empty<PlotLine.Models.WritingActivityDay>();
var maximum=Math.Max(1L,days.Select(x=>x.Added+x.Removed).DefaultIfEmpty(1).Max());
}
<link rel="stylesheet" href="~/css/writer-work.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/writer-dashboard.css" asp-append-version="true" />
<div class="writer-studio" data-writing-workspace-launcher data-compact-writer="true" data-project-id="@Model.ProjectID" data-book-id="@bookId">
<header class="writer-heading" data-pwa-task>
@if(!string.IsNullOrWhiteSpace(Model.Book?.CoverThumbnailPath)){<img class="writer-book-cover" src="@Url.Content(Model.Book.CoverThumbnailPath)" alt="Cover of @bookTitle" />}else{<div class="writer-book-cover writer-cover-fallback" aria-hidden="true">@(bookTitle[..1])</div>}
<div><p class="eyebrow">@(Model.Journey?"Writing Journey":"Your writing desk")</p><h1>@bookTitle</h1><help-icon key="workspace.overview" /><p class="muted">@(Model.Journey?"Accepted activity and the work ahead.":"Continue your manuscript, review your work, or choose what comes next.")</p></div>
<div class="writer-connection"><span class="writer-status-dot" aria-hidden="true"></span>Companion <strong data-writing-workspace-word aria-live="polite">Checking…</strong><a href="#display-setup">Connection &amp; Display Setup</a></div>
</header>
@if(TempData["WriterWorkspaceMessage"] is string message){<p class="alert alert-info" role="status">@message</p>}
@if(TempData["WriterWorkspaceError"] is string error){<p class="alert alert-warning" role="alert">@error</p>}
@if(!Model.Journey)
{
<partial name="_HelpMe" model="Model" />
<div id="working-focus"></div>
<section class="writer-next-grid @(showOpportunity ? "" : "writer-next-single")" aria-label="Current work and next opportunity">
<partial name="_WorkingObjective" model="Model" />
@if(showOpportunity){
<article class="writer-card"><p class="eyebrow">Next Planned Session</p>
@if(Model.PlannedActivities.FirstOrDefault() is {} reviewed){<h2>@reviewed.ScheduledDate.ToString("ddd d MMM")</h2><p>@reviewed.Kind · @reviewed.Minutes planned minutes</p>@if(reviewed.SceneID.HasValue){<a asp-controller="Scenes" asp-action="Edit" asp-route-id="@reviewed.SceneID">@reviewed.Title</a>}else{<a asp-action="Chapter" asp-route-id="@reviewed.ChapterID">@reviewed.Title</a>}}
else if(opportunity!=null){<h2>@opportunity.ScheduledDate.ToString("ddd d MMM")</h2><p>@opportunity.TaskType · @opportunity.EstimatedMinutes estimated minutes</p><a asp-controller="Scenes" asp-action="Edit" asp-route-id="@opportunity.SceneID">@opportunity.SceneTitle</a><p class="muted">Planned capacity, not measured writing time.</p>}
else{<h2>Plan your writing time</h2><p>No upcoming writing task is scheduled for this book.</p><a class="btn btn-outline-primary" asp-action="ScheduleSetup" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId">Create a writing plan</a>}
<a class="writer-text-link" asp-action="WritingPlans" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId">Manage writing plans</a>
</article>
}
</section>
@if(!Model.ActivityIsPrivate)
{
<section class="writer-card writer-progress" aria-label="Writing Progress">
<div><p class="eyebrow">Writing Progress · last 30 days</p><h2>Your Manuscript</h2>
<p>@(manuscriptWords?.ToString("N0") ?? "—") @(latestAccepted != null ? "words at last accepted snapshot" : "catalogued words") · @(Model.Book?.ChapterCount ?? 0) @(Model.Book?.ChapterCount == 1 ? "chapter" : "chapters") · @(Model.Book?.SceneCount ?? 0) @(Model.Book?.SceneCount == 1 ? "scene" : "scenes")</p>@if(bookId.HasValue){<a asp-controller="Books" asp-action="Details" asp-route-id="@bookId" asp-fragment="chapters">Open Chapters</a>}</div>
@if(totals != null && (totals.Added > 0 || totals.Removed > 0))
{
<div class="writer-activity-graphic"><div class="writer-change-track"><span class="writer-change-added" style="flex:@totals.Added"></span><span class="writer-change-removed" style="flex:@totals.Removed"></span></div><p><strong>+@totals.Added.ToString("N0")</strong> added · <strong>−@totals.Removed.ToString("N0")</strong> removed · <strong>@totals.Net.ToString("+0;-0;0")</strong> net</p></div>
}
else{<p class="writer-empty">@(totals?.HasAcceptedEvidence == true ? "Tracking begins at your manuscript baseline. New accepted changes will appear here." : "Manuscript change tracking begins with an accepted baseline. Earlier writing cannot be reconstructed.")</p>}
@if(queues.Any(q=>q.Item3.Count>0)){
<div class="writer-workflow-progress" aria-label="Scenes in writing workspace queues">@foreach(var q in queues.Where(x=>x.Item3.Count>0)){<span class="writer-stage-@q.Item1" style="flex:@q.Item3.Count" title="@q.Item2: @q.Item3.Count scenes"></span>}</div>
<div class="writer-workflow-strip" aria-label="Scene workflow stages">@foreach(var q in queues){<a asp-action="Workspaces" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId" asp-route-workspace="@q.Item1"><strong>@q.Item3.Count</strong> @q.Item2</a>}</div>
}
@if(bookId.HasValue){<a asp-controller="WritingActivity" asp-action="Index" asp-route-bookId="@bookId">Reports &amp; activity settings</a>}
</section>
}
}
@if(Model.Journey){<partial name="_JourneyCalendar" model="Model" />}
else{
<section class="writer-card writer-journey @(Model.Journey ? "" : "writer-journey-compact")" aria-labelledby="writer-journey-title">
<div class="writer-section-heading"><div><p class="eyebrow">@(Model.Journey ? "Writing calendar · last 28 days" : "Activity summary · last 28 days")</p><h2 id="writer-journey-title">Recent Activity</h2></div><a asp-action="Journey" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId">Writing Journey</a></div>
@if((totals==null||totals.RecordedEvents==0)&&!(Model.Work?.Days.Any(d=>d.Day>=DateTime.UtcNow.Date.AddDays(-27)&&d.Intensity>0)??false))
{
<p class="writer-empty">@(!Model.Journey?"No new accepted changes yet.":Model.Activity?.Totals.HasAcceptedEvidence==true?"No accepted change is recorded in this period. Retained baseline evidence is available in activity settings.":"Your accepted manuscript can become the starting point. Earlier writing will not be counted as new activity.")</p>
@if(Model.Journey&&bookId.HasValue&&!Model.ActivityIsPrivate){<a class="btn btn-outline-primary" asp-controller="WritingActivity" asp-action="Index" asp-route-bookId="@bookId">Activity &amp; baseline settings</a>}
}
else
{
<div class="writer-calendar" aria-label="Daily observed changes; receipt dates in UTC">
@for(var i=27;i>=0;i--){var date=DateTime.UtcNow.Date.AddDays(-i);var day=days.FirstOrDefault(x=>x.Day.Date==date);var rhythm=Model.Work?.Days.FirstOrDefault(x=>x.Day.Date==date);var observed=day!=null||rhythm?.Intensity>0;<a class="writer-day @(!observed?"writer-day-unobserved":"writer-day-observed")" asp-controller="Writer" asp-action="Journey" asp-route-bookId="@bookId" asp-route-year="@date.Year" asp-route-month="@date.Month" asp-route-day="@date.ToString("yyyy-MM-dd")" aria-label="@date.ToString("d MMM yyyy"): @(!observed?"no retained activity":rhythm!=null?$"{rhythm.Changes} accepted changes, {rhythm.Planning} planning, {rhythm.Reading} reading and {rhythm.PlaybackSeconds:0} observed audio seconds":$"{day!.Changes} changes, {day.Added} added, {day.Removed} removed")">@if(Model.Journey){<span>@date.ToString("ddd")</span><strong>@date.Day</strong><small>@(day==null?"—":$"+{day.Added} / −{day.Removed}")</small>}</a>}
</div>
}
@if(Model.ActivityIsPrivate){<p class="muted">Activity evidence is private to the book owner. Your existing writing workspaces remain available.</p>}
@if(Model.Journey&&Model.Activity?.Events.Count>0)
{
<details class="mt-3"><summary>Recent activity · source evidence</summary><ul class="writer-recent">@foreach(var e in Model.Activity.Events.Take(5)){<li><a asp-controller="WritingActivity" asp-action="Index" asp-route-bookId="@bookId" asp-route-day="@e.ReceivedUtc.ToString("yyyy-MM-dd")">@e.ReceivedUtc.ToString("d MMM HH:mm") UTC · @e.Kind</a><span>@e.Source · @(e.Kind=="Change"?$"+{e.Added} / −{e.Removed}":e.Coverage)</span></li>}</ul></details>
}
@if(Model.Journey&&Model.WritingSchedule.UpcomingTasks.Count>0){<h3 class="mt-3">Planned work ahead</h3><ul>@foreach(var item in Model.WritingSchedule.UpcomingTasks){<li>@item.ScheduledDate.ToString("ddd d MMM") · <a asp-controller="Scenes" asp-action="Edit" asp-route-id="@item.SceneID">@item.SceneTitle</a> · @item.TaskType</li>}</ul>}
</section>
}
@if(bookId.HasValue&&!Model.ActivityIsPrivate){<partial name="_WriterWorkToolbar" model="new PlotLine.Models.WriterWorkToolbar(bookId.Value, Model.Objective?.ChapterID, Model.Objective?.ChapterTitle, Model.ObjectiveChoices, toolbarKind)" />}
<section class="writer-card writer-workspaces" id="workspaces" aria-labelledby="writer-workspace-title">
<div class="writer-section-heading"><div><p class="eyebrow">Workspaces</p><h2 id="writer-workspace-title">Choose your next step <help-icon key="workspace.workingContext" /></h2></div>@if(bookId.HasValue){<a asp-controller="Books" asp-action="Details" asp-route-id="@bookId" asp-fragment="chapters">Browse chapters</a>}</div>
<details class="writer-queue-details" open="@showWorkspace"><summary>Chapter and scene workspaces</summary>
<nav class="writer-tabs" aria-label="Writing workspaces">@foreach(var q in queues){<a asp-action="Workspaces" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId" asp-route-workspace="@q.Item1" aria-current="@(Model.Workspace==q.Item1?"page":null)">@q.Item2 <span>@q.Item3.Count</span></a>}<a asp-action="Workspaces" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId" asp-route-workspace="StoryHealth" aria-current="@(Model.Workspace=="StoryHealth"?"page":null)">Story Health <span>@Model.StoryHealthReminders.Count</span></a></nav>
@foreach(var q in queues){<div data-writer-queue="@q.Item1" hidden="@(Model.Workspace!=q.Item1)"><partial name="_WriterSceneQueue" model="q.Item3" /></div>}
<div hidden="@(Model.Workspace!="StoryHealth")">@if(Model.StoryHealthReminders.Count==0){<p class="muted">No current book reminders are listed. You can also review project story health.</p>}@foreach(var reminder in Model.StoryHealthReminders){<article class="writer-reminder"><span class="status-pill">@reminder.Category</span>@if(reminder.SceneID.HasValue){<a asp-controller="Scenes" asp-action="Edit" asp-route-id="@reminder.SceneID">@reminder.Title</a>}else if(reminder.EntityType=="Chapter"){<a asp-action="Chapter" asp-route-id="@reminder.EntityID">@reminder.Title</a>}else{<strong>@reminder.Title</strong>}<p>@reminder.Detail</p></article>}<a asp-controller="Analytics" asp-action="Index" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId">Project story health</a></div>
</details>
</section>
@if(Model.WritingSchedule.TodayTasks.Count>0){<details class="writer-card"><summary>Today's planned writing · @Model.WritingSchedule.TodayTasks.Count tasks</summary>@foreach(var task in Model.WritingSchedule.TodayTasks){<article class="writer-planned-task"><a asp-controller="Scenes" asp-action="Edit" asp-route-id="@task.SceneID">@task.SceneTitle</a><span>@task.TaskType · @task.EstimatedMinutes estimated minutes</span><form asp-action="MarkScheduleItemComplete" method="post"><input type="hidden" name="writingScheduleItemId" value="@task.WritingScheduleItemID" /><input type="hidden" name="projectId" value="@Model.ProjectID" /><input type="hidden" name="bookId" value="@bookId" /><button class="btn btn-sm btn-outline-primary">Mark complete</button></form><form asp-action="SkipScheduleItem" method="post"><input type="hidden" name="writingScheduleItemId" value="@task.WritingScheduleItemID" /><input type="hidden" name="projectId" value="@Model.ProjectID" /><input type="hidden" name="bookId" value="@bookId" /><button class="btn btn-sm btn-outline-secondary">Skip</button></form></article>}<p class="muted">Task completion is author-declared, not measured writing time.</p></details>}
<details class="writer-card writer-display-setup" id="display-setup"><summary>Word Companion &amp; Display Setup</summary>
<p class="muted">Open Context and Intent as reference windows. Linked Word controls appear when a document is connected. Display placement depends on browser permission and popup support; moving Word itself is controlled by Windows.</p>
<div class="writing-workspace-status-grid"><div>Selected book <strong data-writing-workspace-book>Waiting for Word</strong></div><div>Context <strong data-writing-workspace-context>Checking…</strong></div><div>Intent <strong data-writing-workspace-intent>Checking…</strong></div><div>Layout <strong data-writing-workspace-layout>Adaptive</strong></div></div>
<p class="muted" data-writing-workspace-message aria-live="polite">Choose reference windows or detect displays.</p>
<div class="writing-workspace-display-controls" data-writing-workspace-display-controls><label>Context display<select class="form-select" data-writing-context-display><option value="left">Left display</option><option value="primary">Primary display</option><option value="right">Right display</option></select></label><label>Intent display<select class="form-select" data-writing-intent-display><option value="right">Right display</option><option value="primary">Primary display</option><option value="left">Left display</option></select></label><button class="btn btn-outline-primary" data-detect-writing-displays type="button">Detect displays</button></div>
<div class="button-row"><button class="btn btn-primary" data-start-writing-workspace type="button" hidden>Start / Reapply Workspace</button><button class="btn btn-outline-primary" data-open-writing-context type="button">Open Context</button><button class="btn btn-outline-primary" data-open-writing-intent type="button">Open Intent</button><button class="btn btn-outline-secondary" data-focus-writing-context type="button" hidden>Focus Context</button><button class="btn btn-outline-secondary" data-focus-writing-intent type="button" hidden>Focus Intent</button></div>
</details>
</div>
@section Scripts {
<script src="~/js/writing-workspace.js" asp-append-version="true"></script>
<script src="~/js/writing-workspace-launcher.js" asp-append-version="true"></script>
<script src="~/js/writer-work.js" asp-append-version="true"></script>
<script src="~/js/writer-objective.js" asp-append-version="true"></script>
<script>(()=>{const open=()=>{if(location.hash==='#display-setup')document.getElementById('display-setup').open=true;};window.addEventListener('hashchange',open);open();})();</script>
}

View File

@ -10,7 +10,7 @@
<a class="btn btn-outline-primary" asp-controller="@suggestion.Controller" asp-action="@suggestion.RouteAction" asp-route-id="@suggestion.EntityID" asp-route-chapterId="@suggestion.ChapterID" asp-route-bookId="@Model.BookID" asp-route-projectId="@Model.ProjectID">@suggestion.Action</a>
</article>}</div>
@if(Model.Suggestions.Count==0){<p>Select a book to get suggestions based on its chapters and plans.</p>}
<a asp-action="Index" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID" asp-fragment="working-focus">Return to Writing</a>
<a asp-action="Write" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID" asp-fragment="working-focus">Return to Writing</a>
<p class="muted">For a break, end your session below and leave a return note. No time away is counted as engaged work.</p>
</div>
</section>

View File

@ -0,0 +1,9 @@
@model WriterDashboardViewModel
@{ var objective = Model.Objective; }
<form asp-action="SaveObjective" method="post" class="writer-objective-form">
<input type="hidden" name="BookID" value="@Model.BookID" />
<label>Working activity<select class="form-select" name="Activity">@foreach(var activity in new[]{"Drafting","Revising","Editing","Researching","Proofreading"}){<option selected="@(objective?.Activity==activity)" value="@activity">@activity</option>}</select></label>
<label>Begin with<select class="form-select" name="ChapterID" data-objective-chapter><option value="">Whole manuscript</option>@foreach(var chapter in Model.ObjectiveChoices.DistinctBy(x=>x.ChapterID)){<option value="@chapter.ChapterID" selected="@(objective?.ChapterID==chapter.ChapterID)">@chapter.ChapterTitle</option>}</select></label>
<label>Scene (optional)<select class="form-select" name="SceneID" data-objective-scene><option value="">Chapter workspace</option>@foreach(var scene in Model.ObjectiveChoices.Where(x=>x.SceneID.HasValue)){<option value="@scene.SceneID" data-chapter="@scene.ChapterID" selected="@(objective?.SceneID==scene.SceneID)">@scene.SceneTitle</option>}</select></label>
<div class="button-row"><button class="btn btn-primary" name="scheduleNow" value="false">Save objective · start without a schedule</button><button class="btn btn-outline-secondary" name="scheduleNow" value="true">Save &amp; plan writing time</button></div>
</form>

View File

@ -8,7 +8,7 @@
@if(objective.SceneID.HasValue){<a class="btn btn-primary" asp-controller="Scenes" asp-action="Edit" asp-route-id="@objective.SceneID">Continue Writing</a>}
else if(objective.ChapterID.HasValue){<a class="btn btn-primary" asp-action="Chapter" asp-route-id="@objective.ChapterID">Continue Writing</a>}
else{<a class="btn btn-primary" asp-controller="Books" asp-action="Details" asp-route-id="@Model.BookID" asp-fragment="chapters">Continue Writing</a>}
<a class="writer-text-link" asp-action="Index" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID" asp-route-setup="true" asp-fragment="working-objective">Change objective</a>
<a class="writer-text-link" asp-action="Write" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID" asp-route-setup="true" asp-fragment="working-objective">Change objective</a>
</article>
}
else if(Model.BookID.HasValue)
@ -23,17 +23,11 @@ else if(Model.BookID.HasValue)
</div>
<details id="objective-setup" open="@editing">
<summary>Choose your working objective</summary>
<form asp-action="SaveObjective" method="post" class="writer-objective-form">
<input type="hidden" name="BookID" value="@Model.BookID" />
<label>Working activity<select class="form-select" name="Activity">@foreach(var activity in new[]{"Drafting","Revising","Editing","Researching","Proofreading"}){<option selected="@(objective?.Activity==activity)" value="@activity">@activity</option>}</select></label>
<label>Begin with<select class="form-select" name="ChapterID" data-objective-chapter><option value="">Whole manuscript</option>@foreach(var chapter in Model.ObjectiveChoices.DistinctBy(x=>x.ChapterID)){<option value="@chapter.ChapterID" selected="@(objective?.ChapterID==chapter.ChapterID)">@chapter.ChapterTitle</option>}</select></label>
<label>Scene (optional)<select class="form-select" name="SceneID" data-objective-scene><option value="">Chapter workspace</option>@foreach(var scene in Model.ObjectiveChoices.Where(x=>x.SceneID.HasValue)){<option value="@scene.SceneID" data-chapter="@scene.ChapterID" selected="@(objective?.SceneID==scene.SceneID)">@scene.SceneTitle</option>}</select></label>
<div class="button-row"><button class="btn btn-primary" name="scheduleNow" value="false">Save objective · start without a schedule</button><button class="btn btn-outline-secondary" name="scheduleNow" value="true">Save &amp; plan writing time</button></div>
</form>
<partial name="_ObjectiveForm" model="Model" />
</details>
</article>
}
else
{
<article class="writer-card"><h2>Start Here</h2><p>Select a project and book in the application bar to begin.</p><a class="btn btn-primary" asp-controller="Projects" asp-action="Index">Your projects</a></article>
<article class="writer-card"><h2>Start Here</h2><p>Select a project and book in the application bar to begin.</p><a class="btn btn-primary" asp-controller="Projects" asp-action="Write">Your projects</a></article>
}

View File

@ -0,0 +1,19 @@
@model WriterDashboardViewModel
@{
var home = Model.Destination == "Home";
var title = string.IsNullOrWhiteSpace(Model.Book?.BookDisplayTitle) ? "Choose a book" : Model.Book.BookDisplayTitle;
var heading = home ? title : Model.Destination == "Dashboard" ? "Writing Dashboard" : Model.Destination;
}
<header class="writer3-header" data-pwa-task>
@if(!string.IsNullOrWhiteSpace(Model.Book?.CoverThumbnailPath)){
<img class="writer3-cover" src="@Url.Content(Model.Book.CoverThumbnailPath)" alt="Cover of @title" />
}else{<div class="writer3-cover writer3-cover-empty" aria-hidden="true">@title[..1]</div>}
<div class="writer3-identity">
<p class="eyebrow">@(home ? "Writer Home" : title)</p>
<div class="writer3-title"><h1>@heading <help-icon key="@($"writer3.{Model.Destination.ToLowerInvariant()}")" /></h1></div>
<p class="muted">@WriterNavigation.Purpose(Model.Destination)</p>
</div>
<div class="writer3-connection"><span>Companion <strong data-writing-workspace-word aria-live="polite">Checking…</strong></span><a asp-action="DisplaySetup" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Connection &amp; Display Setup</a></div>
</header>
@if(TempData["WriterWorkspaceMessage"] is string message){<p class="alert alert-info" role="status">@message</p>}
@if(TempData["WriterWorkspaceError"] is string error){<p class="alert alert-warning" role="alert">@error</p>}

View File

@ -0,0 +1,5 @@
@model WriterDashboardViewModel
<div class="writer3-workspace" aria-label="Plans and progress overview">
<section class="writer3-panel writer3-main" tabindex="0"><p class="eyebrow">Progress · last 30 days</p><h2>Your manuscript</h2><partial name="_WriterProgress" model="Model" /><a class="btn btn-primary writer3-cta" asp-action="Reflect" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Explore recorded progress <span aria-hidden="true">→</span></a></section>
<aside class="writer3-panel writer3-reference" tabindex="0"><p class="eyebrow">Plan · work ahead</p><h2>Your next writing time</h2><partial name="_WriterUpcoming" model="Model" /><a class="btn btn-primary writer3-cta" asp-action="Plan" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Open Plan <span aria-hidden="true">→</span></a></aside>
</div>

View File

@ -0,0 +1,24 @@
@model WriterDashboardViewModel
<div class="writer3-workspace" aria-label="Story exploration">
<section class="writer3-panel writer3-main" tabindex="0">
<p class="eyebrow">Start with your question</p><h2>What would you like to explore?</h2><p>You do not need a finished outline or a linked manuscript. Choose a starting point.</p>
<div class="writer3-explore-paths">
<a asp-controller="WritingProblems" asp-action="Index"><span class="writer3-path-mark" aria-hidden="true">01</span><div><h3>Find a way forward</h3><p>Answer the Problem Solver’s questions about what is making your writing difficult.</p></div><span aria-hidden="true">→</span></a>
<a asp-controller="WritingProblems" asp-action="Browse"><span class="writer3-path-mark" aria-hidden="true">02</span><div><h3>Develop an idea or untangle a concern</h3><p>Browse practical guidance about characters, plot, pacing and structure.</p></div><span aria-hidden="true">→</span></a>
@if(Model.BookID.HasValue){<a asp-controller="Timeline" asp-action="Index" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID"><span class="writer3-path-mark" aria-hidden="true">03</span><div><h3>Look at your story’s shape</h3><p>Inspect your saved chapters, scenes and story timeline.</p></div><span aria-hidden="true">→</span></a>}
</div>
<p class="writer3-caption">The Problem Solver offers structured guidance. It does not automatically analyse your manuscript.</p>
</section>
<aside class="writer3-panel writer3-reference" tabindex="0" aria-label="Existing story references">
<h2>Your story references</h2>
@if(Model.ProjectID.HasValue){<div class="writer3-link-list">
<a asp-controller="Characters" asp-action="Index" asp-route-projectId="@Model.ProjectID">Characters <span aria-hidden="true">↗</span></a>
<a asp-controller="RelationshipMap" asp-action="Index" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Relationships <span aria-hidden="true">↗</span></a>
<a asp-controller="PlotLineWorkspace" asp-action="Index" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Plot Lines &amp; threads <span aria-hidden="true">↗</span></a>
<a asp-controller="Maps" asp-action="Index" asp-route-projectId="@Model.ProjectID">Maps <span aria-hidden="true">↗</span></a>
<a asp-controller="FloorPlans" asp-action="Index" asp-route-projectId="@Model.ProjectID">Floor Plans <span aria-hidden="true">↗</span></a>
<a asp-controller="ProjectMetrics" asp-action="Index" asp-route-projectId="@Model.ProjectID">Emotion &amp; scene metrics <span aria-hidden="true">↗</span></a>
</div><p class="writer3-caption">These open the existing Story, Characters and World workspaces. Project-wide tools may include other books in this project.</p>}
else{<p>Select a project in the application bar to inspect its characters, plot and world. The Problem Solver is available now.</p><a asp-controller="Projects" asp-action="Index">Open your projects</a>}
</aside>
</div>

View File

@ -0,0 +1,15 @@
@model WriterDashboardViewModel
<div class="writer3-workspace" aria-label="Writing plans">
<section class="writer3-panel writer3-main" tabindex="0">
<p class="eyebrow">Make room for your writing</p><h2>Plan your next writing time</h2><p>Use your existing chapters and scenes to choose activities and working budgets. Detailed scene estimates are optional.</p>
<a class="btn btn-primary writer3-cta" asp-action="ScheduleSetup" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Create a writing plan <span aria-hidden="true">→</span></a>
<div class="writer3-inset"><h3>Work ahead</h3><partial name="_WriterUpcoming" model="Model" /></div>
</section>
<aside class="writer3-panel writer3-reference" tabindex="0">
<h2>Your existing plans</h2><div class="writer3-link-list">
<a asp-action="WritingPlans" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Manage writing plans <span aria-hidden="true">↗</span></a>
<a asp-action="SchedulePreview" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Preview &amp; adjust a schedule <span aria-hidden="true">↗</span></a>
<a asp-action="Dashboard" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Writing Dashboard <span aria-hidden="true">↗</span></a>
</div><p class="writer3-caption">Reviewed chapter/scene activities and existing workflow tasks remain available. Completing a planned task is your declaration, separate from measured work and scene status.</p>
</aside>
</div>

View File

@ -0,0 +1,9 @@
@model WriterDashboardViewModel
@{var totals = Model.Activity?.Totals; var latest = Model.Activity?.Events.FirstOrDefault(x => x.Kind != "Observation");}
@if(Model.ActivityIsPrivate){<p class="muted">Activity evidence is private to the book owner. You can still use the chapter and scene workspaces.</p>}
else if(totals?.HasAcceptedEvidence == true){
<div class="writer3-stat-grid" aria-label="Recorded manuscript changes in the last 30 days">
<div><strong>+@totals.Added.ToString("N0")</strong><span>Words added</span></div><div><strong>−@totals.Removed.ToString("N0")</strong><span>Words removed</span></div><div><strong>@totals.Net.ToString("+0;-0;0")</strong><span>Net change</span></div>
</div><p class="writer3-caption">Accepted changes · last 30 days. Recorded activity is not a judgement of writing quality.</p>
}else{<div class="writer3-inset"><h3>Your history starts with recorded evidence</h3><p>No accepted manuscript changes are available yet. An accepted baseline starts tracking from the manuscript you have; earlier writing is not reconstructed.</p></div>}
<p class="writer3-caption">@(latest != null ? $"{latest.WordsAfter:N0} words at the last accepted snapshot" : $"{Model.Book?.CurrentWordCount ?? 0:N0} catalogued words") · @(Model.Book?.ChapterCount ?? 0) chapters · @(Model.Book?.SceneCount ?? 0) scenes</p>

View File

@ -0,0 +1,9 @@
@model WriterDashboardViewModel
<div class="writer3-workspace" aria-label="Writing reflection">
<section class="writer3-panel writer3-main" tabindex="0"><p class="eyebrow">Your recorded progress</p><h2>See what has changed</h2><partial name="_WriterProgress" model="Model" /><a class="btn btn-primary writer3-cta" asp-action="Journey" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Open Writing Journey <span aria-hidden="true">→</span></a></section>
<aside class="writer3-panel writer3-reference" tabindex="0"><h2>Your writing history</h2><div class="writer3-link-list">
<a asp-action="Journey" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Calendar, sessions &amp; return notes <span aria-hidden="true">↗</span></a>
@if(!Model.ActivityIsPrivate){<a asp-controller="WritingActivity" asp-action="Index" asp-route-bookId="@Model.BookID">Reports, privacy &amp; exports <span aria-hidden="true">↗</span></a>}
<a asp-action="Dashboard" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Writing Dashboard <span aria-hidden="true">↗</span></a>
</div><p class="writer3-caption">Writing Process and reflective insights are planned for a later update. No working style or writing quality is inferred here.</p></aside>
</div>

View File

@ -0,0 +1,18 @@
@model WriterDashboardViewModel
@{var chapter = Model.Objective?.ChapterID ?? Model.ObjectiveChoices.FirstOrDefault()?.ChapterID;}
<div class="writer3-workspace" aria-label="Manuscript review">
<section class="writer3-panel writer3-main" tabindex="0">
<p class="eyebrow">Read with a purpose</p><h2>Review your writing</h2><p>The Manuscript Reader shows accepted server text. Unsynchronised Word edits are not shown; save and synchronise the linked manuscript to update it.</p>
@if(chapter.HasValue){<div class="button-row"><a class="btn btn-primary writer3-cta" asp-controller="ManuscriptReader" asp-action="Index" asp-route-bookId="@Model.BookID" asp-route-chapterId="@chapter">Open Manuscript Reader <span aria-hidden="true">→</span></a><a asp-controller="ManuscriptReader" asp-action="Index" asp-route-bookId="@Model.BookID" asp-route-chapterId="@chapter" asp-route-focus="true">Focused reading</a></div>}
else{<div class="writer3-inset"><h3>No chapters to read yet</h3><p>Add a chapter or import your manuscript from the book’s existing tools.</p><a class="btn btn-primary writer3-cta" asp-controller="Books" asp-action="Details" asp-route-id="@Model.BookID" asp-fragment="chapters">Open your book <span aria-hidden="true">→</span></a></div>}
<div class="writer3-inset"><h3>Listen and review</h3><p>In the Reader, expand <strong>Reading &amp; Audio Review</strong> to start a review session. Playback controls require compatible Windows Companion and a supported player. Opening the Reader does not start playback.</p></div>
</section>
<aside class="writer3-panel writer3-reference" tabindex="0">
<h2>Intentions &amp; revision</h2><div class="writer3-link-list">
<button type="button" data-open-writing-intent>Open Intent &amp; saved evidence <span aria-hidden="true">↗</span></button>
<button type="button" data-open-writing-context>Open Context <span aria-hidden="true">↗</span></button>
<a asp-action="Workspaces" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID" asp-route-workspace="Revision">Scenes marked for revision <span aria-hidden="true">↗</span></a>
<a asp-action="Write" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Return to your writing focus <span aria-hidden="true">↗</span></a>
</div><p class="writer3-caption">Recorded intentions, AI evidence and author-confirmed completion remain separate. Assessments are explicit actions in Intent’s Evidence tab.</p><p data-writing-workspace-message role="status"></p>
</aside>
</div>

View File

@ -0,0 +1,4 @@
@model WriterDashboardViewModel
@if(Model.PlannedActivities.Count > 0){<ul class="writer3-upcoming">@foreach(var item in Model.PlannedActivities.Take(3)){<li><time>@item.ScheduledDate.ToString("ddd d MMM")</time><div>@if(item.SceneID.HasValue){<a asp-controller="Scenes" asp-action="Edit" asp-route-id="@item.SceneID">@item.Title</a>}else{<a asp-action="Chapter" asp-route-id="@item.ChapterID">@item.Title</a>}<small>@item.Kind · @item.Minutes planned minutes</small></div></li>}</ul>}
else if(Model.WritingSchedule.TodayTasks.Concat(Model.WritingSchedule.UpcomingTasks).Any()){<ul class="writer3-upcoming">@foreach(var item in Model.WritingSchedule.TodayTasks.Concat(Model.WritingSchedule.UpcomingTasks).Take(3)){<li><time>@item.ScheduledDate.ToString("ddd d MMM")</time><div><a asp-controller="Scenes" asp-action="Edit" asp-route-id="@item.SceneID">@item.SceneTitle</a><small>@item.TaskType · @item.EstimatedMinutes estimated minutes</small></div></li>}</ul>}
else{<p class="muted">No upcoming writing activity is scheduled for this book. You can create a plan, or keep writing without one.</p>}

View File

@ -0,0 +1,32 @@
@model WriterDashboardViewModel
@{var focus = Model.Objective; var editing = Context.Request.Query["setup"] == "true"; var kind = focus?.Activity is "Revising" or "Editing" or "Proofreading" ? "Editing" : focus?.Activity == "Researching" ? "Planning" : "Writing";}
<div class="writer3-workspace" aria-label="Writing workspace">
<section class="writer3-panel writer3-main" tabindex="0" id="working-focus" aria-label="Current writing focus">
<p class="eyebrow">Your current work</p>
@if(focus != null && !editing){
<h2>@(focus.SceneTitle ?? focus.ChapterTitle ?? "Your manuscript")</h2><p class="writer3-focus-kind">@focus.Activity</p><p>Return to this saved task. Write manuscript text in Word, and use the chapter or scene tools for your plan and notes.</p>
<div class="button-row">
@if(focus.SceneID.HasValue){<a class="btn btn-primary writer3-cta" asp-controller="Scenes" asp-action="Edit" asp-route-id="@focus.SceneID">Open current scene <span aria-hidden="true">→</span></a>}
else if(focus.ChapterID.HasValue){<a class="btn btn-primary writer3-cta" asp-action="Chapter" asp-route-id="@focus.ChapterID">Open current chapter <span aria-hidden="true">→</span></a>}
else{<a class="btn btn-primary writer3-cta" asp-controller="Books" asp-action="Details" asp-route-id="@Model.BookID" asp-fragment="chapters">Open your chapters <span aria-hidden="true">→</span></a>}
<a asp-action="Write" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID" asp-route-setup="true">Change objective</a>
</div>
}else{
<h2>@(editing ? "Choose your working focus" : "Where would you like to begin?")</h2><p>Choose an activity and, if you like, a chapter or scene. You can start without a writing plan.</p>
<div id="objective-setup"><partial name="_ObjectiveForm" model="Model" /></div>
}
@if(!Model.ActivityIsPrivate){<partial name="_WriterWorkToolbar" model="new PlotLine.Models.WriterWorkToolbar(Model.BookID!.Value, focus?.ChapterID, focus?.ChapterTitle, Model.ObjectiveChoices, kind)" />}
else{<p class="muted">Work-session evidence is private to the book owner. Your chapter and scene tools remain available.</p>}
</section>
<aside class="writer3-panel writer3-reference" tabindex="0" aria-label="Writing tools">
<h2>Keep your story close</h2><p>Open the existing tools when you need more detail.</p>
<div class="writer3-link-list">
<a asp-controller="Books" asp-action="Details" asp-route-id="@Model.BookID" asp-fragment="chapters">Chapters &amp; scenes <span aria-hidden="true">↗</span></a>
@if(focus?.ChapterID.HasValue==true){<a asp-action="Chapter" asp-route-id="@focus.ChapterID">Chapter goals &amp; workflow <span aria-hidden="true">↗</span></a>}
<a asp-action="Workspaces" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Scene workspaces <span aria-hidden="true">↗</span></a>
<button type="button" data-open-writing-context>Open Context <span aria-hidden="true">↗</span></button>
<button type="button" data-open-writing-intent>Open Intent <span aria-hidden="true">↗</span></button>
</div>
<p class="writer3-caption">Context and Intent open as standalone reference windows. Their selection is separate from your saved writing focus.</p><p data-writing-workspace-message role="status"></p>
</aside>
</div>

View File

@ -0,0 +1,16 @@
/* Writer 3 uses the application palette, type and controls. No independent shell or fixed monitor assumption. */
.writer3{color:var(--pd-text);max-width:1540px;margin:0 auto;padding:clamp(1rem,2.2vw,2rem) clamp(.5rem,1.5vw,1.5rem) 1.5rem;min-width:0}
.writer3-header{display:flex;align-items:center;gap:1.1rem;margin-bottom:1.6rem;min-width:0}.writer3-cover{width:54px;height:78px;object-fit:cover;flex-shrink:0;border-radius:5px;box-shadow:var(--pd-shadow)}.writer3-cover-empty{display:grid;place-items:center;color:var(--pd-on-accent);background:linear-gradient(145deg,var(--pd-accent),var(--pd-accent-hover));border-left:4px solid color-mix(in srgb,var(--pd-on-accent) 30%,transparent);font-size:1.8rem}
.writer3-identity{min-width:0;flex:1}.writer3-title{display:flex;align-items:center;gap:.6rem}.writer3-title h1{font-size:clamp(1.55rem,2.6vw,2.15rem);margin:0;color:var(--pd-heading);overflow-wrap:anywhere}.writer3-header .eyebrow{margin:0 0 .3rem}.writer3-header .muted{margin:.4rem 0 0;font-size:.95rem}.writer3-connection{max-width:270px;display:grid;gap:.3rem;text-align:right;font-size:.78rem;color:var(--pd-muted)}.writer3-connection a{color:var(--pd-accent)}
.writer3-home-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(1rem,1.8vw,1.8rem)}.writer3-choice{display:flex;align-items:center;flex-direction:column;text-align:center;justify-content:flex-start;gap:.8rem;padding:clamp(1.4rem,3vw,2.4rem) 1.3rem;min-height:clamp(250px,34vh,330px);color:var(--pd-text);text-decoration:none;background:linear-gradient(140deg,var(--pd-surface-2),var(--pd-surface));border:1px solid color-mix(in srgb,var(--pd-accent) 60%,var(--pd-border));border-radius:12px;box-shadow:var(--pd-shadow);transition:border-color .15s,background .15s}.writer3-choice:hover{color:var(--pd-text);border-color:var(--pd-accent);background:var(--pd-hover)}.writer3-choice h2{font-size:1.35rem;margin:0;color:var(--pd-heading)}.writer3-choice p{margin:0;font-size:1rem;line-height:1.55}.writer3-choice small{display:block;min-height:2.4em;font-size:.82rem;color:var(--pd-muted);max-width:32ch}.writer3-choice-icon{width:34px;height:34px;stroke:var(--pd-accent);stroke-width:1.6;fill:none;stroke-linecap:round;stroke-linejoin:round;margin-bottom:.2rem}.writer3-cta{display:inline-flex;align-items:center;justify-content:center;gap:.8rem;padding:.65rem 1.2rem;border:1px solid var(--pd-accent);background:var(--pd-accent);color:var(--pd-on-accent);border-radius:24px;text-decoration:none;font-weight:600;font-size:.9rem;width:fit-content}.writer3-cta:hover{color:var(--pd-on-accent);background:var(--pd-accent-hover);border-color:var(--pd-accent-hover)}.writer3-choice .writer3-cta{margin-top:auto}
.writer3-scope-notice{color:var(--pd-muted);margin-bottom:1.5rem}.writer3-workspace{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(280px,1fr);align-items:start;gap:1.4rem}.writer3-panel{min-width:0;border:1px solid var(--pd-border);border-radius:12px;padding:clamp(1.1rem,2vw,1.8rem);background:var(--pd-surface);box-shadow:var(--pd-shadow)}.writer3-panel h2{font-size:1.45rem;color:var(--pd-heading);margin:0 0 .8rem}.writer3-panel h3{font-size:1.05rem;color:var(--pd-heading);margin:0 0 .5rem}.writer3-panel>p{line-height:1.6;max-width:70ch}.writer3-main{border-top-color:color-mix(in srgb,var(--pd-accent) 70%,var(--pd-border))}.writer3-reference{background:linear-gradient(145deg,var(--pd-surface),var(--pd-surface-2))}.writer3-caption{font-size:.82rem;line-height:1.6;color:var(--pd-muted);margin:1.1rem 0 0}.writer3-inset{margin:1.3rem 0;padding-top:1.2rem;border-top:1px solid var(--pd-border-subtle)}.writer3-inset:last-child{margin-bottom:0}.writer3-inset p{margin-bottom:.6rem}.writer3-link-list{display:grid;gap:0}.writer3-link-list>a,.writer3-link-list>button{display:flex;align-items:center;justify-content:space-between;gap:.6rem;width:100%;padding:.85rem 0;color:var(--pd-text);background:transparent;border:0;border-bottom:1px solid var(--pd-border-subtle);font:inherit;font-size:.95rem;text-align:left;text-decoration:none}.writer3-link-list>a:hover,.writer3-link-list>button:hover{color:var(--pd-accent)}.writer3-link-list>a>span,.writer3-link-list>button>span{color:var(--pd-accent)}
.writer3-explore-paths{display:grid;gap:.8rem;margin:1.3rem 0}.writer3-explore-paths>a{display:flex;align-items:center;gap:1.1rem;padding:1rem;border:1px solid var(--pd-border-subtle);background:var(--pd-surface-2);border-radius:8px;color:var(--pd-text);text-decoration:none}.writer3-explore-paths>a:hover{border-color:var(--pd-accent)}.writer3-explore-paths p{font-size:.87rem;margin:0;line-height:1.5;color:var(--pd-muted)}.writer3-path-mark{font-size:.85rem;color:var(--pd-accent);font-variant-numeric:tabular-nums}.writer3-explore-paths>a>span:last-child{margin-left:auto;color:var(--pd-accent)}.writer3-focus-kind{color:var(--pd-accent);font-weight:600}.writer3 .writer-objective-form{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem}.writer3 .writer-objective-form label{display:grid;gap:.5rem;font-size:.9rem}.writer3 .writer-objective-form>.button-row{grid-column:1/-1;flex-wrap:wrap}.writer3 .button-row{display:flex;align-items:center;gap:1rem;flex-wrap:wrap}.writer3 .writer-work-toolbar{padding:1rem 0 0;margin:1.4rem 0 0;border-bottom:0;background:transparent}.writer3 .writer-work-toolbar .muted{font-size:.79rem}.writer3 .writer-work-toolbar .button-row{gap:.75rem}.writer3-upcoming{list-style:none;padding:0;margin:1rem 0}.writer3-upcoming li{display:flex;gap:1rem;padding:.7rem 0;border-bottom:1px solid var(--pd-border-subtle)}.writer3-upcoming time{font-size:.8rem;color:var(--pd-muted);min-width:85px}.writer3-upcoming small{display:block;color:var(--pd-muted);font-size:.8rem;margin-top:.25rem}.writer3-stat-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.75rem;margin:1.5rem 0}.writer3-stat-grid strong{font-size:clamp(1.2rem,2vw,1.9rem);font-weight:600;display:block}.writer3-stat-grid span{font-size:.85rem;color:var(--pd-muted)}
.writer3 a:focus-visible,.writer3 button:focus-visible,.writer3 select:focus-visible{outline:3px solid var(--pd-focus);outline-offset:4px}.writer3 a:not(.writer3-choice):not(.writer3-cta){text-underline-offset:.2em}
@media(min-width:1100px) and (min-height:800px){.writer3-home{padding-top:2.5rem}.writer3-home-choices{margin-top:2rem}.writer3-destination .writer3-panel{max-height:calc(100dvh - 355px);overflow:auto;scrollbar-gutter:stable}}
@media(max-width:1000px){.writer3-workspace{grid-template-columns:minmax(0,1.3fr) minmax(240px,1fr);gap:1rem}.writer3-connection{max-width:210px}.writer3-choice h2{font-size:1.2rem}.writer3-desktop-break{display:none}}
@media(max-width:760px){.writer3{padding:.9rem .25rem 1.3rem}.writer3-header{flex-wrap:wrap;gap:.8rem;margin-bottom:1.2rem}.writer3-cover{width:42px;height:61px}.writer3-connection{width:100%;max-width:none;text-align:left;display:flex;flex-wrap:wrap;gap:.8rem;padding-left:0}.writer3-home-choices,.writer3-workspace{grid-template-columns:1fr;gap:1rem}.writer3-choice{min-height:0;gap:.65rem;padding:1.3rem}.writer3-choice small{min-height:0}.writer3-choice-icon{width:28px;height:28px}.writer3 .writer-objective-form{grid-template-columns:1fr}.writer3-stat-grid{gap:.4rem}.writer3-stat-grid strong{font-size:1.2rem}}
@media(prefers-reduced-motion:reduce){.writer3-choice{transition:none}}
.writer3-panel:focus-visible{outline:3px solid var(--pd-focus);outline-offset:3px}
.writer3 .writer3-choice p{color:var(--pd-text)}

View File

@ -0,0 +1,13 @@
// Preserve old bookmarked desk fragments after Home becomes the Writer entry point.
// Use only server-generated, authorised book-scope URLs; never copy a chapter or native selection.
(() => {
const home=document.querySelector('[data-writer-destination="Home"]');
if(!home)return;
const restore=()=>{
const hash=location.hash;
const path=['#display-setup','#workspaces'].includes(hash)?home.dataset.writerLegacyUrl:
['#working-focus','#working-objective','#objective-setup'].includes(hash)?home.dataset.writerWriteUrl:null;
if(path){const target=new URL(path,location.origin);if(hash!=='#working-focus'&&path===home.dataset.writerWriteUrl)target.searchParams.set('setup','true');target.hash=hash;location.replace(target.pathname+target.search+target.hash);}
};
window.addEventListener('hashchange',restore);restore();
})();