This commit is contained in:
6d486f49
2026-08-17 00:45:08 -04:00
parent 3a2f112a73
commit 1d6207fbfe
154 changed files with 126007 additions and 47385 deletions
@@ -1,14 +1,15 @@
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Model;
namespace Shared.Services;
public class CardRenderingService
{
private readonly List<string> _allTerms;
private readonly Dictionary<string, CardData> _cardLookup;
private readonly Dictionary<string, DocData> _docLookup;
private readonly List<string> _allTerms;
private readonly Regex _termRegex;
public CardRenderingService()
@@ -39,7 +40,8 @@ public class CardRenderingService
_termRegex = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Compiled);
}
public RenderFragment RenderDescription(string description, Action<CardData?> onCardClick, Action<DocData?>? onDocClick = null, CardPreviewService? previewService = null)
public RenderFragment RenderDescription(string description, Action<CardData?> onCardClick,
Action<DocData?>? onDocClick = null, CardPreviewService? previewService = null)
{
return builder =>
{
@@ -69,12 +71,13 @@ public class CardRenderingService
{
builder.AddAttribute(sequence++, "onclick",
EventCallback.Factory.Create(this, () => onCardClick(card)));
if (previewService != null)
{
builder.AddAttribute(sequence++, "onmouseenter",
EventCallback.Factory.Create<Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, e => previewService.Show(card, e.ClientX, e.ClientY)));
builder.AddAttribute(sequence++, "onmouseleave",
builder.AddAttribute(sequence++, "onmouseenter",
EventCallback.Factory.Create<MouseEventArgs>(this,
e => previewService.Show(card, e.ClientX, e.ClientY)));
builder.AddAttribute(sequence++, "onmouseleave",
EventCallback.Factory.Create(this, () => previewService.Hide()));
}
}