Vibe Google Analytics

This commit is contained in:
2026-06-25 18:55:04 -04:00
parent fdf8e754f5
commit 73ae3eac53
86 changed files with 53925 additions and 46039 deletions
+9 -13
View File
@@ -1,13 +1,13 @@
using Microsoft.AspNetCore.Components;
using System.Text.RegularExpressions;
using Chrono.Model;
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Components;
namespace Shared.Services;
public class CardRenderingService
{
private readonly List<string> _cardNames;
private readonly Dictionary<string, CardData> _cardLookup;
private readonly List<string> _cardNames;
private readonly Regex _nameRegex;
public CardRenderingService()
@@ -33,7 +33,7 @@ public class CardRenderingService
{
return builder =>
{
int sequence = 0;
var sequence = 0;
var paragraphs = description.Split('\n', StringSplitOptions.RemoveEmptyEntries);
foreach (var paragraph in paragraphs)
@@ -41,31 +41,27 @@ public class CardRenderingService
builder.OpenElement(sequence++, "p");
var matches = _nameRegex.Matches(paragraph);
int lastIndex = 0;
var lastIndex = 0;
foreach (Match match in matches)
{
if (match.Index > lastIndex)
{
builder.AddContent(sequence++, paragraph.Substring(lastIndex, match.Index - lastIndex));
}
var cardName = match.Value;
var card = LookupCard(cardName);
builder.OpenElement(sequence++, "button");
builder.AddAttribute(sequence++, "class", "inline-card-btn");
builder.AddAttribute(sequence++, "onclick", EventCallback.Factory.Create(this, () => onCardClick(card)));
builder.AddAttribute(sequence++, "onclick",
EventCallback.Factory.Create(this, () => onCardClick(card)));
builder.AddContent(sequence++, cardName);
builder.CloseElement();
lastIndex = match.Index + match.Length;
}
if (lastIndex < paragraph.Length)
{
builder.AddContent(sequence++, paragraph.Substring(lastIndex));
}
if (lastIndex < paragraph.Length) builder.AddContent(sequence++, paragraph.Substring(lastIndex));
builder.CloseElement();
}
@@ -76,4 +72,4 @@ public class CardRenderingService
{
return _cardLookup.GetValueOrDefault(cardName);
}
}
}