Implemented extendable system settings tab. Started implementing white labeling settings

This commit is contained in:
2026-02-21 22:20:51 +01:00
parent 94c1aac0ac
commit 9d557eea4e
13 changed files with 276 additions and 22 deletions

View File

@@ -0,0 +1,34 @@
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Components;
namespace Moonlight.Frontend.Configuration;
public class SystemSettingsOptions
{
public IReadOnlyList<SystemSettingsPage> Components => InnerComponents;
private readonly List<SystemSettingsPage> InnerComponents = new();
public void Add<TIcon, TComponent>(string name, string description, int order)
where TIcon : ComponentBase where TComponent : ComponentBase
=> Add(name, description, order, typeof(TIcon), typeof(TComponent));
public void Add(string name, string description, int order, Type iconComponent, Type component)
=> InnerComponents.Add(new SystemSettingsPage(name, description, order, iconComponent, component));
public void Remove<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TComponent>()
where TComponent : ComponentBase
=> Remove(typeof(TComponent));
public void Remove(Type componentType)
=> InnerComponents.RemoveAll(x => x.ComponentType == componentType);
}
public record SystemSettingsPage(
string Name,
string Description,
int Order,
[property: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
Type IconComponentType,
Type ComponentType
);