Restore Writer panel spacing and clarify Locations hierarchy commands

This commit is contained in:
Nick Beckley 2026-11-03 23:08:31 +00:00
parent b523a86c19
commit 9d78a630fd
17 changed files with 188 additions and 32 deletions

View File

@ -95,3 +95,13 @@ Urgent Writer release is still pending this final broader gate; an earlier publi
### Restart safety checkpoint and visual work ### Restart safety checkpoint and visual work
Final Writer checkpoint: full harness passed again (405 checks, exit 0); both Writer browser/PWA suites passed. Phase 2 remains undeployed. Expanded read-only restart inspection found two illustration records marked Generating. The tracked restart gate now includes illustration and unfinished core-import work, verifies Development database identity, and refuses restart while these exist. Its controlled exit 2 was verified; no service restart or database mutation occurred. Live authenticated Writer acceptance remains deferred. Proceeding to Writer spacing and systematic rendered visual coverage independently. Final Writer checkpoint: full harness passed again (405 checks, exit 0); both Writer browser/PWA suites passed. Phase 2 remains undeployed. Expanded read-only restart inspection found two illustration records marked Generating. The tracked restart gate now includes illustration and unfinished core-import work, verifies Development database identity, and refuses restart while these exist. Its controlled exit 2 was verified; no service restart or database mutation occurred. Live authenticated Writer acceptance remains deferred. Proceeding to Writer spacing and systematic rendered visual coverage independently.
### Rendered visual and Locations checkpoint
- Added opt-in full-layout fixture rendering for the existing synthetic page catalog; actual Razor `_ViewStart`, layout and page scripts render once. Added a repeatable screenshot capture script and explicit page inventory.
- Writer before/after captures cover browser/PWA, 1440/390 widths and four requested themes (16 cases each). Inspected all after captures in contact sheets plus full-size desktop/mobile examples. Repaired missing shared story-section padding (14px, matching queue cards), compact Writer heading hierarchy, 16px major-section gaps and stretched mobile count badges.
- Initial wider inventory captured 240 cases with no script errors/document overflow. Visual inspection found touching Book metadata/chapter panels and Floor Plans create/empty panels, and initially appeared to show low-contrast dark-theme secondary buttons. Settled-theme verification disproved the latter: capture occurred mid-transition. Removed the unnecessary colour override and added a 350ms post-theme settle plus disabled screenshot animations. Shared direct-sibling surface gaps repair the confirmed touching surfaces. Continuous maps/graphs/calendar/table surfaces retain their intentional flush structure.
- Initial inventory's `page=timeline` was discovered visually to render the calendar in full-layout mode; it is excluded as Timeline evidence. Final inventory uses the actual `page=timeline-render` view and adds Chapter Details and Floor Plan Editor. Final captures/inspection remain in progress; no claim that capture alone constitutes visual acceptance.
- Maps now has a folded-map shared navigation command, distinct from the Floor Plans blueprint, and is available in quick-access customisation without changing defaults. Locations uses separate icon+label choices with a recessed active state and original mutually exclusive/persisted handlers. Tree rows have a right-edge grip using the established `⠿` convention; dragging starts at the handle while Edit remains the accessible parent-change alternative.
- Verification so far: solution builds passed with zero warnings/errors; full harness passed again (405 checks); Writer recovery/navigation and chapter-goal browser/PWA suites passed after spacing changes; real-layout Locations controls/native handle/confirmation/relationship tests passed in four themes and both modes; assignment/AJAX/validation/scroll tests passed with handle initiation; nine-record workspace suite passed. Final visual acceptance and quick-access icon check remain pending.
- Read-only current database metadata inventory obtained: 167 tables, 54 with ProjectID, 113 reachable by foreign keys from Projects. This is the start of the data-transfer audit, not coverage proof. No Development data was changed. Preparing a schema-only isolated test environment; E/F inventories and semantic round trips remain pending.

View File

