Refactored project to module structure
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Moonlight.Frontend.Infrastructure.Hooks;
|
||||
|
||||
namespace Moonlight.Frontend.Infrastructure.Configuration;
|
||||
|
||||
public class LayoutMiddlewareOptions
|
||||
{
|
||||
private readonly List<Type> InnerComponents = new();
|
||||
public IReadOnlyList<Type> Components => InnerComponents;
|
||||
|
||||
public void Add<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>() where T : LayoutMiddlewareBase
|
||||
{
|
||||
InnerComponents.Add(typeof(T));
|
||||
}
|
||||
|
||||
public void Insert<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(int index)
|
||||
where T : LayoutMiddlewareBase
|
||||
{
|
||||
InnerComponents.Insert(index, typeof(T));
|
||||
}
|
||||
|
||||
public void Remove<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>()
|
||||
where T : LayoutMiddlewareBase
|
||||
{
|
||||
InnerComponents.Remove(typeof(T));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Moonlight.Frontend.Infrastructure.Configuration;
|
||||
|
||||
public class LayoutPageOptions
|
||||
{
|
||||
private readonly List<LayoutPageComponent> InnerComponents = new();
|
||||
public IReadOnlyList<LayoutPageComponent> Components => InnerComponents;
|
||||
|
||||
public void Add<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(LayoutPageSlot slot, int order)
|
||||
where T : ComponentBase
|
||||
{
|
||||
Add(typeof(T), slot, order);
|
||||
}
|
||||
|
||||
public void Add(Type componentType, LayoutPageSlot slot, int order)
|
||||
{
|
||||
InnerComponents.Add(new LayoutPageComponent(componentType, order, slot));
|
||||
}
|
||||
|
||||
public void Remove<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>()
|
||||
where T : ComponentBase
|
||||
{
|
||||
Remove(typeof(T));
|
||||
}
|
||||
|
||||
public void Remove(Type componentType)
|
||||
{
|
||||
InnerComponents.RemoveAll(x => x.ComponentType == componentType);
|
||||
}
|
||||
}
|
||||
|
||||
public record LayoutPageComponent(Type ComponentType, int Order, LayoutPageSlot Slot);
|
||||
|
||||
public enum LayoutPageSlot
|
||||
{
|
||||
Header = 0,
|
||||
Footer = 1
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace Moonlight.Frontend.Infrastructure.Configuration;
|
||||
|
||||
public class NavigationAssemblyOptions
|
||||
{
|
||||
public List<Assembly> Assemblies { get; private set; } = new();
|
||||
}
|
||||
Reference in New Issue
Block a user