diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor index fe0612b..49c858c 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor @@ -1,4 +1,5 @@ @using Blazored.FluentValidation +@using GameIdeas.BlazorApp.Shared.Components.CircleLoader @using GameIdeas.BlazorApp.Shared.Components.SelectSearch @using GameIdeas.BlazorApp.Shared.Components.Slider @using GameIdeas.Shared.Dto @@ -22,14 +23,14 @@
@ResourcesKey.Developers :
+ Items="Categories?.Developers" @bind-Values=GameDto.Developers + AddItem="@(str => new DeveloperDto() { Name = str })" />
@ResourcesKey.Publishers :
+ Items="Categories?.Publishers" @bind-Values=GameDto.Publishers + AddItem="@(str => new PublisherDto() { Name = str })" />
@@ -42,21 +43,21 @@
@ResourcesKey.Properties :
+ Items="Categories?.Properties" @bind-Values=GameDto.Properties + AddItem="@(str => new PropertyDto() { Label = str })" />
@ResourcesKey.Tags :
+ Items="Categories?.Tags" @bind-Values=GameDto.Tags + AddItem="@(str => new TagDto() { Label = str })" />
@ResourcesKey.Platforms :
+ Items="Categories?.Platforms" @bind-Values=GameDto.Platforms + AddItem="@(str => new PlatformDto() { Label = str })" />
@foreach (var platform in GameDto.Platforms ?? []) @@ -75,13 +76,18 @@
-
- - +
+ + +
-
- \ No newline at end of file + + +@if (IsLoading) +{ + +} \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.cs index d9384cb..9911a85 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.cs @@ -20,22 +20,18 @@ public partial class GameCreationForm private EditContext? EditContext; private readonly SelectTheme Theme = SelectTheme.Creation; private readonly SliderParams SliderParams = new() { Gap = 1, Min = 1, Max = 5 }; + private bool IsLoading = true; protected override async Task OnInitializedAsync() { EditContext = new(GameDto); - - if (Popup != null) - { - Popup.StateChanged += async (_, isOpen) => await HandlePopupStateChanged(); - } - await base.OnInitializedAsync(); } - private async Task HandlePopupStateChanged() + protected override async Task OnAfterRenderAsync(bool firstRender) { await Js.InvokeVoidAsync("resizeGameForm"); + } private void HandleOnCancel() @@ -50,6 +46,10 @@ public partial class GameCreationForm return; } + IsLoading = true; + await GameGateway.CreateGame(GameDto); + + IsLoading = false; } } \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.css index cb261c1..f1fb03f 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameCreationForm.razor.css @@ -78,7 +78,6 @@ height: 28px; display: flex; flex-direction: row; - justify-content: space-between; align-items: center; } @@ -98,6 +97,7 @@ } .buttons { + margin-left: auto; height: 100%; display: flex; flex-direction: row; @@ -112,4 +112,9 @@ color: var(--white); font-weight: bold; padding: 0 10px; + cursor: pointer; +} + +.buttons button:hover { + background: var(--violet-selected); } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor index e32a814..404ea88 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/GameBase.razor @@ -24,6 +24,6 @@
- + diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/BackdropFilter/BackdropFilter.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/BackdropFilter/BackdropFilter.razor.css index cc30289..76a6919 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/BackdropFilter/BackdropFilter.razor.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/BackdropFilter/BackdropFilter.razor.css @@ -1,5 +1,5 @@ .backdrop-filter { - position: absolute; + position: fixed; top: 0; left: 0; width: 100%; diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/CircleLoader/CircleLoader.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/CircleLoader/CircleLoader.razor new file mode 100644 index 0000000..1af8145 --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/CircleLoader/CircleLoader.razor @@ -0,0 +1,3 @@ +
+ + diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/CircleLoader/CircleLoader.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/CircleLoader/CircleLoader.razor.css new file mode 100644 index 0000000..6eee889 --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/CircleLoader/CircleLoader.razor.css @@ -0,0 +1,31 @@ +.overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + align-items: center; + justify-content: center; + z-index: var(--overlay); +} + +.loader { + border: 8px solid var(--violet-selected); + border-top: 8px solid var(--violet); + border-radius: 50%; + width: 60px; + height: 60px; + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } +} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Popup.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Popup.razor index 237fac8..fb626b3 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Popup.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Popup/Popup.razor @@ -2,15 +2,18 @@ @using GameIdeas.BlazorApp.Shared.Constants -