@ -6,7 +6,7 @@ const assert=require('node:assert/strict');
if(pwa)await context.addInitScript(()=>Object.defineProperty(navigator,'standalone',{value:true})); if(pwa)await context.addInitScript(()=>Object.defineProperty(navigator,'standalone',{value:true}));
const page=await context.newPage(),errors=[];page.on('pageerror',e=>errors.push(e.message)); const page=await context.newPage(),errors=[];page.on('pageerror',e=>errors.push(e.message));
for(const theme of ['modern-light','modern-dark','warm-light','warm-dark']){ for(const theme of ['modern-light','modern-dark','warm-light','warm-dark']){
await page.goto('http://127.0.0.1:5238/fixture?desktop=Locations'); await page.goto('http://127.0.0.1:5238/fixture?desktop=Locations&layout=full');
await page.evaluate(theme=>document.documentElement.dataset.appTheme=theme,theme); await page.evaluate(theme=>document.documentElement.dataset.appTheme=theme,theme);
const toolbar=page.locator('.location-hierarchy-toolbar'); const toolbar=page.locator('.location-hierarchy-toolbar');
assert.equal(await toolbar.isVisible(),!pwa); assert.equal(await toolbar.isVisible(),!pwa);
@ -14,20 +14,49 @@ const assert=require('node:assert/strict');
const parent=group.getByRole('button',{name:'Change parent',exact:true}),relationship=group.getByRole('button',{name:'Create relationship',exact:true}); const parent=group.getByRole('button',{name:'Change parent',exact:true}),relationship=group.getByRole('button',{name:'Create relationship',exact:true});
await parent.waitFor();await relationship.waitFor(); await parent.waitFor();await relationship.waitFor();
if(pwa){ if(pwa){
assert.equal(await group.locator('.pd-context-segmented').count(),1); assert.equal(await group.locator('.pd-context-segmented').count(),0);
const a=await parent.boundingBox(),b=await relationship.boundingBox(); const a=await parent.boundingBox(),b=await relationship.boundingBox();
assert.ok(Math.abs(a.x+a.width-b.x)<2,'Segments join without a gap'); assert.ok(b.x>a.x+a.width,'Separate ribbon commands have a gap');
assert.ok(a.height<=36&&b.height<=36,'Compact label-only controls'); assert.ok(a.height>=45&&b.height>=45,'Ordinary icon-and-label ribbon commands');
assert.equal(await parent.locator('svg').isVisible(),false); assert.equal(await parent.locator('svg').isVisible(),true);
assert.equal(await relationship.locator('svg').isVisible(),true);
} }
await relationship.focus();await page.keyboard.press('Enter'); await relationship.focus();await page.keyboard.press('Enter');
assert.equal(await parent.getAttribute('aria-pressed'),'false');assert.equal(await relationship.getAttribute('aria-pressed'),'true'); assert.equal(await parent.getAttribute('aria-pressed'),'false');assert.equal(await relationship.getAttribute('aria-pressed'),'true');
assert.equal(await page.locator('[data-location-drag-action]').inputValue(),'relationship'); assert.equal(await page.locator('[data-location-drag-action]').inputValue(),'relationship');
await page.reload(); await page.reload();
assert.equal(await relationship.getAttribute('aria-pressed'),'true','Persisted preference restores through ribbon binding'); assert.equal(await relationship.getAttribute('aria-pressed'),'true','Persisted preference restores through ribbon binding');
assert.notEqual(await relationship.evaluate(node=>getComputedStyle(node).boxShadow),'none','Selected command is recessed');
await parent.click(); await parent.click();
const source=page.locator('[data-drag-id="1"]'),target=page.locator('[data-drag-id="2"]');
assert.equal(await source.getAttribute('draggable'),null,'Row links and controls are not drag initiators');
const handle=source.locator('[data-location-drag-handle]');
assert.equal(await handle.getAttribute('draggable'),'true');
assert.equal(await handle.evaluate(node=>getComputedStyle(node).cursor),'grab');
assert.match(await handle.getAttribute('aria-label'),/choose Edit/);
assert.ok(await source.getByRole('link',{name:'Edit',exact:true}).isVisible(),'Accessible parent-edit alternative remains available');
await handle.dragTo(target);
const confirmation=page.locator('#plotlineConfirmModal');
await confirmation.waitFor({state:'visible'});
assert.match(await confirmation.innerText(),/Building/);
await confirmation.locator('[data-bs-dismiss="modal"]').last().click();
await confirmation.waitFor({state:'hidden'});
await page.locator('.modal-backdrop').waitFor({state:'hidden'});
await relationship.click();
await handle.dragTo(target);
const editor=page.locator('[data-location-relationship-modal]');
await editor.waitFor({state:'visible'});
await editor.locator('[data-drag-cancel]').first().click();
await editor.waitFor({state:'hidden'});
await parent.click();
const map=page.locator('#ribbon-panel-world a[data-ribbon-icon=maps]');
const floor=page.locator('#ribbon-panel-world a[data-ribbon-icon=floorplans]');
assert.equal(await map.getAttribute('data-ribbon-icon'),'maps');
assert.equal(await floor.getAttribute('data-ribbon-icon'),'floorplans');
assert.notEqual(await map.locator('path').getAttribute('d'),await floor.locator('path').getAttribute('d'));
} }
assert.deepEqual(errors,[]);await context.close(); assert.deepEqual(errors,[]);await context.close();
} }
console.log('PASS compact connected Location hierarchy segments, keyboard selection, persisted state and browser/PWA fallback in four themes'); console.log('PASS separate icon-and-label Location hierarchy commands, keyboard selection, persisted state and browser/PWA fallback in four themes');
}finally{await browser.close();}})().catch(error=>{console.error(error);process.exitCode=1;}); }finally{await browser.close();}})().catch(error=>{console.error(error);process.exitCode=1;});

View File

@ -13,7 +13,7 @@ const repo = path.resolve(__dirname, '../..');
await page.goto('https://plotdirector.test/Locations'); await page.goto('https://plotdirector.test/Locations');
const modal = fs.readFileSync(path.join(repo, 'PlotLine/Views/Shared/_ConfirmationDialog.cshtml'), 'utf8'); const modal = fs.readFileSync(path.join(repo, 'PlotLine/Views/Shared/_ConfirmationDialog.cshtml'), 'utf8');
const rows = [ ['1','Room','',''], ['2','Building','',''], ['3','Cupboard','1','Room'], ['4','Annex','2','Building'] ] const rows = [ ['1','Room','',''], ['2','Building','',''], ['3','Cupboard','1','Room'], ['4','Annex','2','Building'] ]
.map(([id,name,parent,parentName]) => `<div style="padding:24px;border:1px solid" draggable="true" data-drag-type="location" data-drag-id="${id}" data-drag-label="${name}" data-parent-location-id="${parent}" data-parent-location-name="${parentName}"><a href="/Locations/Details/${id}">${name}</a></div>`).join(''); .map(([id,name,parent,parentName]) => `<div class="location-tree-row" style="padding:24px;border:1px solid" data-drag-type="location" data-drag-id="${id}" data-drag-label="${name}" data-parent-location-id="${parent}" data-parent-location-name="${parentName}"><a href="/Locations/Details/${id}">${name}</a><span draggable="true" data-location-drag-handle>⠿</span></div>`).join('');
const locationsView = fs.readFileSync(path.join(repo, 'PlotLine/Views/Locations/Index.cshtml'), 'utf8'); const locationsView = fs.readFileSync(path.join(repo, 'PlotLine/Views/Locations/Index.cshtml'), 'utf8');
const toolbarStart = locationsView.indexOf(' <div class="location-hierarchy-toolbar"'); const toolbarStart = locationsView.indexOf(' <div class="location-hierarchy-toolbar"');
const toolbar = locationsView.slice(toolbarStart, locationsView.indexOf(' <form asp-action="Reparent"', toolbarStart)); const toolbar = locationsView.slice(toolbarStart, locationsView.indexOf(' <form asp-action="Reparent"', toolbarStart));
@ -53,7 +53,7 @@ const repo = path.resolve(__dirname, '../..');
}); });
const drag = async (source, target) => { const drag = async (source, target) => {
await page.locator(`[data-drag-id="${source}"]`).scrollIntoViewIfNeeded(); await page.locator(`[data-drag-id="${source}"]`).scrollIntoViewIfNeeded();
await page.locator(`[data-drag-id="${source}"]`).dragTo(page.locator(`[data-drag-id="${target}"]`)); await page.locator(`[data-drag-id="${source}"] [data-location-drag-handle]`).dragTo(page.locator(`[data-drag-id="${target}"]`));
}; };
const confirm = page.locator('#plotlineConfirmModal'); const confirm = page.locator('#plotlineConfirmModal');
assert.deepEqual(errors,[]); assert.deepEqual(errors,[]);

