diff --git a/HopFrame.Web/HopFrame.Web.csproj b/HopFrame.Web/HopFrame.Web.csproj index bf50cd4..00f64c3 100644 --- a/HopFrame.Web/HopFrame.Web.csproj +++ b/HopFrame.Web/HopFrame.Web.csproj @@ -17,6 +17,8 @@ + + diff --git a/HopFrame.Web/Pages/Administration/Layout/AdminLayout.razor b/HopFrame.Web/Pages/Administration/Layout/AdminLayout.razor index 4ea3d74..758e3d0 100644 --- a/HopFrame.Web/Pages/Administration/Layout/AdminLayout.razor +++ b/HopFrame.Web/Pages/Administration/Layout/AdminLayout.razor @@ -1,24 +1,23 @@ @using HopFrame.Web.Components +@using BlazorStrap.V5 @inherits LayoutComponentBase + +
- +
@Body +
-
- An unhandled error has occurred. - Reload - 🗙 -
- + diff --git a/HopFrame.Web/Pages/Administration/Layout/AdminLayout.razor.css b/HopFrame.Web/Pages/Administration/Layout/AdminLayout.razor.css deleted file mode 100644 index d49e4b7..0000000 --- a/HopFrame.Web/Pages/Administration/Layout/AdminLayout.razor.css +++ /dev/null @@ -1,96 +0,0 @@ -.page { - position: relative; - display: flex; - flex-direction: column; -} - -main { - flex: 1; -} - -.sidebar { - background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); -} - -.top-row { - background-color: #f7f7f7; - border-bottom: 1px solid #d6d5d5; - justify-content: flex-end; - height: 3.5rem; - display: flex; - align-items: center; -} - -.top-row ::deep a, .top-row ::deep .btn-link { - white-space: nowrap; - margin-left: 1.5rem; - text-decoration: none; -} - -.top-row ::deep a:hover, .top-row ::deep .btn-link:hover { - text-decoration: underline; -} - -.top-row ::deep a:first-child { - overflow: hidden; - text-overflow: ellipsis; -} - -@media (max-width: 640.98px) { - .top-row { - justify-content: space-between; - } - - .top-row ::deep a, .top-row ::deep .btn-link { - margin-left: 0; - } -} - -@media (min-width: 641px) { - .page { - flex-direction: row; - } - - .sidebar { - width: 250px; - height: 100vh; - position: sticky; - top: 0; - } - - .top-row { - position: sticky; - top: 0; - z-index: 1; - } - - .top-row.auth ::deep a:first-child { - flex: 1; - text-align: right; - width: 0; - } - - .top-row, article { - padding-left: 2rem !important; - padding-right: 1.5rem !important; - } -} - -#blazor-error-ui { - background: lightyellow; - bottom: 0; - box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); - display: none; - left: 0; - padding: 0.6rem 1.25rem 0.7rem 1.25rem; - position: fixed; - width: 100%; - z-index: 1000; -} - -#blazor-error-ui .dismiss { - cursor: pointer; - position: absolute; - right: 0.75rem; - top: 0.5rem; -} diff --git a/HopFrame.Web/Pages/Administration/Layout/AdminMenu.razor b/HopFrame.Web/Pages/Administration/Layout/AdminMenu.razor index 68690bd..18a272c 100644 --- a/HopFrame.Web/Pages/Administration/Layout/AdminMenu.razor +++ b/HopFrame.Web/Pages/Administration/Layout/AdminMenu.razor @@ -1,32 +1,38 @@ -@using Microsoft.AspNetCore.Components.Routing -@using HopFrame.Web.Pages.Administration.Components +@using BlazorStrap +@using BlazorStrap.V5 - - + + + + @*logo*@ + HopFrame + + + + + + + + @foreach (var nav in Subpages) { + @nav.Value + } + + + + + - \ No newline at end of file +@code { + public static IDictionary Subpages = new Dictionary { + { "administration/users", "Users" }, + { "administration/groups", "Groups" } + }; + + public bool IsNavItemActive(string element) { + return Navigator.Uri.Contains(element); + } +} diff --git a/HopFrame.Web/Pages/Administration/Layout/AdminMenu.razor.css b/HopFrame.Web/Pages/Administration/Layout/AdminMenu.razor.css deleted file mode 100644 index 7a71600..0000000 --- a/HopFrame.Web/Pages/Administration/Layout/AdminMenu.razor.css +++ /dev/null @@ -1,93 +0,0 @@ -.navbar-toggler { - appearance: none; - cursor: pointer; - width: 3.5rem; - height: 2.5rem; - color: white; - position: absolute; - top: 0.5rem; - right: 1rem; - border: 1px solid rgba(255, 255, 255, 0.1); - background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1); -} - -.navbar-toggler:checked { - background-color: rgba(255, 255, 255, 0.5); -} - -.top-row { - height: 3.5rem; - background-color: rgba(0, 0, 0, 0.4); -} - -.navbar-brand { - font-size: 1.1rem; -} - -.bi { - display: inline-block; - position: relative; - width: 1.25rem; - height: 1.25rem; - margin-right: 0.75rem; - top: -1px; - background-size: cover; -} - -.nav-item { - font-size: 0.9rem; - padding-bottom: 0.5rem; -} - -.nav-item:first-of-type { - padding-top: 1rem; -} - -.nav-item:last-of-type { - padding-bottom: 1rem; -} - -.nav-item ::deep .nav-link { - color: #d7d7d7; - background: none; - border: none; - border-radius: 4px; - height: 3rem; - display: flex; - align-items: center; - line-height: 3rem; - width: 100%; -} - -.nav-item ::deep a.active { - background-color: rgba(255, 255, 255, 0.37); - color: white; -} - -.nav-item ::deep .nav-link:hover { - background-color: rgba(255, 255, 255, 0.1); - color: white; -} - -.nav-scrollable { - display: none; -} - -.navbar-toggler:checked ~ .nav-scrollable { - display: block; -} - -@media (min-width: 641px) { - .navbar-toggler { - display: none; - } - - .nav-scrollable { - /* Never collapse the sidebar for wide screens */ - display: block; - - /* Allow sidebar to scroll for tall menus */ - height: calc(100vh - 3.5rem); - overflow-y: auto; - } -} diff --git a/HopFrame.Web/Pages/Administration/UsersPage.razor b/HopFrame.Web/Pages/Administration/UsersPage.razor index 1d61529..a1805db 100644 --- a/HopFrame.Web/Pages/Administration/UsersPage.razor +++ b/HopFrame.Web/Pages/Administration/UsersPage.razor @@ -3,6 +3,7 @@ @layout AdminLayout @using System.Globalization +@using BlazorStrap @using CurrieTechnologies.Razor.SweetAlert2 @using HopFrame.Database.Models @using HopFrame.Security.Claims @@ -11,6 +12,8 @@ @using static Microsoft.AspNetCore.Components.Web.RenderMode @using Microsoft.AspNetCore.Components.Web @using HopFrame.Web.Components +@using BlazorStrap.V5 +@using HopFrame.Web.Pages.Administration.Components Users @@ -22,69 +25,69 @@ - + - - - - - - - - - - - @if (_hasEditPrivileges || _hasDeletePrivileges) { - - } - - - - @foreach (var user in _users) { - - - - - - + + + + # + + E-Mail + @if (_currentOrder == OrderType.Email) { + + } + + + Username + @if (_currentOrder == OrderType.Username) { + + } + + + Registered + @if (_currentOrder == OrderType.Registered) { + + } + + Primary Group @if (_hasEditPrivileges || _hasDeletePrivileges) { - + Actions } - - } - -
# - E-Mail - @if (_currentOrder == OrderType.Email) { - - } - - Username - @if (_currentOrder == OrderType.Username) { - - } - - Registered - @if (_currentOrder == OrderType.Registered) { - - } - Primary GroupActions
@user.Id@user.Email@user.Username@user.CreatedAt@GetFriendlyGroupName(user) -
- @if (_hasEditPrivileges) { - - } - - @if (_hasDeletePrivileges) { - - } -
-
+ + + + + @foreach (var user in _users) { + + @user.Id + @user.Email + @user.Username + @user.CreatedAt + @GetFriendlyGroupName(user) + + @if (_hasEditPrivileges || _hasDeletePrivileges) { + + + @if (_hasEditPrivileges) { + Edit + } + + @if (_hasDeletePrivileges) { + Delete + } + + + } + + } + + @inject IUserService UserService @inject IPermissionService PermissionsService @@ -94,7 +97,7 @@ @code { private IList _users = new List(); - private IDictionary _userGroups = new Dictionary(); + private readonly IDictionary _userGroups = new Dictionary(); private OrderType _currentOrder = OrderType.None; private OrderDirection _currentOrderDirection = OrderDirection.Asc; @@ -193,8 +196,7 @@ None, Email, Username, - Registered, - Group + Registered } private enum OrderDirection : byte { diff --git a/HopFrame.Web/ServiceCollectionExtensions.cs b/HopFrame.Web/ServiceCollectionExtensions.cs index d98b951..c57d416 100644 --- a/HopFrame.Web/ServiceCollectionExtensions.cs +++ b/HopFrame.Web/ServiceCollectionExtensions.cs @@ -1,3 +1,4 @@ +using BlazorStrap; using CurrieTechnologies.Razor.SweetAlert2; using HopFrame.Database; using HopFrame.Security.Authentication; @@ -16,6 +17,7 @@ public static class ServiceCollectionExtensions { // Component library's services.AddSweetAlert2(); + services.AddBlazorStrap(); //TODO: Use https://blazorstrap.io/V5/V5 diff --git a/HopFrame.sln.DotSettings.user b/HopFrame.sln.DotSettings.user index 3b58ba2..f66ed72 100644 --- a/HopFrame.sln.DotSettings.user +++ b/HopFrame.sln.DotSettings.user @@ -1,4 +1,5 @@  <AssemblyExplorer> <Assembly Path="C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\7.0.16\ref\net7.0\System.ComponentModel.Annotations.dll" /> + <Assembly Path="C:\Users\Remote\.nuget\packages\blazorstrap\5.2.100.61524\lib\net7.0\BlazorStrap.dll" /> </AssemblyExplorer> \ No newline at end of file