Fix critical cell editor submit flow
This commit is contained in:
@@ -380,8 +380,8 @@
|
||||
return;
|
||||
}
|
||||
|
||||
editorModel = CriticalCellEditorModel.FromResponse(response);
|
||||
await LoadTableDetailAsync();
|
||||
await CloseCellEditorAsync();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
||||
@@ -17,18 +17,21 @@
|
||||
<button type="button" class="btn btn-link critical-editor-close" @onclick="OnClose">Close</button>
|
||||
</header>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(ErrorMessage))
|
||||
{
|
||||
<p class="error-text">@ErrorMessage</p>
|
||||
}
|
||||
|
||||
@if (IsLoading)
|
||||
{
|
||||
<div class="critical-editor-body">
|
||||
<p class="muted">Loading editor...</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<EditForm Model="Model" OnSubmit="HandleSubmitAsync">
|
||||
<div class="critical-editor-body">
|
||||
@if (!string.IsNullOrWhiteSpace(ErrorMessage))
|
||||
{
|
||||
<p class="error-text critical-editor-error">@ErrorMessage</p>
|
||||
}
|
||||
|
||||
<section class="critical-editor-section">
|
||||
<h4>Base Cell</h4>
|
||||
<div class="field-shell">
|
||||
@@ -37,11 +40,11 @@
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Description / Prose</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea" @bind-Value="Model.DescriptionText" />
|
||||
<InputText class="input-shell" @bind-Value="Model.DescriptionText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Affix Text</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea compact" @bind-Value="Model.RawAffixText" />
|
||||
<InputText class="input-shell" @bind-Value="Model.RawAffixText" />
|
||||
</div>
|
||||
<div class="form-grid">
|
||||
<div class="field-shell">
|
||||
@@ -50,7 +53,7 @@
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Parsed Json</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea compact" @bind-Value="Model.ParsedJson" />
|
||||
<InputTextArea class="input-shell critical-editor-textarea json" @bind-Value="Model.ParsedJson" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -115,7 +118,7 @@
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Condition Text</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea compact" @bind-Value="branch.ConditionText" />
|
||||
<InputText class="input-shell" @bind-Value="branch.ConditionText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Raw Text</label>
|
||||
@@ -123,11 +126,11 @@
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Description / Prose</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea" @bind-Value="branch.DescriptionText" />
|
||||
<InputText class="input-shell" @bind-Value="branch.DescriptionText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Affix Text</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea compact" @bind-Value="branch.RawAffixText" />
|
||||
<InputText class="input-shell" @bind-Value="branch.RawAffixText" />
|
||||
</div>
|
||||
<div class="form-grid">
|
||||
<div class="field-shell">
|
||||
@@ -136,7 +139,7 @@
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Parsed Json</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea compact" @bind-Value="branch.ParsedJson" />
|
||||
<InputTextArea class="input-shell critical-editor-textarea json" @bind-Value="branch.ParsedJson" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -169,14 +172,15 @@
|
||||
}
|
||||
</section>
|
||||
</div>
|
||||
}
|
||||
|
||||
<footer class="critical-editor-footer">
|
||||
<button type="button" class="btn btn-link" @onclick="OnClose" disabled="@IsSaving">Cancel</button>
|
||||
<button type="button" class="btn-ritual" @onclick="OnSave" disabled="@IsLoading || IsSaving">
|
||||
<button type="submit" class="btn-ritual" disabled="@IsSaving">
|
||||
@(IsSaving ? "Saving..." : "Save Cell")
|
||||
</button>
|
||||
</footer>
|
||||
</EditForm>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -205,6 +209,11 @@
|
||||
await OnClose.InvokeAsync();
|
||||
}
|
||||
|
||||
private async Task HandleSubmitAsync(EditContext _)
|
||||
{
|
||||
await OnSave.InvokeAsync();
|
||||
}
|
||||
|
||||
private void AddBaseEffect()
|
||||
{
|
||||
Model?.Effects.Add(new CriticalEffectEditorModel());
|
||||
|
||||
@@ -710,10 +710,22 @@ textarea {
|
||||
min-height: 4.5rem;
|
||||
}
|
||||
|
||||
.critical-editor-textarea.json {
|
||||
min-height: 12rem;
|
||||
}
|
||||
|
||||
.critical-editor-textarea.tall {
|
||||
min-height: 10rem;
|
||||
}
|
||||
|
||||
.critical-editor-error {
|
||||
margin: 0;
|
||||
padding: 0.85rem 0.95rem;
|
||||
border-radius: 14px;
|
||||
background: rgba(141, 43, 30, 0.08);
|
||||
border: 1px solid rgba(141, 43, 30, 0.18);
|
||||
}
|
||||
|
||||
.critical-editor-checkbox {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user