View File

@ -0,0 +1,27 @@
// Capture real full-layout Razor pages. Screenshots require human/agent visual inspection;
// overflow metrics alone are not visual acceptance.
const { chromium } = require('playwright');
const fs = require('node:fs');
const path = require('node:path');
const output = process.env.PD_VISUAL_OUTPUT || '/srv/repos/plotdirector-phase2-artifacts/visual';
const stage = process.env.PD_VISUAL_STAGE || 'before';
const pages = process.env.PD_VISUAL_PAGES ? JSON.parse(process.env.PD_VISUAL_PAGES) : {writer:'page=writer'};
(async()=>{
fs.mkdirSync(output,{recursive:true}); const browser=await chromium.launch();const results=[];
try{for(const [name,query] of Object.entries(pages))for(const pwa of [false,true])for(const width of [1440,390])for(const theme of ['modern-light','modern-dark','warm-light','warm-dark']){
const context=await browser.newContext({viewport:{width,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'))}));
const page=await context.newPage();const errors=[];page.on('pageerror',e=>errors.push(e.message));
const response=await page.goto('http://127.0.0.1:5238/fixture?'+query+'&layout=full');
await page.waitForTimeout(250);await page.evaluate(theme=>window.PlotDirectorApplyApplicationTheme(theme),theme);
await page.waitForTimeout(350); // Let the production theme transition settle before judging contrast.
const file=`${stage}-${name}-${pwa?'pwa':'browser'}-${width}-${theme}.png`;
await page.screenshot({path:path.join(output,file),fullPage:true,animations:'disabled'});
const metrics=await page.evaluate(()=>({viewport:innerWidth,scroll:document.documentElement.scrollWidth,panels:[...document.querySelectorAll('.story-bible-section')].map(p=>({padding:getComputedStyle(p).padding, width:p.getBoundingClientRect().width}))}));
results.push({name,pwa,width,theme,file,status:response.status(),errors,metrics,visuallyInspected:false});
fs.writeFileSync(path.join(output,`${stage}-manifest.json`),JSON.stringify(results,null,2));await context.close();
}
fs.writeFileSync(path.join(output,`${stage}-manifest.json`),JSON.stringify(results,null,2));console.log(`${results.length} screenshots captured; inspection pending.`);
}finally{await browser.close();}
})().catch(e=>{console.error(e);process.exitCode=1;});

View File

@ -0,0 +1,20 @@
{
"project-overview":"page=dashboard",
"projects":"page=projects",
"book":"desktop=Books",
"chapters":"desktop=Chapters",
"writer":"page=writer",
"characters":"desktop=Characters&context=objects",
"locations":"desktop=Locations",
"floorplans":"desktop=FloorPlans",
"floorplan-editor":"page=floorplans",
"maps":"page=maps",
"timeline":"page=timeline-render",
"plot-lines":"desktop=PlotLineWorkspace",
"calendar":"desktop=StoryCalendar",
"story-bible":"desktop=StoryBible",
"writing-plans":"desktop=WritingPlans",
"project-edit":"desktop=ProjectEdit",
"relationships":"page=relationships",
"scenes":"page=scene-edit"
}

View File

@ -9,7 +9,7 @@ const base = 'http://127.0.0.1:5238';
const context = await browser.newContext({viewport:{width:1600,height:1000}}); const context = await browser.newContext({viewport:{width:1600,height:1000}});
if (pwa) await context.addInitScript(() => Object.defineProperty(navigator,'standalone',{value:true})); if (pwa) await context.addInitScript(() => Object.defineProperty(navigator,'standalone',{value:true}));
const page = await context.newPage(); const page = await context.newPage();
const errors=[];page.on('pageerror',error=>errors.push(error.message)); context.on('page',popup=>popup.on('pageerror',error=>errors.push(error.message))); const errors=[];page.on('pageerror',error=>{errors.push(error.message);console.error(page.url(),error.stack);}); context.on('page',popup=>popup.on('pageerror',error=>errors.push(error.message)));
// Use the real SDK, production Hub/presence services, full Razor layout and scripts. // Use the real SDK, production Hub/presence services, full Razor layout and scripts.
// Only the first network negotiation is failed; subsequent traffic reaches the loopback Hub. // Only the first network negotiation is failed; subsequent traffic reaches the loopback Hub.
await context.route('**/signalr.min.js',route=>route.fulfill({contentType:'application/javascript',body:fs.readFileSync(require.resolve('@microsoft/signalr/dist/browser/signalr.min.js'),'utf8') + ` await context.route('**/signalr.min.js',route=>route.fulfill({contentType:'application/javascript',body:fs.readFileSync(require.resolve('@microsoft/signalr/dist/browser/signalr.min.js'),'utf8') + `

View File

@ -254,6 +254,9 @@ internal static class ToolbarBrowserHost
model.Book = new Book { BookID = 12, ProjectID = 7, BookTitle = "A Distant Shore", BookNumber = 1 }; model.Book = new Book { BookID = 12, ProjectID = 7, BookTitle = "A Distant Shore", BookNumber = 1 };
model.Books = [model.Book, new Book { BookID = 13, ProjectID = 7, BookTitle = "The Return", BookNumber = 2 }]; model.Books = [model.Book, new Book { BookID = 13, ProjectID = 7, BookTitle = "The Return", BookNumber = 2 }];
} }
var fullLayout = context.Request.Query["layout"] == "full";
string? fullView = null;
object? fullModel = null;
string? recordLayout = null; string? recordLayout = null;
var writerScripts = ""; var writerScripts = "";
var dashboardPage = context.Request.Query["page"] == "dashboard"; var dashboardPage = context.Request.Query["page"] == "dashboard";
@ -265,6 +268,15 @@ internal static class ToolbarBrowserHost
var action = new ActionContext(context, route, new ActionDescriptor()); var action = new ActionContext(context, route, new ActionDescriptor());
async Task<string> Render(string name, object? viewModel = null) async Task<string> Render(string name, object? viewModel = null)
{ {
if (fullLayout)
{
if (!name.StartsWith("Shared/") && !name.EndsWith("/_GraphScripts") && name != "Timeline/Settings")
{
fullView = name == "StoryCalendar/_StoryCalendarSurface" ? "StoryCalendar/Index" : name;
fullModel = viewModel ?? model;
}
return "";
}
var view = context.RequestServices.GetRequiredService<ICompositeViewEngine>().GetView(null, $"/Views/{name}.cshtml", false); var view = context.RequestServices.GetRequiredService<ICompositeViewEngine>().GetView(null, $"/Views/{name}.cshtml", false);
if (!view.Success) throw new Exception(string.Join(",", view.SearchedLocations)); if (!view.Success) throw new Exception(string.Join(",", view.SearchedLocations));
using var writer = new StringWriter(); using var writer = new StringWriter();
@ -396,8 +408,14 @@ internal static class ToolbarBrowserHost
new() { ChapterID = 21, ChapterNumber = 1, ChapterTitle = "Drowning in Silence", RevisionStatusName = "Planned", IsLinkedToManuscript = true, Summary = "A quiet opening." }, new() { ChapterID = 21, ChapterNumber = 1, ChapterTitle = "Drowning in Silence", RevisionStatusName = "Planned", IsLinkedToManuscript = true, Summary = "A quiet opening." },
new() { ChapterID = 22, ChapterNumber = 2, ChapterTitle = "A deliberately long chapter title about an unexpected journey beyond the distant northern mountains", RevisionStatusName = "Draft", ChapterPurposeName = "Turning point", Summary = "A longer summary remains available on small screens.", IsLinkedToManuscript = false } new() { ChapterID = 22, ChapterNumber = 2, ChapterTitle = "A deliberately long chapter title about an unexpected journey beyond the distant northern mountains", RevisionStatusName = "Draft", ChapterPurposeName = "Turning point", Summary = "A longer summary remains available on small screens.", IsLinkedToManuscript = false }
] }, ] },
"Chapters" => new ChapterDetailViewModel { Project = project, Book = model.Book!, Chapter = new() { ChapterID = 21, BookID = 12, ChapterNumber = 1, ChapterTitle = "The crossing", Summary = "A synthetic chapter." }, Scenes = [new() { SceneID = 101, ChapterID = 21, SceneNumber = 1, SceneTitle = "Arrival", Summary = "A synthetic scene." }] },
"Characters" => new CharacterListViewModel { Project = project, Characters = context.Request.Query["context"] == "objects" ? [new Character { CharacterID = 71, CharacterName = "Context A" }, new Character { CharacterID = 72, CharacterName = "Context B" }] : [] }, "Characters" => new CharacterListViewModel { Project = project, Characters = context.Request.Query["context"] == "objects" ? [new Character { CharacterID = 71, CharacterName = "Context A" }, new Character { CharacterID = 72, CharacterName = "Context B" }] : [] },
"Locations" => new LocationListViewModel { Project = project }, "Locations" => new LocationListViewModel { Project = project, Locations = [
new() { LocationID = 1, ProjectID = 7, LocationName = "Room", LocationPath = "Room" },
new() { LocationID = 3, ProjectID = 7, LocationName = "Cupboard", ParentLocationID = 1, ParentLocationName = "Room", Depth = 1, LocationPath = "Room / Cupboard" },
new() { LocationID = 2, ProjectID = 7, LocationName = "Building", LocationPath = "Building" },
new() { LocationID = 4, ProjectID = 7, LocationName = "Annex", ParentLocationID = 2, ParentLocationName = "Building", Depth = 1, LocationPath = "Building / Annex" }
] },
"FloorPlans" => new FloorPlanListViewModel { Project = project }, "FloorPlans" => new FloorPlanListViewModel { Project = project },
"PlotLineWorkspace" => new PlotLineWorkspaceViewModel { Project = project }, "PlotLineWorkspace" => new PlotLineWorkspaceViewModel { Project = project },
"Warnings" => new WarningDashboardViewModel { Project = project }, "Warnings" => new WarningDashboardViewModel { Project = project },
@ -415,7 +433,7 @@ internal static class ToolbarBrowserHost
_ => throw new InvalidOperationException("Unknown desktop fixture") _ => throw new InvalidOperationException("Unknown desktop fixture")
}; };
var viewController = desktopPage switch { "ManuscriptImport" or "ReviewCentre" => "Onboarding", "ProjectEdit" => "Projects", "WritingPlans" or "SchedulePreview" => "Writer", _ => desktopPage }; var viewController = desktopPage switch { "ManuscriptImport" or "ReviewCentre" => "Onboarding", "ProjectEdit" => "Projects", "WritingPlans" or "SchedulePreview" => "Writer", _ => desktopPage };
var viewAction = desktopPage switch { "ManuscriptImport" => "Index", "ReviewCentre" => "StoryIntelligenceReviewCentre", "ProjectEdit" => "Edit", "WritingPlans" or "SchedulePreview" => desktopPage, "Dynamics" => "Story", "Books" => "Details", _ => "Index" }; var viewAction = desktopPage switch { "ManuscriptImport" => "Index", "ReviewCentre" => "StoryIntelligenceReviewCentre", "ProjectEdit" => "Edit", "WritingPlans" or "SchedulePreview" => desktopPage, "Dynamics" => "Story", "Books" or "Chapters" => "Details", _ => "Index" };
route.Values["controller"] = viewController; route.Values["controller"] = viewController;
route.Values["action"] = viewAction; route.Values["action"] = viewAction;
model.ActiveSection = desktopPage switch { "StoryBible" => "Story Bible", "PlotLineWorkspace" => "Plot Lines", "PlotThreads" => "Threads", "StoryCalendar" => "Calendar", "StoryPoint" => "At This Point", "ProjectMetrics" => "Metrics", "Analytics" or "Dynamics" => "Health", _ => desktopPage }; model.ActiveSection = desktopPage switch { "StoryBible" => "Story Bible", "PlotLineWorkspace" => "Plot Lines", "PlotThreads" => "Threads", "StoryCalendar" => "Calendar", "StoryPoint" => "At This Point", "ProjectMetrics" => "Metrics", "Analytics" or "Dynamics" => "Health", _ => desktopPage };
@ -478,6 +496,13 @@ internal static class ToolbarBrowserHost
} }
if (context.Request.Query["page"] == "writer") if (context.Request.Query["page"] == "writer")
surface = await Render("Writer/Index", WriterFixture()); surface = await Render("Writer/Index", WriterFixture());
if (fullLayout)
{
if (fullView is null || fullModel is null) throw new InvalidOperationException("Full-layout fixture requires a page model.");
var selected = fullView.Split('/');
await RenderFullAsync(context, selected[0], selected[1], fullModel);
return;
}
surface += await Render("Shared/_ConfirmationDialog"); surface += await Render("Shared/_ConfirmationDialog");
var initialTheme = appearance.ThemeKey ?? "warm-light"; var initialTheme = appearance.ThemeKey ?? "warm-light";
var appearanceScript = "<script>window.plotdirectorAppearance=" + System.Text.Json.JsonSerializer.Serialize(new { theme = initialTheme, migrate = false, collapsed = appearance.RibbonCollapsed }) + ";</script>"; var appearanceScript = "<script>window.plotdirectorAppearance=" + System.Text.Json.JsonSerializer.Serialize(new { theme = initialTheme, migrate = false, collapsed = appearance.RibbonCollapsed }) + ";</script>";

