@model (PlotLineListViewModel Lines, PlotThreadListViewModel Threads) @{ ViewData["Title"] = "Plot Lines"; ViewData["ProjectSection"] = "Plot Lines"; var projectId = Model.Lines.Project.ProjectID; var lines = Model.Lines.PlotLines; var lineIds = lines.Select(line => line.PlotLineID).ToHashSet(); var children = lines.ToLookup(line => line.ParentPlotLineID); var threads = Model.Threads.PlotThreads.ToLookup(thread => thread.PlotLineID); var displayed = new HashSet(); async Task RenderLineAsync(PlotLine.Models.PlotLineItem line) { if (!displayed.Add(line.PlotLineID)) { return; }
@line.PlotLineName · @(line.BookID.HasValue ? line.BookTitle ?? "Book" : "Project-wide") · @line.PlotImportanceName · @(line.IsAuthorResolved == true ? "Resolved" : "Unresolved") @if (line.ExtentStart is not null) {

@line.ExtentStart — @line.ExtentEnd

} @if (threads[line.PlotLineID].Any()) { } @foreach (var child in children[line.PlotLineID]) { await RenderLineAsync(child); }
} }

Plot Lines

@if (lines.Count == 0) {

No plot lines yet. Add a plot line to start planning.

} else { @foreach (var line in lines.Where(line => line.ParentPlotLineID is not int parent || !lineIds.Contains(parent))) { await RenderLineAsync(line); } @foreach (var line in lines.Where(line => !displayed.Contains(line.PlotLineID))) { await RenderLineAsync(line); } } @section Scripts { }