Initial commit

This commit is contained in:
2026-07-03 16:31:37 +07:00
commit 899c7c637d
1939 changed files with 641750 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
@using MudBlazor
<MudDialog>
<TitleContent>
<MudText Typo="Typo.h6">Rename @ItemType</MudText>
</TitleContent>
<DialogContent>
<MudTextField @bind-Value="NewName"
Label="@LabelText"
Placeholder="Enter new name"
Required="true"
RequiredError="Name is required"
HelperText="@HelperText"
Variant="Variant.Outlined"
FullWidth="true"
@onkeydown="HandleKeyDown" />
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel">Cancel</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="Submit">Rename</MudButton>
</DialogActions>
</MudDialog>
@code {
[CascadingParameter] IMudDialogInstance Dialog { get; set; } = null!;
[Parameter] public string CurrentName { get; set; } = string.Empty;
[Parameter] public string ItemType { get; set; } = "Item";
[Parameter] public bool RequireCsExtension { get; set; } = false;
private string NewName { get; set; } = string.Empty;
protected override void OnInitialized()
{
NewName = CurrentName;
}
private string LabelText => $"{ItemType} Name";
private string HelperText => RequireCsExtension ? "File must have .cs extension" : "";
private void Cancel() => Dialog.Cancel();
private void Submit()
{
if (string.IsNullOrWhiteSpace(NewName))
{
return;
}
var name = NewName.Trim();
if (RequireCsExtension && !name.EndsWith(".cs", StringComparison.OrdinalIgnoreCase))
{
name += ".cs";
}
if (name == CurrentName)
{
Cancel();
return;
}
Dialog.Close(DialogResult.Ok(name));
}
private void HandleKeyDown(KeyboardEventArgs e)
{
if (e.Key == "Enter")
{
Submit();
}
else if (e.Key == "Escape")
{
Cancel();
}
}
}