View File

@ -33,7 +33,7 @@ public static class ApplicationRibbon
new("Manuscript review", S("review")), new("Library", S("overview"), new("Add book", "bible", "Books", "Create"))), new("Manuscript review", S("review")), new("Library", S("overview"), new("Add book", "bible", "Books", "Create"))),
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("Writing", S("writer"))), 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("Writing", S("writer"))),
new("characters", "Characters", new("Cast", S("characters"), S("names")), new("Connections", S("relationships"))), new("characters", "Characters", new("Cast", S("characters"), S("names")), new("Connections", S("relationships"))),
new("world", "World", new("Setting", S("locations"), new("Maps", "floorplans", "Maps", "Index"), S("floorplans")), new("Story world", S("assets"))), new("world", "World", new("Setting", S("locations"), S("maps"), S("floorplans")), new("Story world", S("assets"))),
new("tools", "Tools", new("Reference", S("bible")), new("Insights", S("metrics"), S("health"), S("warnings")), new("Organisation", S("archive"))), new("tools", "Tools", new("Reference", S("bible")), new("Insights", S("metrics"), S("health"), S("warnings")), new("Organisation", S("archive"))),
new("help", "Help", new RibbonGroup("Support", new("Help Centre", "bible", "Help", "Index", "global"), new("Feature Requests", "review", "FeatureRequests", "Index", "global"))) new("help", "Help", new RibbonGroup("Support", new("Help Centre", "bible", "Help", "Index", "global"), new("Feature Requests", "review", "FeatureRequests", "Index", "global")))
]; ];
@ -52,7 +52,7 @@ public static class ApplicationRibbon
public static RibbonIcon Icon(string key) => RibbonPresentation.Icons.Single(x => x.Key == key); public static RibbonIcon Icon(string key) => RibbonPresentation.Icons.Single(x => x.Key == key);
public static string Tone(string key) => key switch public static string Tone(string key) => key switch
{ {
"calendar" or "point" => "calendar", "characters" or "names" => "characters", "locations" or "floorplans" => "locations", "calendar" or "point" => "calendar", "characters" or "names" => "characters", "locations" or "maps" or "floorplans" => "locations",
"relationships" => "relationships", "warnings" => "warning", "review" => "review", "bible" or "overview" or "projects" => "books", _ => "planning" "relationships" => "relationships", "warnings" => "warning", "review" => "review", "bible" or "overview" or "projects" => "books", _ => "planning"
}; };
} }

