diff --git a/PlotLine.Tests/Browser/writer-onboarding-live.cjs b/PlotLine.Tests/Browser/writer-onboarding-live.cjs index 7ae662c0..0e8d3ae8 100644 --- a/PlotLine.Tests/Browser/writer-onboarding-live.cjs +++ b/PlotLine.Tests/Browser/writer-onboarding-live.cjs @@ -14,7 +14,8 @@ const assert=require('node:assert/strict'); 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})); - const page=await context.newPage(); + const page=await context.newPage(); const failures=[]; + page.on('response', response=>{if(response.request().isNavigationRequest()&&response.request().frame()===page.mainFrame()&&response.status()>=400)failures.push(response.status()+' '+new URL(response.url()).pathname);}); await page.goto(base+'/Account/Login');await page.locator('[name=Email]').fill(who.Email);await page.locator('[name=Password]').fill(who.Password); await Promise.all([page.waitForURL('**/Projects'),page.locator('button[type=submit]').click()]); await page.goto(writer); @@ -46,7 +47,7 @@ const assert=require('node:assert/strict'); if(allBooks)await page.locator('[name=BookID]').selectOption(''); await Promise.all([page.waitForURL('**/Writer/SchedulePreview?writingPlanId=*'),page.getByRole('button',{name:'Create Plan and Generate Schedule'}).click()]); await page.getByRole('link',{name:'Edit Plan',exact:true}).click();await page.waitForURL('**/Writer/EditWritingPlan?writingPlanId=*'); - assert((await page.locator('body').textContent()).includes(allBooks?'All Books':'Writer verification book')); + assert.equal(await page.locator('input[readonly]').nth(1).inputValue(),allBooks?'All Books':'Writer verification book'); await page.locator('[name=PlanName]').fill(allBooks?'Updated project-wide plan':'Updated book plan'); await Promise.all([page.waitForURL('**/Writer/WritingPlans?*'),page.getByRole('button',{name:'Save Plan',exact:true}).click()]); assert((await page.locator('body').textContent()).includes(allBooks?'Updated project-wide plan':'Updated book plan')); @@ -56,14 +57,15 @@ const assert=require('node:assert/strict'); assert((await page.locator('body').textContent()).includes('Updated book plan')); } for(const title of ['Writing Journey','Writing Plan','Workspaces','Reports']){ - await page.goto(writer);const link=page.locator('#ribbon-panel-writer a').filter({hasText:new RegExp('^'+title+'$')}); + await page.goto(writer);const link=page.locator('#ribbon-panel-writer').getByRole('link',{name:title,exact:true}); assert.equal(await link.count(),1);await link.click();await page.waitForLoadState();assert.equal(await page.locator('h1').count(),1);assert(!(await page.locator('body').textContent()).includes('An error occurred')); assert(new URL(page.url()).searchParams.get('bookId')===String(scope.book),`${title} retains book`); } await page.goto(`${base}/Writer?projectId=${scope.project}&bookId=${scope.other}`);assert.equal(await page.getByRole('heading',{name:'Start Here',exact:true}).isVisible(),true); await page.goto(writer);assert.equal(await page.getByRole('heading',{name:'Continue Writing',exact:true}).isVisible(),true); await page.getByRole('link',{name:'Change objective'}).click();assert.equal(await page.locator('[name=Activity]').inputValue(),'Revising');assert.equal(await page.locator('[data-objective-scene]').inputValue(),String(scope.scene)); + assert.deepEqual(failures,[]); console.log(`PASS live Writer author journey: ${pwa?'simulated PWA':'browser'}; real chapter/scene destinations, saved objective, optional scheduling, ribbon and book isolation`); await context.close(); }}finally{await browser.close();} -})().catch(error=>{console.error(error.message);process.exitCode=1;}); +})().catch(error=>{console.error(error.stack);process.exitCode=1;}); diff --git a/PlotLine/Views/Writer/Index.cshtml b/PlotLine/Views/Writer/Index.cshtml index 9bb74e8b..3d6e74e6 100644 --- a/PlotLine/Views/Writer/Index.cshtml +++ b/PlotLine/Views/Writer/Index.cshtml @@ -11,6 +11,8 @@ 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(); var maximum=Math.Max(1L,days.Select(x=>x.Added+x.Removed).DefaultIfEmpty(1).Max()); } @@ -37,14 +39,16 @@ {

Writing Progress · last 30 days

Your Manuscript

-

@(Model.Book?.CurrentWordCount.ToString("N0") ?? "—") words · @(Model.Book?.ChapterCount ?? 0) chapters · @(Model.Book?.SceneCount ?? 0) scenes

@if(bookId.HasValue){Open Chapters}
+

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

@if(bookId.HasValue){Open Chapters} @if(totals != null && (totals.Added > 0 || totals.Removed > 0)) {

+@totals.Added.ToString("N0") added · −@totals.Removed.ToString("N0") removed · @totals.Net.ToString("+0;-0;0") net

} else{

@(totals?.HasAcceptedEvidence == true ? "Tracking begins at your manuscript baseline. New accepted changes will appear here." : "Activity begins with your first accepted manuscript baseline. Earlier writing cannot be reconstructed.")

} + @if(queues.Any(q=>q.Item3.Count>0)){
@foreach(var q in queues.Where(x=>x.Item3.Count>0)){}
@foreach(var q in queues){@q.Item3.Count @q.Item2}
+ } @if(bookId.HasValue){Reports & activity settings}
} diff --git a/PlotLine/Views/Writer/_WorkingObjective.cshtml b/PlotLine/Views/Writer/_WorkingObjective.cshtml index 3b6ad94b..58fdd668 100644 --- a/PlotLine/Views/Writer/_WorkingObjective.cshtml +++ b/PlotLine/Views/Writer/_WorkingObjective.cshtml @@ -19,7 +19,7 @@ else if(Model.BookID.HasValue)
Continue an existing manuscriptChoose a chapter or scene and your working activity. Plan your writing timeSet availability, goals and a deadline. - Explore your manuscript@Model.Book?.ChapterCount chapters · @Model.Book?.SceneCount scenes + Explore your manuscript@Model.Book?.ChapterCount @(Model.Book?.ChapterCount == 1 ? "chapter" : "chapters") · @Model.Book?.SceneCount @(Model.Book?.SceneCount == 1 ? "scene" : "scenes")
Choose your working objective