This commit is contained in:
2026-07-18 15:21:20 -04:00
parent 6062d5b60c
commit 74f065e0f5
51 changed files with 634 additions and 285 deletions
+5 -3
View File
@@ -1,4 +1,3 @@
@using Shared.Services
@implements IDisposable
@inject CardPreviewService PreviewService
@namespace Shared.Components
@@ -7,12 +6,13 @@
{
<div class="card-preview-popup" style="left: @(PreviewService.X + 20)px; top: @(PreviewService.Y)px;">
<div class="preview-content">
<img src="@PreviewService.HoveredCard.ImagePath" alt="@PreviewService.HoveredCard.Name" />
<img src="@PreviewService.HoveredCard.ImagePath" alt="@PreviewService.HoveredCard.Name"/>
<div class="preview-info">
<strong>@PreviewService.HoveredCard.Name</strong>
@if (PreviewService.HoveredCard.Cost.HasValue)
{
<span class="preview-cost"><i class="bi bi-lightning-fill"></i> @PreviewService.HoveredCard.Cost</span>
<span class="preview-cost"><i
class="bi bi-lightning-fill"></i> @PreviewService.HoveredCard.Cost</span>
}
</div>
</div>
@@ -20,6 +20,7 @@
}
@code {
protected override void OnInitialized()
{
PreviewService.OnChange += StateHasChanged;
@@ -29,4 +30,5 @@
{
PreviewService.OnChange -= StateHasChanged;
}
}
+32 -8
View File
@@ -85,7 +85,8 @@
tableLines.Add(trimmedLine);
continue;
}
else if (inTable)
if (inTable)
{
RenderTable(builder, ref seq, tableLines);
tableLines.Clear();
@@ -100,13 +101,15 @@
builder.OpenElement(seq++, "ul");
inList = true;
}
var isCardListItem = trimmedLine.Contains("[[") && trimmedLine.Contains("]]");
builder.OpenElement(seq++, "li");
RenderInlines(builder, ref seq, trimmedLine[2..], true);
builder.CloseElement();
continue;
}
else if (inList)
if (inList)
{
builder.CloseElement(); // Close ul
inList = false;
@@ -167,6 +170,7 @@
RenderInlines(builder, ref seq, cell.Trim(), false);
builder.CloseElement();
}
builder.CloseElement();
builder.CloseElement();
startIdx = 2;
@@ -184,8 +188,10 @@
RenderInlines(builder, ref seq, cell.Trim(), false);
builder.CloseElement();
}
builder.CloseElement();
}
builder.CloseElement();
builder.CloseElement();
builder.CloseElement();
@@ -194,7 +200,7 @@
private void RenderInlines(RenderTreeBuilder builder, ref int seq, string text, bool renderAsImage)
{
var remaining = text;
while (!string.IsNullOrEmpty(remaining))
{
var boldMatch = Regex.Match(remaining, @"\*\*(.*?)\*\*");
@@ -203,11 +209,28 @@
var bestIdx = int.MaxValue;
Match? bestMatch = null;
int matchType = 0; // 1: bold, 2: italic, 3: card
var matchType = 0; // 1: bold, 2: italic, 3: card
if (boldMatch.Success && boldMatch.Index < bestIdx) { bestIdx = boldMatch.Index; bestMatch = boldMatch; matchType = 1; }
if (italicMatch.Success && italicMatch.Index < bestIdx) { bestIdx = italicMatch.Index; bestMatch = italicMatch; matchType = 2; }
if (cardMatch.Success && cardMatch.Index < bestIdx) { bestIdx = cardMatch.Index; bestMatch = cardMatch; matchType = 3; }
if (boldMatch.Success && boldMatch.Index < bestIdx)
{
bestIdx = boldMatch.Index;
bestMatch = boldMatch;
matchType = 1;
}
if (italicMatch.Success && italicMatch.Index < bestIdx)
{
bestIdx = italicMatch.Index;
bestMatch = italicMatch;
matchType = 2;
}
if (cardMatch.Success && cardMatch.Index < bestIdx)
{
bestIdx = cardMatch.Index;
bestMatch = cardMatch;
matchType = 3;
}
if (bestMatch != null)
{
@@ -215,7 +238,7 @@
builder.AddContent(seq++, remaining[..bestIdx]);
var innerText = bestMatch.Groups[1].Value;
if (matchType == 1) // Bold
{
builder.OpenElement(seq++, "strong");
@@ -255,4 +278,5 @@
}
}
}
}
@@ -8,8 +8,12 @@
}
@keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.card-detail {
@@ -148,17 +152,42 @@
font-weight: 700;
}
.markdown-content h2 { font-size: 1.5rem; }
.markdown-content h3 { font-size: 1.3rem; }
.markdown-content h4 { font-size: 1.1rem; }
.markdown-content h2 {
font-size: 1.5rem;
}
.markdown-content h3 {
font-size: 1.3rem;
}
.markdown-content h4 {
font-size: 1.1rem;
}
/* Syndicate Colors */
.lifeblood { color: #4caf50; }
.phasetide { color: #2196f3; }
.silence { color: #9c27b0; }
.singularity { color: #ffffff; }
.splintergleam { color: #f44336; }
.sungrace { color: #ff9800; }
.lifeblood {
color: #4caf50;
}
.phasetide {
color: #2196f3;
}
.silence {
color: #9c27b0;
}
.singularity {
color: #ffffff;
}
.splintergleam {
color: #f44336;
}
.sungrace {
color: #ff9800;
}
.inline-card-btn {
background: none;
@@ -194,6 +223,7 @@
width: 95vw;
max-height: 90vh;
}
.detail-layout {
padding: 2rem 1.25rem;
}
@@ -91,7 +91,8 @@
tableLines.Add(trimmedLine);
continue;
}
else if (inTable)
if (inTable)
{
RenderTable(builder, ref seq, tableLines);
tableLines.Clear();
@@ -106,13 +107,15 @@
builder.OpenElement(seq++, "ul");
inList = true;
}
var isCardListItem = trimmedLine.Contains("[[") && trimmedLine.Contains("]]");
builder.OpenElement(seq++, "li");
RenderInlines(builder, ref seq, trimmedLine[2..], true);
builder.CloseElement();
continue;
}
else if (inList)
if (inList)
{
builder.CloseElement(); // Close ul
inList = false;
@@ -173,6 +176,7 @@
RenderInlines(builder, ref seq, cell.Trim(), false);
builder.CloseElement();
}
builder.CloseElement();
builder.CloseElement();
startIdx = 2;
@@ -190,8 +194,10 @@
RenderInlines(builder, ref seq, cell.Trim(), false);
builder.CloseElement();
}
builder.CloseElement();
}
builder.CloseElement();
builder.CloseElement();
builder.CloseElement();
@@ -201,7 +207,7 @@
{
// Simple regex-based inline parser for Bold, Italics, and [[Card Links]]
var remaining = text;
while (!string.IsNullOrEmpty(remaining))
{
var boldMatch = Regex.Match(remaining, @"\*\*(.*?)\*\*");
@@ -210,11 +216,28 @@
var bestIdx = int.MaxValue;
Match? bestMatch = null;
int matchType = 0; // 1: bold, 2: italic, 3: card
var matchType = 0; // 1: bold, 2: italic, 3: card
if (boldMatch.Success && boldMatch.Index < bestIdx) { bestIdx = boldMatch.Index; bestMatch = boldMatch; matchType = 1; }
if (italicMatch.Success && italicMatch.Index < bestIdx) { bestIdx = italicMatch.Index; bestMatch = italicMatch; matchType = 2; }
if (cardMatch.Success && cardMatch.Index < bestIdx) { bestIdx = cardMatch.Index; bestMatch = cardMatch; matchType = 3; }
if (boldMatch.Success && boldMatch.Index < bestIdx)
{
bestIdx = boldMatch.Index;
bestMatch = boldMatch;
matchType = 1;
}
if (italicMatch.Success && italicMatch.Index < bestIdx)
{
bestIdx = italicMatch.Index;
bestMatch = italicMatch;
matchType = 2;
}
if (cardMatch.Success && cardMatch.Index < bestIdx)
{
bestIdx = cardMatch.Index;
bestMatch = cardMatch;
matchType = 3;
}
if (bestMatch != null)
{
@@ -222,7 +245,7 @@
builder.AddContent(seq++, remaining[..bestIdx]);
var innerText = bestMatch.Groups[1].Value;
if (matchType == 1) // Bold
{
builder.OpenElement(seq++, "strong");
@@ -262,4 +285,5 @@
}
}
}
}
@@ -8,8 +8,12 @@
}
@keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.card-detail {
@@ -189,17 +193,42 @@
font-weight: 700;
}
.markdown-content h2 { font-size: 1.5rem; }
.markdown-content h3 { font-size: 1.3rem; }
.markdown-content h4 { font-size: 1.1rem; }
.markdown-content h2 {
font-size: 1.5rem;
}
.markdown-content h3 {
font-size: 1.3rem;
}
.markdown-content h4 {
font-size: 1.1rem;
}
/* Syndicate Colors */
.lifeblood { color: #4caf50; }
.phasetide { color: #2196f3; }
.silence { color: #9c27b0; }
.singularity { color: #ffffff; }
.splintergleam { color: #f44336; }
.sungrace { color: #ff9800; }
.lifeblood {
color: #4caf50;
}
.phasetide {
color: #2196f3;
}
.silence {
color: #9c27b0;
}
.singularity {
color: #ffffff;
}
.splintergleam {
color: #f44336;
}
.sungrace {
color: #ff9800;
}
.inline-card-btn {
background: none;
@@ -235,6 +264,7 @@
width: 95vw;
max-height: 90vh;
}
.detail-layout {
padding: 2rem 1.25rem;
}