Skip to content

Commit 4fa2439

Browse files
committed
REFACT: standardized work with routes, move status bar to common components, qrcode component now is more flexible, rename PrintService to DocumentService
FIX: fsd architecture STYLE: fix labels grid no item styles and header color
1 parent 214f19b commit 4fa2439

File tree

114 files changed

+359
-255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+359
-255
lines changed

Src/Apps/Desktop/Pl.Desktop.Client/Source/Features/ErrorBoundaries/ArmErrorBoundary.razor

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@using Pl.Desktop.Client.Source.Shared.Constants
12
@using Blazor.Heroicons.Outline
23

34
<UseParameterlessEndpoint Endpoint="@ArmEndpoints.ArmEndpoint" Context="query">

Src/Apps/Desktop/Pl.Desktop.Client/Source/Pages/Home/HomeMenu.razor

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@using Blazor.Heroicons.Outline
2+
@using Pl.Desktop.Client.Source.Shared.Constants
23
@using Pl.Components.Source.UI.AppMenu
34

45
<AppMenu>

Src/Apps/Desktop/Pl.Desktop.Client/Source/Pages/Home/HomePage.razor

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@using Pl.Desktop.Client.Source.Shared.Constants
12
@attribute [Route(Routes.Home)]
23

34
<div class="size-full flex items-center overflow-hidden justify-center px-3 py-4">

Src/Apps/Desktop/Pl.Desktop.Client/Source/Pages/Home/QrUserDialog.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<div class="w-full flex justify-center">
1818
<QRCode Value="@DeviceInfo()">
1919
<LoadingContent>
20-
<Spinner Class="size-20 text-primary" />
20+
<Spinner Class="size-20" />
2121
</LoadingContent>
2222
<ErrorContent>
2323
<ExclamationTriangleIcon class="size-20 text-destructive" />

Src/Apps/Desktop/Pl.Desktop.Client/Source/Pages/Labels/LabelCreateForm/LabelCreateFormNetWeight.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<LabelCreateFormFieldItem Label="@WsDataLocalizer["ColNetWeight"]">
77
@if (ScalesState.Value.Status == MassaKStatus.Initializing)
88
{
9-
<Spinner Class="size-8 inline text-gray-200 animate-spin fill-primary" />
9+
<Spinner Class="size-8" />
1010
}
1111
else
1212
{

Src/Apps/Desktop/Pl.Desktop.Client/Source/Pages/Labels/LabelsPage.razor

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@using Pl.Desktop.Client.Source.Shared.Services.Devices.Scales
66
@using Pl.Desktop.Client.Source.Pages.Labels.LabelConfig
77
@using Pl.Desktop.Client.Source.Pages.Labels.LabelCreateForm
8+
@using Pl.Desktop.Client.Source.Shared.Constants
89

910
@attribute [Route(Routes.Labels)]
1011

Src/Apps/Desktop/Pl.Desktop.Client/Source/Pages/Pallet/LabelsGrid.razor

+5-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
Items="@GetOrderedLabels(labelsQuery.HasData ? labelsQuery.Data : [])"
5757
Loading="@labelsQuery.IsLoading"
5858
GenerateHeader="GenerateHeaderOption.Sticky"
59-
Class="[&_.col-title-text]:text-sm [&_.col-title-text]:text-left [&_thead]:bg-background [&_th>svg]:mx-auto"
59+
Class="!h-fit [&_.col-title-text]:text-sm [&_.col-title-text]:text-left [&_thead_th]:!bg-background [&_th>svg]:mx-auto"
6060
Virtualize>
6161
<SelectColumn
6262
TGridItem="DataItem"
@@ -68,11 +68,13 @@
6868
<PropertyColumn
6969
Title="@WsDataLocalizer["ColNumber"]"
7070
Property="@(p => p.Id)"
71-
Width="1fr"/>
71+
Width="1fr"
72+
/>
7273
<PropertyColumn
7374
Title="@WsDataLocalizer["ColBarcode"]"
7475
Property="@(p => p.Label.Barcode)"
75-
Width="5fr"/>
76+
Width="5fr"
77+
/>
7678
<TemplateColumn Width="4rem" Align="Align.Center">
7779
<button
7880
type="button"

Src/Apps/Desktop/Pl.Desktop.Client/Source/Pages/Pallet/PalletPage.razor

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
@using Pl.Desktop.Client.Source.Shared.Services.Devices.Printer
55
@using Pl.Desktop.Client.Source.Pages.Pallet.PalletSelect
66
@using Pl.Desktop.Client.Source.Pages.Pallet.FunctionalityDescription
7+
@using Pl.Desktop.Client.Source.Shared.Constants
78

89
@attribute [Route(Routes.Pallet)]
910
@inherits Fluxor.Blazor.Web.Components.FluxorComponent

Src/Apps/Desktop/Pl.Desktop.Client/Source/Shared/Utils/RouteUtils.cs Src/Apps/Desktop/Pl.Desktop.Client/Source/Shared/Constants/Routes.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Pl.Desktop.Client.Source.Shared.Utils;
1+
namespace Pl.Desktop.Client.Source.Shared.Constants;
22

33
public static class Routes
44
{

Src/Apps/Desktop/Pl.Desktop.Client/Source/Shared/Utils/WindowsUtils.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static NetworkInfo GetNetworkInfo()
6363
}
6464
catch
6565
{
66-
// pass;
66+
// pass
6767
}
6868
return new(ip, mac, type);
6969
}