View File

@ -19,6 +19,8 @@ public static class RibbonPresentation
"exports.writingsession" => "session", _ => "export" "exports.writingsession" => "session", _ => "export"
}; };
} }
if (operation == "maps.index") return "maps";
if (operation == "floorplans.index") return "floorplans";
if (operation == "timeline.settings" || operation is "manageaccount.index" or "manageaccount.subscription") return "settings"; if (operation == "timeline.settings" || operation is "manageaccount.index" or "manageaccount.subscription") return "settings";
if (operation == "plotlines.index") return "list"; if (operation == "plotlines.index") return "list";
if (operation == "acceptance.phase1") return "validate"; if (operation == "acceptance.phase1") return "validate";

View File

@ -36,6 +36,7 @@ public static class ToolbarCommands
new("names", "Names", "M4 4h16v16H4z M7 8h10 M7 12h7 M7 16h10", "Names", "Index", "Names"), new("names", "Names", "M4 4h16v16H4z M7 8h10 M7 12h7 M7 16h10", "Names", "Index", "Names"),
new("point", "At This Point", "M12 3v18 M3 12h18 M12 6a6 6 0 1 0 0 12 6 6 0 0 0 0-12", "StoryPoint", "Index", "At This Point"), new("point", "At This Point", "M12 3v18 M3 12h18 M12 6a6 6 0 1 0 0 12 6 6 0 0 0 0-12", "StoryPoint", "Index", "At This Point"),
new("scenarios", "Scenarios", "M5 3v7l14 7v4 M5 10l14-5V3 M5 10v11", "Scenarios", "Index", "Scenarios"), new("scenarios", "Scenarios", "M5 3v7l14 7v4 M5 10l14-5V3 M5 10v11", "Scenarios", "Index", "Scenarios"),
new("maps", "Maps", "M3 5l6-2 6 2 6-2v16l-6 2-6-2-6 2z M9 3v16 M15 5v16", "Maps", "Index", "Maps"),
new("floorplans", "Floor Plans", "M3 3h18v18H3z M3 12h7 M14 12h7 M12 3v6 M12 15v6", "FloorPlans", "Index", "Floor Plans"), new("floorplans", "Floor Plans", "M3 3h18v18H3z M3 12h7 M14 12h7 M12 3v6 M12 15v6", "FloorPlans", "Index", "Floor Plans"),
new("bible", "Story Bible", "M12 5C8 2 4 3 2 4v16c4-2 7-1 10 1 3-2 6-3 10-1V4c-4-2-7-1-10 1v16", "StoryBible", "Index", "Story Bible"), new("bible", "Story Bible", "M12 5C8 2 4 3 2 4v16c4-2 7-1 10 1 3-2 6-3 10-1V4c-4-2-7-1-10 1v16", "StoryBible", "Index", "Story Bible"),
new("continuity", "Continuity", "M4 5h16 M4 12h16 M4 19h16 M8 3v4 M16 10v4 M10 17v4", "ContinuityExplorer", "Index", "Continuity Explorer"), new("continuity", "Continuity", "M4 5h16 M4 12h16 M4 19h16 M8 3v4 M16 10v4 M10 17v4", "ContinuityExplorer", "Index", "Continuity Explorer"),

