From d50373f4baf2218775a65c1d7ac7fbce8f1ca736 Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Sat, 12 Oct 2024 01:51:39 +0200 Subject: [PATCH] ActorRolesPanelComponent added, other fixes --- .../Roles/ActorRoleResponse.cs | 2 +- .../Roles/CreatorRoleResponse.cs | 2 +- .../Roles/IRoleResponse.cs | 9 +++ WatchIt.WebAPI/WatchIt.WebAPI/Program.cs | 9 ++- .../Model/ConfigurationData.cs | 1 + .../Model/Style.cs | 6 ++ WatchIt.Website/WatchIt.Website/App.razor | 4 +- .../MediaPage/ActorRolesPanelComponent.razor | 14 ++++ .../ActorRolesPanelComponent.razor.cs | 57 ++++++++++++++++ .../ActorRolesPanelComponent.razor.css | 0 .../MediaPage/RoleListComponent.razor | 5 ++ .../MediaPage/RoleListComponent.razor.cs | 13 ++++ .../MediaPage/RoleListComponent.razor.css | 0 .../WatchIt.Website/Layout/MainLayout.razor | 2 +- .../WatchIt.Website/Pages/MediaPage.razor | 23 +++++++ .../WatchIt.Website/_Imports.razor | 1 + .../WatchIt.Website/appsettings.json | 3 + .../WatchIt.Website/wwwroot/css/gaps.css | 17 +++++ .../WatchIt.Website/wwwroot/css/general.css | 16 ++--- .../WatchIt.Website/wwwroot/css/panel.css | 68 +++++++++++++++++++ 20 files changed, 238 insertions(+), 14 deletions(-) create mode 100644 WatchIt.Common/WatchIt.Common.Model/Roles/IRoleResponse.cs create mode 100644 WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Style.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/MediaPage/ActorRolesPanelComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/MediaPage/ActorRolesPanelComponent.razor.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/MediaPage/ActorRolesPanelComponent.razor.css create mode 100644 WatchIt.Website/WatchIt.Website/Components/MediaPage/RoleListComponent.razor create mode 100644 WatchIt.Website/WatchIt.Website/Components/MediaPage/RoleListComponent.razor.cs create mode 100644 WatchIt.Website/WatchIt.Website/Components/MediaPage/RoleListComponent.razor.css create mode 100644 WatchIt.Website/WatchIt.Website/wwwroot/css/gaps.css create mode 100644 WatchIt.Website/WatchIt.Website/wwwroot/css/panel.css diff --git a/WatchIt.Common/WatchIt.Common.Model/Roles/ActorRoleResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Roles/ActorRoleResponse.cs index 692e5a9..31d3926 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Roles/ActorRoleResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Roles/ActorRoleResponse.cs @@ -4,7 +4,7 @@ using WatchIt.Common.Query; namespace WatchIt.Common.Model.Roles; -public class ActorRoleResponse : ActorRole, IQueryOrderable +public class ActorRoleResponse : ActorRole, IQueryOrderable, IRoleResponse { #region PROPERTIES diff --git a/WatchIt.Common/WatchIt.Common.Model/Roles/CreatorRoleResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Roles/CreatorRoleResponse.cs index 986989d..d0611ea 100644 --- a/WatchIt.Common/WatchIt.Common.Model/Roles/CreatorRoleResponse.cs +++ b/WatchIt.Common/WatchIt.Common.Model/Roles/CreatorRoleResponse.cs @@ -4,7 +4,7 @@ using WatchIt.Common.Query; namespace WatchIt.Common.Model.Roles; -public class CreatorRoleResponse : CreatorRole, IQueryOrderable +public class CreatorRoleResponse : CreatorRole, IQueryOrderable, IRoleResponse { #region PROPERTIES diff --git a/WatchIt.Common/WatchIt.Common.Model/Roles/IRoleResponse.cs b/WatchIt.Common/WatchIt.Common.Model/Roles/IRoleResponse.cs new file mode 100644 index 0000000..dbd62e3 --- /dev/null +++ b/WatchIt.Common/WatchIt.Common.Model/Roles/IRoleResponse.cs @@ -0,0 +1,9 @@ +namespace WatchIt.Common.Model.Roles; + +public interface IRoleResponse +{ + Guid Id { get; set; } + long MediaId { get; set; } + long PersonId { get; set; } + short TypeId { get; set; } +} \ No newline at end of file diff --git a/WatchIt.WebAPI/WatchIt.WebAPI/Program.cs b/WatchIt.WebAPI/WatchIt.WebAPI/Program.cs index 7d987e4..d6c6797 100644 --- a/WatchIt.WebAPI/WatchIt.WebAPI/Program.cs +++ b/WatchIt.WebAPI/WatchIt.WebAPI/Program.cs @@ -42,7 +42,14 @@ public static class Program using (IServiceScope scope = app.Services.CreateScope()) { - scope.ServiceProvider.GetService().Database.Migrate(); + DatabaseContext dbContext = scope.ServiceProvider.GetRequiredService(); + + while (!dbContext.Database.CanConnect()) + { + Thread.Sleep(1000); + } + + dbContext.Database.Migrate(); } if (app.Environment.IsDevelopment()) diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/ConfigurationData.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/ConfigurationData.cs index cac866a..7709295 100644 --- a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/ConfigurationData.cs +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/ConfigurationData.cs @@ -5,5 +5,6 @@ public class ConfigurationData public Logging Logging { get; set; } public string AllowedHosts { get; set; } public StorageKeys StorageKeys { get; set; } + public Style Style { get; set; } public Endpoints Endpoints { get; set; } } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Style.cs b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Style.cs new file mode 100644 index 0000000..00abcbd --- /dev/null +++ b/WatchIt.Website/WatchIt.Website.Services/WatchIt.Website.Services.Utility/WatchIt.Website.Services.Utility.Configuration/Model/Style.cs @@ -0,0 +1,6 @@ +namespace WatchIt.Website.Services.Utility.Configuration.Model; + +public class Style +{ + public int DefaultPanelPadding { get; set; } +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/App.razor b/WatchIt.Website/WatchIt.Website/App.razor index 059458f..de1a4c4 100644 --- a/WatchIt.Website/WatchIt.Website/App.razor +++ b/WatchIt.Website/WatchIt.Website/App.razor @@ -9,8 +9,10 @@ - + + + diff --git a/WatchIt.Website/WatchIt.Website/Components/MediaPage/ActorRolesPanelComponent.razor b/WatchIt.Website/WatchIt.Website/Components/MediaPage/ActorRolesPanelComponent.razor new file mode 100644 index 0000000..be9ddba --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/MediaPage/ActorRolesPanelComponent.razor @@ -0,0 +1,14 @@ +@using WatchIt.Common.Model.Roles +
+
+ Actors + @if (_loaded) + { + + } + else + { + + } +
+
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/MediaPage/ActorRolesPanelComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/MediaPage/ActorRolesPanelComponent.razor.cs new file mode 100644 index 0000000..ab64709 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/MediaPage/ActorRolesPanelComponent.razor.cs @@ -0,0 +1,57 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Roles; +using WatchIt.Website.Services.Utility.Configuration; +using WatchIt.Website.Services.WebAPI.Media; + +namespace WatchIt.Website.Components.MediaPage; + +public partial class ActorRolesPanelComponent : ComponentBase +{ + #region SERVICES + + [Inject] private IMediaWebAPIService MediaWebAPIService { get; set; } = default!; + + #endregion + + + + #region PARAMETERS + + [Parameter] public string Class { get; set; } = string.Empty; + [Parameter] public required long Id { get; set; } + + #endregion + + + + #region FIELDS + + private bool _loaded; + + private IEnumerable _roles = []; + + #endregion + + + + #region PUBLIC METHODS + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + List endTasks = new List(); + + // STEP 0 + endTasks.AddRange( + [ + MediaWebAPIService.GetMediaAllActorRoles(Id, successAction: data => _roles = data) + ]); + + // END + await Task.WhenAll(endTasks); + + _loaded = true; + StateHasChanged(); + } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/MediaPage/ActorRolesPanelComponent.razor.css b/WatchIt.Website/WatchIt.Website/Components/MediaPage/ActorRolesPanelComponent.razor.css new file mode 100644 index 0000000..e69de29 diff --git a/WatchIt.Website/WatchIt.Website/Components/MediaPage/RoleListComponent.razor b/WatchIt.Website/WatchIt.Website/Components/MediaPage/RoleListComponent.razor new file mode 100644 index 0000000..09cba8c --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/MediaPage/RoleListComponent.razor @@ -0,0 +1,5 @@ +@typeparam TRole where TRole : WatchIt.Common.Model.Roles.IRoleResponse + +
+ +
\ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/MediaPage/RoleListComponent.razor.cs b/WatchIt.Website/WatchIt.Website/Components/MediaPage/RoleListComponent.razor.cs new file mode 100644 index 0000000..d0ea30a --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/Components/MediaPage/RoleListComponent.razor.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Components; +using WatchIt.Common.Model.Roles; + +namespace WatchIt.Website.Components.MediaPage; + +public partial class RoleListComponent : ComponentBase where TRole : IRoleResponse +{ + #region PROPERTIES + + [Parameter] public required IEnumerable Role { get; set; } + + #endregion +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/Components/MediaPage/RoleListComponent.razor.css b/WatchIt.Website/WatchIt.Website/Components/MediaPage/RoleListComponent.razor.css new file mode 100644 index 0000000..e69de29 diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor index 6e23112..d6e9886 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor @@ -12,7 +12,7 @@
-
+
diff --git a/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor b/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor index 6c144cc..1e5ac8e 100644 --- a/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor +++ b/WatchIt.Website/WatchIt.Website/Pages/MediaPage.razor @@ -190,6 +190,29 @@ else
+
+
+ + + Actors + Creators + + + +
+ +
+
+ + Test2 + +
+
+
+
} else { diff --git a/WatchIt.Website/WatchIt.Website/_Imports.razor b/WatchIt.Website/WatchIt.Website/_Imports.razor index 41dfd4d..6a1890c 100644 --- a/WatchIt.Website/WatchIt.Website/_Imports.razor +++ b/WatchIt.Website/WatchIt.Website/_Imports.razor @@ -11,6 +11,7 @@ @using WatchIt.Website.Components @using WatchIt.Website.Components.PersonEditPage @using WatchIt.Website.Components.MediaEditPage +@using WatchIt.Website.Components.MediaPage @using WatchIt.Common.Model.Accounts @using WatchIt.Common.Model.Media @using WatchIt.Website.Services.Utility.Tokens diff --git a/WatchIt.Website/WatchIt.Website/appsettings.json b/WatchIt.Website/WatchIt.Website/appsettings.json index aa46c17..e9ee01b 100644 --- a/WatchIt.Website/WatchIt.Website/appsettings.json +++ b/WatchIt.Website/WatchIt.Website/appsettings.json @@ -10,6 +10,9 @@ "AccessToken": "access_token", "RefreshToken": "refresh_token" }, + "Style": { + "DefaultPanelPadding": 4 + }, "Endpoints": { "Base": "https://localhost:7160", "Accounts": { diff --git a/WatchIt.Website/WatchIt.Website/wwwroot/css/gaps.css b/WatchIt.Website/WatchIt.Website/wwwroot/css/gaps.css new file mode 100644 index 0000000..9f37147 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/wwwroot/css/gaps.css @@ -0,0 +1,17 @@ +/* DEFAULT */ + +.mt-default { + margin-top: 1rem !important; +} + +.gx-default { + --bs-gutter-x: 1rem !important; +} + + + +/* OTHERS */ + +.mt-over-panel-menu { + margin-top: 3rem !important; +} \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/wwwroot/css/general.css b/WatchIt.Website/WatchIt.Website/wwwroot/css/general.css index 263c518..3ac06ff 100644 --- a/WatchIt.Website/WatchIt.Website/wwwroot/css/general.css +++ b/WatchIt.Website/WatchIt.Website/wwwroot/css/general.css @@ -25,6 +25,8 @@ body, html { font-family: "PT Sans"; } + + /* CLASSES */ .container-grid { @@ -53,6 +55,8 @@ body, html { + + .top-3 { top: 1rem !important; } @@ -69,22 +73,16 @@ body, html { margin-top: 9rem !important; } -.panel-header { - background-color: rgba(0, 0, 0, 0.8); -} .panel-regular { - background-color: rgba(0, 0, 0, 0.6); + background-color: rgba(0, 0, 0, 0.6) !important; } .panel-yellow { - background-color: rgba(255, 184, 58, 0.6); + background-color: rgba(255, 184, 58, 0.6) !important; } -.panel { - box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); - backdrop-filter: blur(25px); -} + diff --git a/WatchIt.Website/WatchIt.Website/wwwroot/css/panel.css b/WatchIt.Website/WatchIt.Website/wwwroot/css/panel.css new file mode 100644 index 0000000..0e200f3 --- /dev/null +++ b/WatchIt.Website/WatchIt.Website/wwwroot/css/panel.css @@ -0,0 +1,68 @@ +/* MAIN */ + +.panel { + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); + backdrop-filter: blur(25px); + + background-color: rgba(0, 0, 0, 0.6); + + border-radius: 0.5rem; + padding: 1.5rem; +} + + + +/* HEADER */ + +.panel-header { + padding: 0 1rem !important; + + background-color: rgba(0, 0, 0, 0.8); +} + + + +/* MENU */ + +.panel-menu { + gap: 1rem; + padding: 1rem 1.5rem !important; + + background-color: rgba(0, 0, 0, 0.8); +} + +.panel-menu > li > a { + --bs-nav-pills-link-active-bg: transparent; + --bs-nav-link-hover-color: white; + --bs-nav-link-color: #a6a6a6; + + --bs-nav-pills-border-radius: 1.25rem; + + padding: 0.25rem 0.5rem; + + border-style: solid; + border-width: 2px; + border-color: transparent; +} + +.panel-menu > li > a.active { + --bs-nav-link-color: white; + border-color: white; +} + + + +/* BACKGROUNDS */ + +.panel-background-gold { + background-color: rgba(255, 184, 58, 0.6); +} + + + +/* OTHERS */ + +.panel-text-title { + font-size: 1.5rem; + font-weight: bold; +} \ No newline at end of file