Skip to content

Commit 51a2e20

Browse files
committed
Make KeyEditorDialog larger and fix grid refresh on data changes
- Dialog now 95% width (max 1400px) and 90vh height - Add grid.Reload() after AddPluralForm - Add grid.Reload() after RemovePluralForm - Add grid.Reload() after ConfirmConversion (single/plural toggle) - Add grid.Reload() after HandleTranslate
1 parent 95a0655 commit 51a2e20

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

cloud/src/LrmCloud.Web/Components/KeyEditorDialog.razor

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@inject Radzen.DialogService DialogService
77
@inject IJSRuntime JS
88

9-
<RadzenStack Gap="1rem">
9+
<RadzenStack Gap="1rem" Style="height: calc(90vh - 100px); display: flex; flex-direction: column;">
1010
@* Key Type Toggle *@
1111
@if (SupportsPluralKeys)
1212
{
@@ -90,7 +90,7 @@
9090
Density="Density.Compact"
9191
AllowSorting="false"
9292
AllowPaging="false"
93-
Style="max-height: 400px; overflow-y: auto;">
93+
Style="flex: 1; min-height: 200px; overflow-y: auto;">
9494
<Columns>
9595
@* Language Column *@
9696
<RadzenDataGridColumn TItem="EditableTranslationRow" Title="Lang" Width="70px" Frozen="true">
@@ -361,16 +361,16 @@
361361
private IEnumerable<string> GetAvailablePluralForms() =>
362362
PluralForms.All.Where(pf => !_activePluralForms.Contains(pf));
363363

364-
private void OnPluralFormSelected(object value)
364+
private async Task OnPluralFormSelected(object value)
365365
{
366366
if (value is string form && !string.IsNullOrEmpty(form))
367367
{
368-
AddPluralForm(form);
368+
await AddPluralForm(form);
369369
_selectedPluralForm = null;
370370
}
371371
}
372372

373-
private void AddPluralForm(string pluralForm)
373+
private async Task AddPluralForm(string pluralForm)
374374
{
375375
_activePluralForms.Add(pluralForm);
376376
foreach (var lang in Languages)
@@ -389,10 +389,11 @@
389389
}
390390
}
391391
BuildEditableRows();
392+
if (_grid != null) await _grid.Reload();
392393
NotificationService.Notify(NotificationSeverity.Info, "Added", $"Added '{pluralForm}' plural form");
393394
}
394395

395-
private void RemovePluralForm(string pluralForm)
396+
private async Task RemovePluralForm(string pluralForm)
396397
{
397398
if (pluralForm == PluralForms.Other)
398399
{
@@ -411,6 +412,7 @@
411412
}
412413
}
413414
BuildEditableRows();
415+
if (_grid != null) await _grid.Reload();
414416
NotificationService.Notify(NotificationSeverity.Info, "Removed", $"Removed '{pluralForm}' plural form");
415417
}
416418

@@ -449,7 +451,7 @@
449451
_displayIsPlural = Row.IsPlural;
450452
}
451453

452-
private void ConfirmConversion()
454+
private async Task ConfirmConversion()
453455
{
454456
_showConversionConfirm = false;
455457

@@ -523,6 +525,7 @@
523525

524526
Row.IsPlural = _pendingIsPlural;
525527
BuildEditableRows();
528+
if (_grid != null) await _grid.Reload();
526529
NotificationService.Notify(NotificationSeverity.Success, "Converted", $"Converted to {(_pendingIsPlural ? "plural" : "single")} key");
527530
}
528531

@@ -661,7 +664,8 @@
661664
{
662665
SyncRowsBackToTranslations();
663666
await OnTranslate.InvokeAsync(Row);
664-
BuildEditableRows(); // Refresh after translation
667+
BuildEditableRows();
668+
if (_grid != null) await _grid.Reload();
665669
}
666670
finally
667671
{

cloud/src/LrmCloud.Web/Pages/Projects/Editor.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ else
658658
{ "SupportsPluralKeys", SupportsPluralKeys },
659659
{ "OnTranslate", EventCallback.Factory.Create<TranslationGridRow>(this, TranslateKeyInDialog) }
660660
},
661-
new Radzen.DialogOptions { Width = "1000px", Height = "90vh" });
661+
new Radzen.DialogOptions { Width = "95%", Height = "90vh", Style = "max-width: 1400px;" });
662662

663663
if (result is TranslationGridRow editedRow)
664664
{

0 commit comments

Comments
 (0)