View File

@ -31,11 +31,11 @@
{ {
<div class="alert alert-danger" role="alert">@error</div> <div class="alert alert-danger" role="alert">@error</div>
} }
<div class="location-hierarchy-toolbar" data-pwa-context="Location hierarchy" data-pwa-essential="true" data-pwa-segmented="true"> <div class="location-hierarchy-toolbar" data-pwa-context="Location hierarchy" data-pwa-essential="true">
<span class="fw-semibold">On drop:</span> <span class="fw-semibold">On drop:</span>
<div class="btn-group" role="group" aria-label="Location drag behaviour"> <div class="location-drag-commands" role="group" aria-label="Location drag behaviour">
<button type="button" class="btn btn-outline-primary btn-sm" data-location-drag-choice="parent" aria-pressed="true" title="Move a location and its children beneath a new parent; confirmation required.">Change parent</button> <button type="button" class="btn btn-outline-primary btn-sm" data-pwa-icon="merge" data-location-drag-choice="parent" aria-pressed="true" title="Move a location and its children beneath a new parent; confirmation required."><svg viewBox="0 0 24 24" aria-hidden="true"><path d="@ApplicationRibbon.Icon("merge").IconPath" /></svg><span>Change parent</span></button>
<button type="button" class="btn btn-outline-primary btn-sm" data-location-drag-choice="relationship" aria-pressed="false" title="Open the relationship editor for the two locations.">Create relationship</button> <button type="button" class="btn btn-outline-primary btn-sm" data-pwa-icon="relationships" data-location-drag-choice="relationship" aria-pressed="false" title="Open the relationship editor for the two locations."><svg viewBox="0 0 24 24" aria-hidden="true"><path d="@ApplicationRibbon.Icon("relationships").IconPath" /></svg><span>Create relationship</span></button>
</div> </div>
<input type="hidden" value="parent" data-location-drag-action /> <input type="hidden" value="parent" data-location-drag-action />
</div> </div>

View File