Src/Apps/Desktop/Pl.Desktop.Client/Source/Widgets/AppHeader.razor

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@using Pl.Desktop.Client.Source.Shared.Services.System
2+
@using Pl.Desktop.Client.Source.Shared.Constants
23
@using Blazor.Heroicons.Outline
34
@inherits PlComponentBase
45

Src/Apps/Mobile/Pl.Mobile.Client/Source/Features/ArmControl.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515

1616
@code {
1717
[Inject] private IState<UserState> UserState { get; set; } = default!;
18-
}
18+
}

Src/Apps/Mobile/Pl.Mobile.Client/Source/Features/PageHeader.razor

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@using Pl.Mobile.Client.Source.Shared.Constants
12
@using Blazor.Heroicons.Outline
23

34
<div class="grid h-10 items-center shrink-0 w-full px-2 grid-cols-[1fr,auto,1fr]">

Src/Apps/Mobile/Pl.Mobile.Client/Source/Features/QRCode.razor

-30
This file was deleted.

Src/Apps/Mobile/Pl.Mobile.Client/Source/Pages/Home/HomeMenu.razor

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@using Blazor.Heroicons.Outline
22
@using Microsoft.Extensions.Localization
3+
@using Pl.Mobile.Client.Source.Shared.Constants
34
@using Pl.Components.Source.UI.AppMenu
45

56
<AppMenu>
@@ -18,11 +19,6 @@
1819
<QrCodeIcon class="size-full" />
1920
</IconContent>
2021
</AppMenuItem>
21-
@* <AppMenuItem Title="Выход" Description="Завершение текущей сессии" OnClick="@ShowCloseAppDialog"> *@
22-
@* <IconContent> *@
23-
@* <ArrowRightStartOnRectangleIcon class="size-full" /> *@
24-
@* </IconContent> *@
25-
@* </AppMenuItem> *@
2622
</AppMenu>
2723

2824
@code {
@@ -32,4 +28,4 @@
3228
private async Task ShowCloseAppDialog() => await DialogService.ShowDialogAsync<CloseAppDialog>(new());
3329

3430
private async Task ShowQrUserDialog() => await DialogService.ShowDialogAsync<QrUserDialog>(new());
35-
}
31+
}

Src/Apps/Mobile/Pl.Mobile.Client/Source/Pages/Home/HomePage.razor

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1+
@using Pl.Mobile.Client.Source.Shared.Constants
12
@using Microsoft.Extensions.Localization
23
@attribute [Route(Routes.Home)]
34

