Skip to content

Commit

Permalink
Added Filter section into TgDownloaderBlazor
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianMorozov committed Feb 27, 2024
1 parent 1fe9883 commit 9b0aa4d
Show file tree
Hide file tree
Showing 57 changed files with 514 additions and 136 deletions.
12 changes: 12 additions & 0 deletions Clients/TgDownloaderBlazor/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.2",
"commands": [
"dotnet-ef"
]
}
}
}
24 changes: 0 additions & 24 deletions Clients/TgDownloaderBlazor/Components/Pages/HomeComponent.razor.cs

This file was deleted.

6 changes: 0 additions & 6 deletions Clients/TgDownloaderBlazor/Components/Routes.razor

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
<link rel="stylesheet" href="app.css" />
<link rel="stylesheet" href="TgDownloaderBlazor.styles.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@latest/font/bootstrap-icons.css" />
<link rel="icon" type="image/png" href="favicon.png" />
<HeadOutlet />
</head>
Expand Down
24 changes: 24 additions & 0 deletions Clients/TgDownloaderBlazor/Features/Home/HomeComponent.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

namespace TgDownloaderBlazor.Features.Home;

public sealed partial class HomeComponent : TgPageComponent
{
#region Public and private fields, properties, constructor

public static string AppVersionTitle { get; set; } = string.Empty;
public static string AppVersionShort { get; set; } = string.Empty;
public static string AppVersionFull { get; set; } = string.Empty;

public HomeComponent()
{
AppVersionTitle = $"{TgLocale.AppTitleBlazor} " +
$"v{TgCommonUtils.GetTrimVersion(Assembly.GetExecutingAssembly().GetName().Version)}";
AppVersionShort = $"v{TgCommonUtils.GetTrimVersion(Assembly.GetExecutingAssembly().GetName().Version)}";
AppVersionFull = $"{TgLocale.AppVersion}: {AppVersionShort}";

}

#endregion
}
8 changes: 8 additions & 0 deletions Clients/TgDownloaderBlazor/Features/Layout/Header.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@page "/Header"
@inherits TgPageComponent

<nav class="navbar mb-5 shadow">
<a class="navbar-brand" href="/">
@* <img src="/images/logo.png"></img> *@
</a>
</nav>
6 changes: 6 additions & 0 deletions Clients/TgDownloaderBlazor/Features/Layout/Header.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace TgDownloaderBlazor.Features.Layout;

public sealed partial class Header : TgPageComponent
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<NavMenu />
</div>

@* <main class="container mt-5 mb-5"> *@
<main>
<div class="top-row px-4">
<a href=@LocaleHelper.FieldLinkTgDownloader target="_blank">@LocaleHelper.FieldTgDownloader</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace TgDownloaderBlazor.Components.Layout;
namespace TgDownloaderBlazor.Features.Layout;

