From 5b2e982a966f05d3dcb8949a5582d7f3f34a2335 Mon Sep 17 00:00:00 2001 From: Leonid Tsarev Date: Sun, 2 Feb 2025 16:35:28 +0300 Subject: [PATCH] TODO --- .../CharacterEditorPanel.razor | 114 ++++++++++++++++++ .../CharacterEdtiViewModel.cs | 6 + 2 files changed, 120 insertions(+) create mode 100644 src/JoinRpg.Web.CharacterGroups/CharacterEditorPanel.razor create mode 100644 src/JoinRpg.Web.CharacterGroups/CharacterEdtiViewModel.cs diff --git a/src/JoinRpg.Web.CharacterGroups/CharacterEditorPanel.razor b/src/JoinRpg.Web.CharacterGroups/CharacterEditorPanel.razor new file mode 100644 index 000000000..2a29a0602 --- /dev/null +++ b/src/JoinRpg.Web.CharacterGroups/CharacterEditorPanel.razor @@ -0,0 +1,114 @@ + +
@projectName :: @(creating ? "����� ��������" : "�������������� ���������")
+ +

+ +

+ + + + + + + + + + + @if (!EditTypeDisabled) + { + + } + else + { + + + if (IsDefaultTemplate) + { + + } + else if (!CharactersHaveNameField) + { + + } + else if (ActiveClaimsCount > 0) + { + + } + } + + + @if (characterType == CharacterTypeView.Slot) + { + + + + + @if (!CharactersHaveNameField) + { + + + + } + } + + @if (!HasApprovedClaim && (characterType == CharacterTypeView.Player || characterType == CharacterTypeView.Slot)) + { + + + + } + + + + + + + + +
+@code { + + private EditContext? editContext; + private bool formInvalid = true; + private bool creating = false; + private ValidationMessageStore? messageStore; + + + private string projectName = null; + + + + + [Parameter] + [EditorRequired] + [SupplyParameterFromForm] + public CharacterEdtiViewModel Model { get; set; } = null!; + + private async Task HandleValidSubmit() + { + try + { + creating = true; + var result = await Services.GetRequiredService().CreateProject(Model); + if (result.Error is null && result.ProjectId is ProjectIdentification id) + { + NavigationManager.NavigateTo($"/{id.Value}/home", forceLoad: true); + } + else + { + if (result.ProjectId is not null) + { + created = result.ProjectId; + } + messageStore?.Add(() => Model, result.Error ?? "����������� ��������� ������ ��� �������� �������"); + creating = false; + } + } + catch + { + messageStore?.Add(() => Model, "����������� ��������� ������ ��� �������� �������"); + creating = false; + } + } + +} diff --git a/src/JoinRpg.Web.CharacterGroups/CharacterEdtiViewModel.cs b/src/JoinRpg.Web.CharacterGroups/CharacterEdtiViewModel.cs new file mode 100644 index 000000000..8697f944f --- /dev/null +++ b/src/JoinRpg.Web.CharacterGroups/CharacterEdtiViewModel.cs @@ -0,0 +1,6 @@ +namespace JoinRpg.Web.CharacterGroups +{ + public class CharacterEdtiViewModel + { + } +}