45
<div class="size-full flex items-center overflow-hidden justify-center px-3 py-4">
56
<div class="max-w-sm w-full max-h-full flex gap-4 flex-col">
67
<div class="flex flex-col space-y-1 items-center justify-center text-center">
7-
<div class="w-full shrink-0 flex items-center gap-1.5 justify-center">
8-
<div class="size-9 bg-primary rounded-md overflow-hidden p-1.5">
9-
<MobileLogo Class="text-background" />
10-
</div>
11-
<h2 class="text-2xl tracking-[.25rem]">OBILE</h2>
12-
</div>
8+
<MobileLogo />
139
<h3 class="text-sm text-muted-foreground">@Localizer["HomeMenuDescription"]</h3>
1410
</div>
1511
<HomeMenu />

Src/Apps/Mobile/Pl.Mobile.Client/Source/Features/QrUserDialog.razor Src/Apps/Mobile/Pl.Mobile.Client/Source/Pages/Home/QrUserDialog.razor

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
<div class="w-full flex justify-center">
1818
<QRCode
1919
Value="@Settings.Secure.GetString(Android.App.Application.Context.ContentResolver, Settings.Secure.AndroidId)"
20-
BlockSize="15"
21-
/>
20+
BlockSize="15">
21+
<LoadingContent>
22+
<Spinner Class="size-20" />
23+
</LoadingContent>
24+
</QRCode>
2225
</div>
2326
<div class="flex w-full justify-end gap-2 pt-4">
2427
<Button OnClick="@CloseDialog">
@@ -31,4 +34,4 @@
3134
[CascadingParameter] public FluentDialog Dialog { get; set; } = default!;
3235

3336
private async Task CloseDialog() => await Dialog.CloseAsync();
34-
}
37+
}

Src/Apps/Mobile/Pl.Mobile.Client/Source/Pages/Transfer/TransferForm/ResultStage.razor

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@using Blazor.Heroicons.Outline
2+
@using Pl.Mobile.Client.Source.Shared.Constants
23
@using Refit
34
@using Pl.Mobile.Client.Source.Shared.Stores
45
@using Pl.Mobile.Models

Src/Apps/Mobile/Pl.Mobile.Client/Source/Pages/Transfer/TransferPage.razor

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@using Pl.Mobile.Client.Source.Pages.Transfer.TransferForm
2+
@using Pl.Mobile.Client.Source.Shared.Constants
23

34
@attribute [Route(Routes.Transfer)]
45

Src/Apps/Mobile/Pl.Mobile.Client/Source/Pages/Validate/ValidatePage.razor

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@using Blazor.Heroicons.Outline
22
@using Microsoft.Extensions.Localization
3+
@using Pl.Mobile.Client.Source.Shared.Constants
34
@using Pl.Mobile.Client.Source.Shared
45

56
@attribute [Route(Routes.Validate)]

Src/Apps/Mobile/Pl.Mobile.Client/Source/Shared/Utils/RouteUtils.cs Src/Apps/Mobile/Pl.Mobile.Client/Source/Shared/Constants/Routes.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Pl.Mobile.Client.Source.Shared.Utils;
1+
namespace Pl.Mobile.Client.Source.Shared.Constants;
22

33
public static class Routes
44
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
@using QRCoder
2+
3+
@if (IsLoading)
4+
{
5+
@LoadingContent
6+
}
7+
else if (IsError)
8+
{
9+
@ErrorContent
10+
}
11+
else
12+
{
13+
<img alt="" src="@($"{Base64Prefix}{CodeString}")" class="@Class" @attributes="AdditionalAttributes" />
14+
}
15+
16+
@code {
17+
[Parameter, EditorRequired] public string Value { get; set; } = string.Empty;
18+
[Parameter(CaptureUnmatchedValues = true)] public virtual IReadOnlyDictionary<string, object>? AdditionalAttributes { get; set; }
19+
[Parameter] public RenderFragment? ErrorContent { get; set; }
20+
[Parameter] public RenderFragment? LoadingContent { get; set; }
21+
[Parameter] public string Class { get; set; } = string.Empty;
22+
[Parameter] public int BlockSize { get; set; } = 5;
23+
24+
private const string Base64Prefix = "data:image/png;base64,";
25+
private string CodeString { get; set; } = string.Empty;
26+
private bool IsLoading { get; set; } = true;
27+
private bool IsError { get; set; } = false;
28+
29+
protected override async Task OnInitializedAsync()
30+
{
31+
await base.OnInitializedAsync();
32+
CodeString = await GenerateQrCodeAsync();
33+
}
34+
35+
public Task Reload() => GenerateQrCodeAsync();
36+
37+
private async Task<string> GenerateQrCodeAsync()
38+
{
39+
string base64String = "";
40+
IsError = false;
41+
IsLoading = true;
42+
StateHasChanged();
43+
44+
try
45+
{
46+
base64String = await Task.Run(GenerateQrCode);
47+
}
48+
catch
49+
{
50+
IsError = true;
51+
}
52+
53+
IsLoading = false;
54+
StateHasChanged();
55+
56+
return base64String;
57+
}
58+
59+
private string GenerateQrCode()
60+
{
61+
using QRCodeGenerator qrGenerator = new();
62+
using QRCodeData qrCodeData = qrGenerator.CreateQrCode(Value, QRCodeGenerator.ECCLevel.Q);
63+
using Base64QRCode qrCode = new(qrCodeData);
64+
return qrCode.GetGraphic(BlockSize);
65+
}
66+
}

