Files
SpotiParty/SpotiParty.Web/Services/AdminDashboardPlugin.cs

27 lines
828 B
C#

using HopFrame.Core.Config;
using HopFrame.Web.Plugins.Events;
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components;
using SpotiParty.Web.Models;
namespace SpotiParty.Web.Services;
public class AdminDashboardPlugin(NavigationManager navigator) {
[HopFrame.Web.Plugins.Annotations.EventHandler]
public void OnTableInitialized(TableInitializedEvent e) {
if (e.Table.TableType != typeof(Event)) return;
e.AddEntityButton(new IconInfo {
Variant = IconVariant.Regular,
Size = IconSize.Size16,
Name = "Open"
}, OnButtonClicked);
}
private void OnButtonClicked(object o, TableConfig config) {
var entity = (Event)o;
navigator.NavigateTo(navigator.BaseUri + $"enqueue/{entity.Id}");
}
}