@ -2,7 +2,7 @@
<section class="edit-panel location-tree" data-location-tree> <section class="edit-panel location-tree" data-location-tree>
@foreach (var location in Model.Locations) @foreach (var location in Model.Locations)
{ {
<div data-pd-context="location" data-pd-context-id="@location.LocationID" data-pd-context-label="@location.LocationName" class="location-tree-row" draggable="true" data-drag-type="location" data-drag-id="@location.LocationID" data-drag-label="@location.LocationName" data-parent-location-id="@location.ParentLocationID" data-parent-location-name="@location.ParentLocationName" style="--location-depth:@location.Depth"> <div data-pd-context="location" data-pd-context-id="@location.LocationID" data-pd-context-label="@location.LocationName" class="location-tree-row" data-drag-type="location" data-drag-id="@location.LocationID" data-drag-label="@location.LocationName" data-parent-location-id="@location.ParentLocationID" data-parent-location-name="@location.ParentLocationName" style="--location-depth:@location.Depth">
<div> <div>
<a asp-action="Details" asp-route-id="@location.LocationID"><strong>@location.LocationName</strong></a> <a asp-action="Details" asp-route-id="@location.LocationID"><strong>@location.LocationName</strong></a>
@if (!string.IsNullOrWhiteSpace(location.LocationTypeName)) @if (!string.IsNullOrWhiteSpace(location.LocationTypeName))
@ -19,6 +19,9 @@
<button class="btn btn-outline-danger btn-sm" type="submit">Archive</button> <button class="btn btn-outline-danger btn-sm" type="submit">Archive</button>
</form> </form>
</div> </div>
<span class="toolbar-drag-handle location-drag-handle" draggable="true" data-location-drag-handle
role="img" aria-label="Drag @location.LocationName. To change its parent without dragging, choose Edit."
title="Drag to change parent or create a relationship. Use Edit to change parent without dragging.">⠿</span>
</div> </div>
} }
</section> </section>

View File

@ -1,6 +1,7 @@
@model WriterDashboardViewModel @model WriterDashboardViewModel
@{ @{
ViewData["Title"] = "Writer Workspace"; ViewData["Title"] = "Writer Workspace";
ViewData["ShellClass"] = "pd-writer";
var message = TempData["WriterWorkspaceMessage"] as string; var message = TempData["WriterWorkspaceMessage"] as string;
var error = TempData["WriterWorkspaceError"] as string; var error = TempData["WriterWorkspaceError"] as string;
var workspaceSeed = Model.WriteNext var workspaceSeed = Model.WriteNext

View File

@ -692,14 +692,20 @@ html[data-standalone="true"] .story-calendar-toolbar .button-row .btn {
width: auto; width: auto;
} }
/* Compact mutually exclusive choices declared by the canonical page controls. */ /* Toggle commands retain the ordinary ribbon shape, with a recessed selected state. */
.pd-shell .pd-context-segmented { align-items:center; gap:0; } .pd-shell .pd-ribbon-command[aria-pressed="true"],
.pd-shell .pd-context-segmented > .pd-ribbon-command { .location-drag-commands > button[aria-pressed="true"] {
flex-direction:row; min-width:0; min-height:32px; padding:5px 10px; background: var(--pd-selected); border: 1px solid var(--pd-border);
border:1px solid var(--pd-border); border-radius:0; box-shadow:none; box-shadow: inset 0 2px 3px color-mix(in srgb, var(--pd-text) 24%, transparent), inset 0 -1px 0 var(--pd-surface);
background:var(--pd-control); position:relative;
} }
.pd-shell .pd-context-segmented > .pd-ribbon-command:first-child { border-radius:5px 0 0 5px; } .location-drag-commands { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-shell .pd-context-segmented > .pd-ribbon-command:last-child { border-radius:0 5px 5px 0; margin-left:-1px; } .location-drag-commands > button { display: flex; align-items: center; gap: 6px; border-radius: 4px; font-family: var(--pd-font-ui); }
.pd-shell .pd-context-segmented > .pd-ribbon-command[aria-pressed=true] { background:var(--pd-selected); border-color:var(--pd-accent); z-index:1; } .location-drag-commands svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.pd-shell .pd-context-segmented > .pd-ribbon-command > svg { display:none; }
/* Writer uses the same compact hierarchy and 14px panel inset as its queue cards. */
.pd-writer { font-family: var(--pd-font-ui); }
.pd-writer .writer-dashboard-heading h1 { font: 500 clamp(26px, 2.6vw, 36px)/1.2 var(--pd-font-ui); }
.pd-writer .story-bible-section-heading h2 { font: 600 18px/1.3 var(--pd-font-ui); }
.pd-writer .writer-queue-card h3 { font-family: var(--pd-font-ui); }
.pd-writer :is(.story-bible-section, .writer-dashboard-grid) { margin-bottom: 16px; }
.pd-writer .story-bible-section > :last-child { margin-bottom: 0; }

View File

@ -468,6 +468,11 @@ td.text-end {
box-shadow: 0 10px 24px rgba(30, 37, 43, 0.04); box-shadow: 0 10px 24px rgba(30, 37, 43, 0.04);
} }
/* Separate sibling surfaces without adding space inside tables or split canvases. */
main > :is(.list-section, .plain-card, .edit-panel, .empty-panel) + :is(.list-section, .plain-card, .edit-panel, .empty-panel) {
margin-top: 16px;
}
.plain-card h2, .plain-card h2,
.empty-panel h2, .empty-panel h2,
.list-section h2 { .list-section h2 {
@ -2381,10 +2386,25 @@ body.timeline-inspector-resizing {
} }
.location-tree-row > div:first-child { .location-tree-row > div:first-child {
flex: 1;
min-width: 0;
overflow-wrap: anywhere;
display: grid; display: grid;
gap: 3px; gap: 3px;
} }
.location-drag-handle {
flex: 0 0 28px;
align-self: center;
text-align: center;
padding: 8px 0;
font-size: 24px;
line-height: 1;
user-select: none;
cursor: grab;
}
.location-drag-handle:active, .is-dragging .location-drag-handle { cursor: grabbing; }
.compact-buttons { .compact-buttons {
flex-wrap: nowrap; flex-wrap: nowrap;
} }
@ -4010,6 +4030,7 @@ body.dragging-location [data-drag-type="location"] {
} }
.story-bible-section { .story-bible-section {
padding: 14px;
margin: 0 0 28px; margin: 0 0 28px;
} }
@ -4021,6 +4042,11 @@ body.dragging-location [data-drag-type="location"] {
margin-bottom: 12px; margin-bottom: 12px;
} }
.story-bible-section-heading .soft-count {
align-self: flex-start;
flex-shrink: 0;
}
.story-bible-section-heading h2 { .story-bible-section-heading h2 {
margin: 0; margin: 0;
} }

