[frontend] Code cleanup
This commit is contained in:
parent
642d4d9332
commit
79a4ce012c
4 changed files with 11 additions and 19 deletions
|
@ -3,7 +3,6 @@
|
||||||
@using Iceshrimp.Frontend.Localization
|
@using Iceshrimp.Frontend.Localization
|
||||||
@using Iceshrimp.Shared.Schemas.Web
|
@using Iceshrimp.Shared.Schemas.Web
|
||||||
@using Microsoft.Extensions.Localization
|
@using Microsoft.Extensions.Localization
|
||||||
@using _Imports = Iceshrimp.Frontend._Imports
|
|
||||||
@inject IStringLocalizer<Localization> Loc;
|
@inject IStringLocalizer<Localization> Loc;
|
||||||
@inject IJSRuntime Js;
|
@inject IJSRuntime Js;
|
||||||
@inject SessionService Session;
|
@inject SessionService Session;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using Iceshrimp.Frontend.Core.Services;
|
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
namespace Iceshrimp.Frontend.Core.InMemoryLogger;
|
namespace Iceshrimp.Frontend.Core.InMemoryLogger;
|
||||||
|
@ -15,5 +14,5 @@ internal class InMemoryLogger (IOptions<InMemoryLoggerConfiguration> config, InM
|
||||||
return config.Value.LogLevel.HasFlag(logLevel);
|
return config.Value.LogLevel.HasFlag(logLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => default!;
|
public IDisposable BeginScope<TState>(TState state) where TState : notnull => default!;
|
||||||
}
|
}
|
|
@ -6,11 +6,9 @@
|
||||||
@using Iceshrimp.Shared.Schemas.Web
|
@using Iceshrimp.Shared.Schemas.Web
|
||||||
@using Microsoft.Extensions.Localization
|
@using Microsoft.Extensions.Localization
|
||||||
@using Iceshrimp.Assets.PhosphorIcons
|
@using Iceshrimp.Assets.PhosphorIcons
|
||||||
@using Microsoft.Extensions.Logging
|
|
||||||
@using Microsoft.AspNetCore.Components.Sections
|
@using Microsoft.AspNetCore.Components.Sections
|
||||||
@layout SettingsLayout
|
@layout SettingsLayout
|
||||||
@inject ApiService Api;
|
@inject ApiService Api;
|
||||||
@inject ILogger<Filters> Logger;
|
|
||||||
@inject IStringLocalizer<Localization> Loc;
|
@inject IStringLocalizer<Localization> Loc;
|
||||||
|
|
||||||
<SectionContent SectionName="top-bar">
|
<SectionContent SectionName="top-bar">
|
||||||
|
@ -173,21 +171,21 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<FilterResponse> FilterList { get; set; } = [];
|
private List<FilterResponse> FilterList { get; set; } = [];
|
||||||
private State State { get; set; } = State.Loading;
|
private State State { get; set; } = State.Loading;
|
||||||
private string FilterName { get; set; } = "";
|
private string FilterName { get; set; } = "";
|
||||||
private string Keyword { get; set; } = "";
|
private string Keyword { get; set; } = "";
|
||||||
private List<String> FilterKeywords { get; set; } = [];
|
private List<String> FilterKeywords { get; } = [];
|
||||||
private DateTime? FilterExpiry { get; set; }
|
private DateTime? FilterExpiry { get; set; }
|
||||||
private FilterResponse.FilterAction FilterAction { get; set; }
|
private FilterResponse.FilterAction FilterAction { get; set; }
|
||||||
private Menu MenuFilterAction { get; set; } = null!;
|
private Menu MenuFilterAction { get; set; } = null!;
|
||||||
private Menu MenuFilterContexts { get; set; } = null!;
|
private Menu MenuFilterContexts { get; set; } = null!;
|
||||||
private List<FilterResponse.FilterContext> FilterContexts { get; set; } = [];
|
private List<FilterResponse.FilterContext> FilterContexts { get; } = [];
|
||||||
private StateButton ButtonAddFilter { get; set; } = null!;
|
private StateButton ButtonAddFilter { get; set; } = null!;
|
||||||
private bool _filterNameInvalid = false;
|
private bool _filterNameInvalid;
|
||||||
private bool _filterKeywordsInvalid = false;
|
private bool _filterKeywordsInvalid;
|
||||||
private bool _filterExpiryInvalid = false;
|
private bool _filterExpiryInvalid;
|
||||||
private bool _filterContextsInvalid = false;
|
private bool _filterContextsInvalid;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
@ -206,17 +204,13 @@
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var res = await Api.Filters.DeleteFilter(id);
|
if (await Api.Filters.DeleteFilter(id))
|
||||||
if (res == true)
|
|
||||||
{
|
{
|
||||||
var index = FilterList.FindIndex(p => p.Id == id);
|
var index = FilterList.FindIndex(p => p.Id == id);
|
||||||
FilterList.RemoveAt(index);
|
FilterList.RemoveAt(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ApiException)
|
catch (ApiException) { }
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task TryAddFilter()
|
private async Task TryAddFilter()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
@using Iceshrimp.Assets.PhosphorIcons
|
@using Iceshrimp.Assets.PhosphorIcons
|
||||||
@using Iceshrimp.Frontend.Localization
|
@using Iceshrimp.Frontend.Localization
|
||||||
@using Microsoft.Extensions.Localization
|
@using Microsoft.Extensions.Localization
|
||||||
@inject NavigationManager Nav;
|
@* @inject NavigationManager Nav; *@
|
||||||
@inject IStringLocalizer<Localization> Loc;
|
@inject IStringLocalizer<Localization> Loc;
|
||||||
|
|
||||||
<SectionContent SectionName="top-bar">
|
<SectionContent SectionName="top-bar">
|
||||||
|
|
Loading…
Add table
Reference in a new issue