Skip to content

Commit

Permalink
restructured AdminApp project
Browse files Browse the repository at this point in the history
  • Loading branch information
suxrobGM committed Jan 5, 2024
1 parent 761b898 commit 214178d
Show file tree
Hide file tree
Showing 37 changed files with 151 additions and 67 deletions.
File renamed without changes.
52 changes: 52 additions & 0 deletions src/Client/Logistics.AdminApp/Components/Layout/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@inherits LayoutComponentBase

<PageTitle>Logistics Admin</PageTitle>
<RadzenNotification />
<RadzenTooltip />

<RadzenLayout>
<RadzenHeader>
<RadzenRow class="h-100">
<RadzenColumn class="d-flex" Size="3">
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Gap="0.5rem">
<AuthorizedView>
<RadzenSidebarToggle Click="@ToggleSidebar"/>
</AuthorizedView>
<RadzenText class="text-light ms-2" Text="Logistics Admin" TextStyle="TextStyle.H5" />
</RadzenStack>
</RadzenColumn>
<RadzenColumn Size="9" class="d-flex justify-content-end pe-3">
<LoginDisplay />
</RadzenColumn>
</RadzenRow>
</RadzenHeader>

<AuthorizedView>
<RadzenSidebar @bind-Expanded="@_sidebarExpanded">
<RadzenPanelMenu>
<RadzenPanelMenuItem Text="Home" Icon="home" Path="/"/>
<RadzenPanelMenuItem Text="Tenants" Icon="business" Path="/tenants"/>
<RadzenPanelMenuItem Text="Subscriptions" Icon="subscriptions">
<RadzenPanelMenuItem Text="Plans" Icon="cases" Path="/subscription-plans"/>
<RadzenPanelMenuItem Text="Subscription customers" Icon="account_balance" Path="/subscriptions"/>
</RadzenPanelMenuItem>
<RadzenPanelMenuItem Text="Users" Icon="group" Path="/users"/>
</RadzenPanelMenu>
</RadzenSidebar>
</AuthorizedView>

<RadzenBody>
<div class="rz-p-4">
@Body
</div>
</RadzenBody>
</RadzenLayout>

@code {
private bool _sidebarExpanded = true;

private void ToggleSidebar()
{
_sidebarExpanded = !_sidebarExpanded;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components;

namespace Logistics.AdminApp.Pages;
namespace Logistics.AdminApp.Components.Pages;

public partial class Home
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Radzen;

namespace Logistics.AdminApp.Pages;
namespace Logistics.AdminApp.Components.Pages;

public abstract class PageBase : ComponentBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Logistics.Shared.Models;
using Microsoft.AspNetCore.Components;

namespace Logistics.AdminApp.Pages.Subscription;
namespace Logistics.AdminApp.Components.Pages.Subscription;

public partial class EditSubscription
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Logistics.Shared.Models;
using Microsoft.AspNetCore.Components;

namespace Logistics.AdminApp.Pages.Subscription;
namespace Logistics.AdminApp.Components.Pages.Subscription;

public partial class EditSubscriptionPlan
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.AspNetCore.Components;
using Radzen;

namespace Logistics.AdminApp.Pages.Subscription;
namespace Logistics.AdminApp.Components.Pages.Subscription;

public partial class ListSubscriptionPlans : PageBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.AspNetCore.Components;
using Radzen;

namespace Logistics.AdminApp.Pages.Subscription;
namespace Logistics.AdminApp.Components.Pages.Subscription;

public partial class ListSubscriptions : PageBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;

namespace Logistics.AdminApp.Pages.Tenant;
namespace Logistics.AdminApp.Components.Pages.Tenant;

[Authorize(Policy = Permissions.Tenants.Edit)]
public partial class EditTenant : PageBase
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.AspNetCore.Components;
using Radzen;

namespace Logistics.AdminApp.Pages.Tenant;
namespace Logistics.AdminApp.Components.Pages.Tenant;

public partial class ListTenants : PageBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.AspNetCore.Components;
using Radzen;

namespace Logistics.AdminApp.Pages.User;
namespace Logistics.AdminApp.Components.Pages.User;

public partial class ListUsers : PageBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Logistics.Shared.Models;
using Microsoft.AspNetCore.Components;

namespace Logistics.AdminApp.Shared;
namespace Logistics.AdminApp.Components.Shared;

public partial class AddressForm
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<AuthorizeView>
<Authorized>
@ChildContent
</Authorized>
</AuthorizeView>

@code {
[Parameter]
public RenderFragment? ChildContent { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System.Globalization;
using Microsoft.AspNetCore.Components;
@using System.Globalization
<div>@FormattedValue</div>

namespace Logistics.AdminApp.Shared;

public partial class CurrencyText
{
@code {
private string FormattedValue => FormatValueAsCurrency(Value);

[Parameter]
Expand Down
29 changes: 29 additions & 0 deletions src/Client/Logistics.AdminApp/Components/Shared/DecimalView.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@typeparam TNumber

<span>@FormattedNumber</span>

@code {
[Parameter]
public TNumber? Value { get; set; }

[Parameter]
public int DecimalPlaces { get; set; } = 2;

private string? FormattedNumber => FormatNumber(Value, DecimalPlaces);

private static string? FormatNumber(TNumber? number, int decimalPlaces)
{
if (number is null)
{
return string.Empty;
}

return number switch
{
decimal d => d.ToString($"F{decimalPlaces}"),
double d => d.ToString($"F{decimalPlaces}"),
float f => f.ToString($"F{decimalPlaces}"),
_ => number.ToString()
};
}
}
31 changes: 31 additions & 0 deletions src/Client/Logistics.AdminApp/Components/Shared/Tooltip.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<div @ref="_elementRef" @onmouseover="@ShowTooltip">
@ChildContent
</div>

@code {
private ElementReference _elementRef;

[Inject]
private TooltipService TooltipService { get; set; } = default!;

[Parameter, EditorRequired]
public string Text { get; set; } = default!;

[Parameter]
public TooltipPosition Position { get; set; }

[Parameter]
public int Delay { get; set; } = 500;

[Parameter]
public RenderFragment? ChildContent { get; set; }

private void ShowTooltip()
{
TooltipService.Open(_elementRef, Text, new TooltipOptions
{
Position = Position,
Delay = Delay
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
@using Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop

@using Logistics.AdminApp
@using Logistics.AdminApp.Layout
@using Logistics.AdminApp.Shared
@using Logistics.AdminApp.Components
@using Logistics.AdminApp.Components.Layout
@using Logistics.AdminApp.Components.Shared
@using Logistics.Shared.Models
@using Logistics.Shared.Roles

Expand Down
45 changes: 0 additions & 45 deletions src/Client/Logistics.AdminApp/Layout/MainLayout.razor

This file was deleted.

2 changes: 1 addition & 1 deletion src/Client/Logistics.AdminApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Logistics.AdminApp;
using Logistics.AdminApp.Components;
using Logistics.AdminApp.Authorization;
using Logistics.Client;
using Microsoft.AspNetCore.Authorization;
Expand Down
12 changes: 12 additions & 0 deletions src/Client/Logistics.AdminApp/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Hot-Reload": {
"commandName": "Executable",
"executablePath": "dotnet",
"workingDirectory": "$(ProjectDir)",
"commandLineArgs": "watch run",
"launchBrowser": true,
"applicationUrl": "https://localhost:7002",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"hotReloadProfile": "aspnetcore"
}
}
}
1 change: 0 additions & 1 deletion src/Client/Logistics.AdminApp/Shared/CurrencyText.razor

This file was deleted.

This file was deleted.

0 comments on commit 214178d

Please sign in to comment.