Add manual critical table cell editor

This commit is contained in:
2026-03-14 15:09:16 +01:00
parent 4e518244a2
commit 6e28ad975f
16 changed files with 1105 additions and 27 deletions

View File

@@ -0,0 +1,63 @@
using RolemasterDb.App.Features;
namespace RolemasterDb.App.Components.Shared;
public sealed class CriticalCellEditorModel
{
public int ResultId { get; set; }
public string TableSlug { get; set; } = string.Empty;
public string TableName { get; set; } = string.Empty;
public string SourceDocument { get; set; } = string.Empty;
public string RollBand { get; set; } = string.Empty;
public string? GroupKey { get; set; }
public string? GroupLabel { get; set; }
public string ColumnKey { get; set; } = string.Empty;
public string ColumnLabel { get; set; } = string.Empty;
public string ColumnRole { get; set; } = string.Empty;
public string RawCellText { get; set; } = string.Empty;
public string DescriptionText { get; set; } = string.Empty;
public string? RawAffixText { get; set; }
public string ParseStatus { get; set; } = string.Empty;
public string ParsedJson { get; set; } = "{}";
public List<CriticalEffectEditorModel> Effects { get; set; } = [];
public List<CriticalBranchEditorModel> Branches { get; set; } = [];
public static CriticalCellEditorModel FromResponse(CriticalCellEditorResponse response) =>
new()
{
ResultId = response.ResultId,
TableSlug = response.TableSlug,
TableName = response.TableName,
SourceDocument = response.SourceDocument,
RollBand = response.RollBand,
GroupKey = response.GroupKey,
GroupLabel = response.GroupLabel,
ColumnKey = response.ColumnKey,
ColumnLabel = response.ColumnLabel,
ColumnRole = response.ColumnRole,
RawCellText = response.RawCellText,
DescriptionText = response.DescriptionText,
RawAffixText = response.RawAffixText,
ParseStatus = response.ParseStatus,
ParsedJson = response.ParsedJson,
Effects = response.Effects.Select(CriticalEffectEditorModel.FromItem).ToList(),
Branches = response.Branches.Select(CriticalBranchEditorModel.FromItem).ToList()
};
public CriticalCellUpdateRequest ToRequest() =>
new(
RawCellText,
DescriptionText,
RawAffixText,
ParseStatus,
ParsedJson,
Effects.Select(effect => effect.ToItem()).ToList(),
Branches
.OrderBy(branch => branch.SortOrder)
.Select((branch, index) =>
{
branch.SortOrder = index + 1;
return branch.ToItem();
})
.ToList());
}