Skip to content

Commit

Permalink
Merge pull request #615 from neozhu/PermissionSet
Browse files Browse the repository at this point in the history
🍒 code clean
  • Loading branch information
neozhu authored Feb 17, 2024
2 parents b16ef6c + 0c4c77b commit 1fbf35a
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 51 deletions.
18 changes: 1 addition & 17 deletions src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
Expand Down Expand Up @@ -92,22 +92,6 @@ public async Task Recognition(int id, CancellationToken cancellationToken)
_logger.LogError(ex, "{Id}: recognize error {ExMessage}", id, ex.Message);
}
}

private string ReadBase64String(string path)
{
using (var image = Image.FromFile(path))
{
using (var m = new MemoryStream())
{
image.Save(m, image.RawFormat);
var imageBytes = m.ToArray();

// Convert byte[] to Base64 String
var base64String = Convert.ToBase64String(imageBytes);
return base64String;
}
}
}
}
#pragma warning disable CS8981
internal class OcrResult
Expand Down
3 changes: 0 additions & 3 deletions src/Server.UI/Components/Shared/Layout/AppLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,9 @@
@code
{
private bool _commandPaletteOpen;
private HotKeysContext? _hotKeysContext;
private bool _navigationMenuDrawerOpen = true;
private UserPreferences _userPreferences = new();
private MudThemeProvider _mudThemeProvider = null!;
private bool _themingDrawerOpen;
private bool _defaultDarkMode;
private UserProfile? _userProfile;
private ErrorBoundary? _errorBoundary { set; get; }
[CascadingParameter]
Expand Down
4 changes: 2 additions & 2 deletions src/Server.UI/Components/Shared/Layout/HeaderMenu.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<MudAppBar Class=""
<MudAppBar Class=""
Elevation="0"
Style="background: --mud-palette-appbar-background">
<MudTooltip Arrow="true" Text="Toggle menu">
Expand Down Expand Up @@ -26,7 +26,7 @@
<MudIconButton Class="mx-1"
Color="Color.Default"
Icon="@Icons.Custom.Brands.GitHub"
Link="https://github.com/neozhu/CleanArchitectureWithBlazorServer"
Href="https://github.com/neozhu/CleanArchitectureWithBlazorServer"
Target="_blank"/>
</MudTooltip>
<LanguageSelector/>
Expand Down
3 changes: 1 addition & 2 deletions src/Server.UI/Components/Shared/Layout/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

@code
{
private HotKeysContext? _hotKeysContext;

private UserPreferences _userPreferences = new();
private MudThemeProvider _mudThemeProvider = null!;
private bool _defaultDarkMode;
Expand All @@ -28,7 +28,6 @@
public void Dispose()
{
LayoutService.MajorUpdateOccured -= LayoutServiceOnMajorUpdateOccured;
_hotKeysContext?.Dispose();
GC.SuppressFinalize(this);
}

Expand Down
59 changes: 37 additions & 22 deletions src/Server.UI/Components/Shared/Layout/PublicLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,45 @@
</MudText>
</NavLink>
<MudSpacer />
<MudTooltip Arrow="true"
Text="Navigate to GitHub">
<MudIconButton Class="mx-1"
Color="Color.Default"
Icon="@Icons.Custom.Brands.GitHub"
Link="https://github.com/neozhu/CleanArchitectureWithBlazorServer"
Target="_blank" />
</MudTooltip>
<LanguageSelector />
<MudTooltip Text="@(RightToLeft ? "Toggle right-to-left" : "Toggle left-to-right")">
<MudIconButton Class="mx-1"
Icon="@(RightToLeft ? Icons.Material.Filled.FormatTextdirectionLToR : Icons.Material.Filled.FormatTextdirectionRToL)"
Color="Color.Default"
OnClick="@(e => LayoutService.ToggleRightToLeft())" />
</MudTooltip>
<MudHidden Breakpoint="Breakpoint.SmAndDown" >
<MudTooltip Arrow="true"
Text="Navigate to GitHub">
<MudIconButton Class="mx-1"
Color="Color.Default"
Icon="@Icons.Custom.Brands.GitHub"
Href="https://github.com/neozhu/CleanArchitectureWithBlazorServer"
Target="_blank" />
</MudTooltip>
<LanguageSelector />
<MudTooltip Text="@(RightToLeft ? "Toggle right-to-left" : "Toggle left-to-right")">
<MudIconButton Class="mx-1"
Icon="@(RightToLeft ? Icons.Material.Filled.FormatTextdirectionLToR : Icons.Material.Filled.FormatTextdirectionRToL)"
Color="Color.Default"
OnClick="@(e => LayoutService.ToggleRightToLeft())" />
</MudTooltip>

<MudTooltip Text="@L["Login"]">
<MudButton Variant="Variant.Text" Href="/pages/authentication/login"
StartIcon="@Icons.Material.Rounded.Login"
Style="text-transform:none">
@L["Login"]
</MudButton>
</MudTooltip>
<MudTooltip Text="@L["Login"]">
<MudButton Variant="Variant.Text" Href="/pages/authentication/login"
StartIcon="@Icons.Material.Rounded.Login"
Style="text-transform:none">
@L["Login"]
</MudButton>
</MudTooltip>
</MudHidden>
<MudHidden Breakpoint="Breakpoint.SmAndDown" Invert="true">

<LanguageSelector />

<MudTooltip Text="@L["Login"]">
<MudButton Variant="Variant.Text" Href="/pages/authentication/login"
StartIcon="@Icons.Material.Rounded.Login"
Style="text-transform:none">
@L["Login"]
</MudButton>
</MudTooltip>
</MudHidden>


</MudAppBar>
<MudMainContent>
<MudContainer MaxWidth="MaxWidth.Large" Class="mb-4 mt-4">
Expand Down
1 change: 0 additions & 1 deletion src/Server.UI/Pages/Customers/Customers.razor
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@
private CustomerDto _currentDto = new();
private bool _loading;
private bool _uploading;
private bool _downloading;
private bool _exporting;
[Inject]
private IMediator Mediator { get; set; } = default!;
Expand Down
3 changes: 2 additions & 1 deletion src/Server.UI/Pages/Dashboard/Dashboard.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@page "/"
@page "/"
@using CleanArchitecture.Blazor.Server.UI.Pages.Dashboard.Components
@using MudBlazor.Utilities
<PageTitle>@Title</PageTitle>
<AuthorizeView>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@using Color = Color
@using Color = Color
@using Severity = Severity
@using SixLabors.ImageSharp.Processing
@using SixLabors.ImageSharp
Expand Down Expand Up @@ -46,11 +46,11 @@
<MudButton Variant="Variant.Filled" Color="Color.Secondary" StartIcon="@Icons.Material.Filled.Clear" Disabled="@(!_uploadedFiles.Any())" OnClick="Clear">@ConstantString.Clear</MudButton>
<MudFileUpload T="IReadOnlyList<IBrowserFile>" Accept=".jpg, .jpeg, .png, .webp" FilesChanged="LoadFiles" Style="margin-top:0px">
<ButtonTemplate>
<MudButton Variant="Variant.Filled" HtmlTag="label"
<MudLoadingButton Loading="@_uploading" Variant="Variant.Filled" HtmlTag="label"
Icon="@Icons.Material.Filled.AttachFile"
for="@context">
@L["Choose files"]
</MudButton>
</MudLoadingButton>
</ButtonTemplate>
</MudFileUpload>

Expand Down

0 comments on commit 1fbf35a

Please sign in to comment.