Skip to content

Commit

Permalink
Group signed out pages
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisreimann committed Apr 17, 2024
1 parent 399b8d6 commit 1f42ad3
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 76 deletions.
4 changes: 3 additions & 1 deletion BTCPayApp.UI/Layout/SimpleLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
}
<main id="MainContent">
<SectionOutlet SectionName="main-top"/>
@Body
<div class="container">
@Body
</div>
<SectionOutlet SectionName="main-bottom"/>
</main>
<SectionOutlet SectionName="bottom" />
Expand Down
2 changes: 1 addition & 1 deletion BTCPayApp.UI/Layout/SimpleLayout.razor.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.container {
#SimpleLayout {
--logo-height: 5rem;
--padding-vertical: 15vh;

Expand Down
88 changes: 46 additions & 42 deletions BTCPayApp.UI/Pages/DashboardPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,58 +18,62 @@
<section class="container">
@if (IsInitialized && !IsLoading)
{
<AuthorizeView>
<Authorized>
<h1>Hello, @context.User.Identity?.Name!</h1>
<AuthorizeView>
<Authorized>
<h1>Hello, @context.User.Identity?.Name!</h1>

@if (_userInfo != null)
{
<div class="mb-4">
ID: @_userInfo.UserId<br />
Email: @_userInfo.Email<br />
Roles: @(_userInfo.Roles?.Any() is true ? string.Join(", ", _userInfo.Roles) : "none")
</div>

if (_userInfo.Stores?.Any() is true)
{
<ul>
@foreach (var store in _userInfo.Stores)
@if (_userInfo != null)
{
<li>
<div>
<strong>@store.Name</strong>
<span class="badge bg-light">@store.RoleId</span>
@if (store.Archived)
{
<span class="badge bg-info">archived</span>
}
<div class="mb-4">
ID: @_userInfo.UserId<br />
Email: @_userInfo.Email<br />
Roles: @(_userInfo.Roles?.Any() is true ? string.Join(", ", _userInfo.Roles) : "none")
</div>
<div></div>

@if (store.Permissions?.Any() is true)
if (_userInfo.Stores?.Any() is true)
{
<ul>
@foreach (var permission in store.Permissions)
{
<li>@permission</li>
}
</ul>
<ul>
@foreach (var store in _userInfo.Stores)
{
<li>
<div>
<strong>@store.Name</strong>
<span class="badge bg-light">@store.RoleId</span>
@if (store.Archived)
{
<span class="badge bg-info">archived</span>
}
</div>
<div></div>

@if (store.Permissions?.Any() is true)
{
<ul>
@foreach (var permission in store.Permissions)
{
<li>@permission</li>
}
</ul>
}
else
{
<div class="text-secondary">No permissions</div>
}
</li>
}
</ul>
}
else
{
<div class="text-secondary">No permissions</div>
<p class="text-secondary">No stores</p>
}
</li>
}
</ul>
}
else
{
<p class="text-secondary">No stores</p>
}
}
</Authorized>
</AuthorizeView>

<NavLink class="btn btn-outline-danger" href="@Routes.Logout" Match="NavLinkMatch.All">
<span>Logout</span>
</NavLink>
</Authorized>
</AuthorizeView>

@*if (State.Value.PairConfig is null && State.Value.WalletConfig is null)
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@

<PageTitle>@GetTitle()</PageTitle>

<SectionContent SectionName="main-top">
<h1>@GetTitle()</h1>
@if (!string.IsNullOrEmpty(_errorMessage))
{
<div class="alert alert-danger mb-3">@_errorMessage</div>
}
else if (!string.IsNullOrEmpty(_successMessage))
{
<div class="alert alert-success mb-3">@_successMessage</div>
}
</SectionContent>

<EditForm Model="@Model" OnValidSubmit="HandleValidSubmit" FormName="ForgotPassword" method="post">
<DataAnnotationsValidator />
<div class="mb-3">
Expand Down Expand Up @@ -56,18 +68,6 @@
}
</EditForm>

<SectionContent SectionName="main-top">
<h1>@GetTitle()</h1>
@if (!string.IsNullOrEmpty(_errorMessage))
{
<div class="alert alert-danger mb-3">@_errorMessage</div>
}
else if (!string.IsNullOrEmpty(_successMessage))
{
<div class="alert alert-success mb-3">@_successMessage</div>
}
</SectionContent>

@code {
[Parameter, EditorRequired]
[SupplyParameterFromQuery]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@

<PageTitle>@GetTitle()</PageTitle>

<SectionContent SectionName="main-top">
<h1>@GetTitle()</h1>
@if (!string.IsNullOrEmpty(_errorMessage))
{
<div class="alert alert-danger mb-3">@_errorMessage</div>
}
else if (!string.IsNullOrEmpty(_successMessage))
{
<div class="alert alert-success mb-3">@_successMessage</div>
}
</SectionContent>

<EditForm Model="@Model" OnValidSubmit="HandleValidSubmit" FormName="Login" method="post">
<DataAnnotationsValidator />
<div class="mb-3" hidden="@Model.RequireTwoFactor">
Expand Down Expand Up @@ -55,18 +67,6 @@
}
</EditForm>

<SectionContent SectionName="main-top">
<h1>@GetTitle()</h1>
@if (!string.IsNullOrEmpty(_errorMessage))
{
<div class="alert alert-danger mb-3">@_errorMessage</div>
}
else if (!string.IsNullOrEmpty(_successMessage))
{
<div class="alert alert-success mb-3">@_successMessage</div>
}
</SectionContent>

@code {
[Parameter]
[SupplyParameterFromQuery]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@

<PageTitle>@GetTitle()</PageTitle>

<SectionContent SectionName="main-top">
<h1>@GetTitle()</h1>
@if (!string.IsNullOrEmpty(_errorMessage))
{
<div class="alert alert-danger mb-3">@_errorMessage</div>
}
</SectionContent>

<EditForm Model="@Model" OnValidSubmit="HandleValidSubmit" FormName="Register" method="post">
<DataAnnotationsValidator />
<div class="mb-3">
Expand Down Expand Up @@ -39,14 +47,6 @@
</p>
</EditForm>

<SectionContent SectionName="main-top">
<h1>@GetTitle()</h1>
@if (!string.IsNullOrEmpty(_errorMessage))
{
<div class="alert alert-danger mb-3">@_errorMessage</div>
}
</SectionContent>

@code {
[Parameter, EditorRequired]
[SupplyParameterFromQuery]
Expand Down
File renamed without changes.

0 comments on commit 1f42ad3

Please sign in to comment.