View File

@ -70,7 +70,7 @@
const sameOperation = [...shell.querySelectorAll('.pd-ribbon-command[data-command-operation]')].find(command => command.dataset.commandOperation === operation); const sameOperation = [...shell.querySelectorAll('.pd-ribbon-command[data-command-operation]')].find(command => command.dataset.commandOperation === operation);
if (sameOperation?.dataset.ribbonIcon) return sameOperation.dataset.ribbonIcon; if (sameOperation?.dataset.ribbonIcon) return sameOperation.dataset.ribbonIcon;
const controller = operation.split('.')[0]; const controller = operation.split('.')[0];
return { characters: 'characters', locations: 'locations', storyassets: 'assets', floorplans: 'floorplans', relationshipmap: 'relationships', plotlines: 'plotlines', plotthreads: 'threads', warnings: 'warnings', analytics: 'health', projectmetrics: 'metrics', timeline: 'timeline', scenarios: 'scenarios', help: 'help', featurerequests: 'review' }[controller] || 'writer'; return { characters: 'characters', locations: 'locations', storyassets: 'assets', floorplans: 'floorplans', maps: 'maps', relationshipmap: 'relationships', plotlines: 'plotlines', plotthreads: 'threads', warnings: 'warnings', analytics: 'health', projectmetrics: 'metrics', timeline: 'timeline', scenarios: 'scenarios', help: 'help', featurerequests: 'review' }[controller] || 'writer';
} }
function decorate(node, text, key) { function decorate(node, text, key) {
const svg = icons?.querySelector(`[data-icon-key="${key}"]`)?.cloneNode(true); const svg = icons?.querySelector(`[data-icon-key="${key}"]`)?.cloneNode(true);
@ -356,7 +356,6 @@
if (region.parentElement?.closest('[data-pwa-header], [data-pwa-context]')) continue; if (region.parentElement?.closest('[data-pwa-header], [data-pwa-context]')) continue;
const label = region.dataset.pwaContext || region.dataset.pwaTools || 'Page tools'; const label = region.dataset.pwaContext || region.dataset.pwaTools || 'Page tools';
if (region.dataset.pwaEssential === 'true') group(label).element.parentElement.dataset.essential = 'true'; if (region.dataset.pwaEssential === 'true') group(label).element.parentElement.dataset.essential = 'true';
if (region.dataset.pwaSegmented === 'true') group(label).element.classList.add('pd-context-segmented');
if (region.dataset.pwaMenuIcon) group(label, 50, region.dataset.pwaCompact === 'true').icon = region.dataset.pwaMenuIcon; if (region.dataset.pwaMenuIcon) group(label, 50, region.dataset.pwaCompact === 'true').icon = region.dataset.pwaMenuIcon;
if (region.matches('[data-pwa-help]')) { helpSource ||= region.querySelector(region.matches('h1') ? '[data-help-icon]' : 'h1 [data-help-icon]'); continue; } if (region.matches('[data-pwa-help]')) { helpSource ||= region.querySelector(region.matches('h1') ? '[data-help-icon]' : 'h1 [data-help-icon]'); continue; }
const commands = region.matches('a, button') ? [region] : region.matches('[data-pwa-context]') ? [...region.querySelectorAll('a, button')] : [...region.querySelectorAll('a.btn, a.dropdown-item, button.btn, button.dropdown-item')]; const commands = region.matches('a, button') ? [region] : region.matches('[data-pwa-context]') ? [...region.querySelectorAll('a, button')] : [...region.querySelectorAll('a.btn, a.dropdown-item, button.btn, button.dropdown-item')];

View File

@ -1931,7 +1931,14 @@
}; };
const bindDraggable = (item) => { const bindDraggable = (item) => {
item.addEventListener("dragstart", (event) => writePayload(event, item)); item.addEventListener("dragstart", (event) => {
const handle = item.querySelector("[data-location-drag-handle]");
if (handle && !handle.contains(event.target)) {
event.preventDefault();
return;
}
writePayload(event, item);
});
item.addEventListener("dragend", () => { item.addEventListener("dragend", () => {
item.classList.remove("is-dragging"); item.classList.remove("is-dragging");
document.body.classList.remove("drag-active", "dragging-scene", "dragging-character", "dragging-asset", "dragging-location"); document.body.classList.remove("drag-active", "dragging-scene", "dragging-character", "dragging-asset", "dragging-location");
@ -1939,7 +1946,7 @@
clearDropHighlights(); clearDropHighlights();
}); });
}; };
document.querySelectorAll("[data-drag-type][draggable='true']").forEach(bindDraggable); document.querySelectorAll("[data-drag-type][draggable='true'], .location-tree-row[data-drag-type]").forEach(bindDraggable);
panel.querySelectorAll("[data-drag-cancel]").forEach((button) => button.addEventListener("click", hidePanel)); panel.querySelectorAll("[data-drag-cancel]").forEach((button) => button.addEventListener("click", hidePanel));
forms.get("scene")?.addEventListener("submit", saveTimelineScroll); forms.get("scene")?.addEventListener("submit", saveTimelineScroll);