public sealed partial class MainLayout
public sealed partial class MainLayout : LayoutComponentBase
{
#region Public and private fields, properties, constructor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span>@TgLocale.MenuMainApps
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="Filters">
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span>@TgLocale.MenuMainFilters
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="Proxies">
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span>@TgLocale.MenuMainProxies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TgDownloaderBlazor.Components.Layout;
namespace TgDownloaderBlazor.Features.Layout;

public sealed partial class NavMenu : TgPageComponent
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
@inject IDbContextFactory<TgEfContext> DbFactory
@inherits TgPageComponent

<PageTitle>Apps</PageTitle>
<PageTitle>@TgLocale.MenuMainApps</PageTitle>

<h1>Apps</h1>
<h1>@TgLocale.MenuMainApps</h1>

@if (!Apps.Any())
@if (!Items.Any())
{
<p><em>Loading...</em></p>
}
Expand All @@ -22,12 +22,12 @@ else
</tr>
</thead>
<tbody>
@foreach (var app in Apps)
@foreach (var item in Items)
{
<tr>
<td>@app.ApiHash</td>
<td>@app.ApiId</td>
<td>@app.PhoneNumber</td>
<td>@item.ApiHash</td>
<td>@item.ApiId</td>
<td>@item.PhoneNumber</td>
@* <td>@app.Proxy.ToDebugString()</td> *@
</tr>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

namespace TgDownloaderBlazor.Components.Pages;
namespace TgDownloaderBlazor.Features.Pages;

public sealed partial class AppComponent : TgPageComponent
{
#region Public and private fields, properties, constructor

private IList<TgEfAppEntity> Apps { get; set; } = new List<TgEfAppEntity>();
private IList<TgEfAppEntity> Items { get; set; } = new List<TgEfAppEntity>();

#endregion

Expand All @@ -21,7 +21,7 @@ protected override async Task OnInitializedAsync()
#if DEBUG
Debug.WriteLine($"Apps page | {dbContext}");
#endif
Apps = dbContext.AppsRepo.GetEnumerable(0).ToList();
Items = dbContext.AppsRepo.GetEnumerable(0).ToList();
}

#endregion
Expand Down
40 changes: 40 additions & 0 deletions Clients/TgDownloaderBlazor/Features/Pages/FilterComponent.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@page "/filters"
@inject IDbContextFactory<TgEfContext> DbFactory
@inherits TgPageComponent

<PageTitle>@TgLocale.MenuMainFilters</PageTitle>

<h1>@TgLocale.MenuMainFilters</h1>

@if (!Items.Any())
{
<p><em>Loading...</em></p>
}
else
{
<table class="table">
<thead>
<tr>
<th>@TgLocale.FieldIsEnabled</th>
<th>@TgLocale.FieldFilterType</th>
<th>@TgLocale.FieldName</th>
<th>@TgLocale.FieldMask</th>
<th>@TgLocale.FieldSize</th>
<th>@TgLocale.FieldSizeType</th>
</tr>
</thead>
<tbody>
@foreach (var item in Items)
{
<tr>
<td>@item.IsEnabled</td>
<td>@item.FilterType</td>
<td>@item.Name</td>
<td>@item.Mask</td>
<td>@item.Size</td>
<td>@item.SizeType</td>
</tr>
}
</tbody>
</table>
}
25 changes: 25 additions & 0 deletions Clients/TgDownloaderBlazor/Features/Pages/FilterComponent.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

namespace TgDownloaderBlazor.Features.Pages;

public partial class FilterComponent : TgPageComponent
{
#region Public and private fields, properties, constructor

private IList<TgEfFilterEntity> Items { get; set; } = new List<TgEfFilterEntity>();

#endregion

#region Public and private methods

protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();

await using var dbContext = await DbFactory.CreateDbContextAsync();
Items = dbContext.FilterRepo.GetEnumerable(0).ToList();
}

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
@inject IDbContextFactory<TgEfContext> DbFactory
@inherits TgPageComponent

<PageTitle>Apps</PageTitle>
<PageTitle>@TgLocale.MenuMainProxies</PageTitle>

<h1>Apps</h1>
<h1>@TgLocale.MenuMainProxies</h1>

@if (!Proxies.Any())
@if (!Items.Any())
{
<p><em>Loading...</em></p>
}
Expand All @@ -24,15 +24,15 @@ else
</tr>
</thead>
<tbody>
@foreach (var app in Proxies)
@foreach (var item in Items)
{
<tr>
<td>@app.Type</td>
<td>@app.HostName</td>
<td>@app.Port</td>
<td>@app.UserName</td>
<td>@app.Password</td>
<td>@app.Secret</td>
<td>@item.Type</td>
<td>@item.HostName</td>
<td>@item.Port</td>
<td>@item.UserName</td>
<td>@item.Password</td>
<td>@item.Secret</td>
</tr>
}
</tbody>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

namespace TgDownloaderBlazor.Components.Pages;
namespace TgDownloaderBlazor.Features.Pages;

public partial class ProxyComponent : TgPageComponent
{
#region Public and private fields, properties, constructor

private IList<TgEfProxyEntity> Proxies { get; set; } = new List<TgEfProxyEntity>();
private IList<TgEfProxyEntity> Items { get; set; } = new List<TgEfProxyEntity>();

#endregion

Expand All @@ -18,7 +18,7 @@ protected override async Task OnInitializedAsync()
await base.OnInitializedAsync();

await using var dbContext = await DbFactory.CreateDbContextAsync();
Proxies = dbContext.ProxyRepo.GetEnumerable(0).ToList();
Items = dbContext.ProxyRepo.GetEnumerable(0).ToList();
}

#endregion
Expand Down
13 changes: 13 additions & 0 deletions Clients/TgDownloaderBlazor/Features/Routes.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@using TgDownloaderBlazor.Features.Layout
<Router AppAssembly="typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
<FocusOnNavigate RouteData="routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.'</p>
</LayoutView>
</NotFound>
</Router>
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using TgDownloaderBlazor
@using TgDownloaderBlazor.Components
@using TgDownloaderBlazor.Features
11 changes: 5 additions & 6 deletions Clients/TgDownloaderBlazor/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com
// Global using directives

global using System.Diagnostics;
global using System.Reflection;
global using Microsoft.AspNetCore.Components;
global using Microsoft.AspNetCore.Components.Web;
global using Microsoft.EntityFrameworkCore;
global using TgDownloaderBlazor;
global using System.Diagnostics;
global using System.Reflection;
global using TgDownloaderBlazor.Common;
global using TgDownloaderBlazor.Components;
global using TgDownloaderBlazor.Features;
global using TgEfCore;
global using TgEfCore.Domain.Apps;
global using TgEfCore.Domain.Filters;
global using TgEfCore.Domain.Proxies;
global using TgLocalization.Helpers;
global using TgStorage.Helpers;
global using TgStorage.Utils;
global using TgStorage.Utils;
2 changes: 1 addition & 1 deletion Clients/TgDownloaderBlazor/TgDownloaderBlazor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>0.4.10.0</Version>
<Version>0.4.30.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Clients/TgDownloaderConsole/TgDownloaderConsole.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.4.10.0</Version>
<Version>0.4.30.0</Version>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<Platforms>AnyCPU;x64;x86</Platforms>
<ApplicationIcon>applicationIcon.ico</ApplicationIcon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>applicationIcon.ico</ApplicationIcon>
<Platforms>AnyCPU;x64;x86</Platforms>
<Version>0.4.10.0</Version>
<Version>0.4.30.0</Version>
</PropertyGroup>
<ItemGroup>
<Content Include="applicationIcon.ico" />
Expand Down
Loading

0 comments on commit 9b0aa4d

Please sign in to comment.