Src/Apps/Mobile/Pl.Mobile.Client/Source/_Imports.razor

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
@using Pl.Mobile.Client.Source
1212
@using Pl.Mobile.Client.Source.Features
1313
@using Pl.Mobile.Client.Source.Shared.UI
14-
@using Pl.Mobile.Client.Source.Shared.Utils
1514
@using Pl.Mobile.Client.Source.Shared.Localization
1615

1716
@* MODULES *@

Src/Apps/Tablet/Pl.Tablet.Client/MauiProgram.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static MauiApp CreateMauiApp()
4242

4343
builder.Services
4444
.AddScoped<HtmlRenderer>()
45-
.AddScoped<IPrintService, PrintService>()
45+
.AddScoped<IDocumentService, DocumentService>()
4646
.AddSingleton<IPrinterService, PrinterService>();
4747

4848
#if DEBUG

Src/Apps/Tablet/Pl.Tablet.Client/Platforms/Android/PrintService.cs Src/Apps/Tablet/Pl.Tablet.Client/Platforms/Android/DocumentService.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
using Android.Print;
33
using Pl.Tablet.Client;
44
using Pl.Tablet.Client.Source.Shared;
5+
using Pl.Tablet.Client.Source.Shared.Services;
56
using WebView = Android.Webkit.WebView;
67

7-
[assembly: Dependency(typeof(PrintService))]
8+
[assembly: Dependency(typeof(DocumentService))]
89
namespace Pl.Tablet.Client;
910

10-
public class PrintService : IPrintService
11+
public class DocumentService : IDocumentService
1112
{
1213
public void Print(string htmlContent)
1314
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@using Blazor.Heroicons.Outline
2+
3+
<div class="grid h-10 items-center shrink-0 w-full px-2 grid-cols-[1fr,auto,1fr]">
4+
<Button Link="@Routes.Home" Variant="ButtonVariantType.Ghost" Size="ButtonSizeType.Icon">
5+
<ArrowLeftIcon class="size-4 mr-3" />
6+
</Button>
7+
@if (!string.IsNullOrWhiteSpace(Title))
8+
{
9+
<h2>@Title</h2>
10+
}
11+
</div>
12+
13+
@code {
14+
[Parameter] public string Title { get; set; } = string.Empty;
15+
}

Src/Apps/Tablet/Pl.Tablet.Client/Source/Features/QRCode.razor

-30
This file was deleted.

Src/Apps/Tablet/Pl.Tablet.Client/Source/Pages/Create/CompleteCreateDialog.razor

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@using Pl.Tablet.Client.Source.Shared.Constants
12
@using Blazor.Heroicons.Outline
23

34
@implements IDialogContentComponent
@@ -23,7 +24,7 @@
2324
>
2425
Отмена
2526
</Button>
26-
<Button Link="@Urls.Home">
27+
<Button Link="@Routes.Home">
2728
Подтвердить
2829
</Button>
2930
</div>

0 commit comments

Comments
 (0)