Compare commits

...

11 Commits

1496 changed files with 6556 additions and 1578 deletions
+31 -30
View File
@@ -1,10 +1,10 @@
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Chrono.Model; using Model;
var repoRoot = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "..")); var repoRoot = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", ".."));
var docsDir = Path.Combine(repoRoot, "chrono.docs"); var docsDir = Path.Combine(repoRoot, "chrono.docs");
var webWwwRoot = Path.Combine(repoRoot, "Chrono", "Web", "wwwroot"); var webWwwRoot = Path.Combine(repoRoot, "Chrono", "Standalone", "wwwroot");
var generatedFile = Path.Combine(repoRoot, "Chrono", "Shared", "Generated", "Cards.g.cs"); var generatedFile = Path.Combine(repoRoot, "Chrono", "Shared", "Generated", "Cards.g.cs");
Console.WriteLine($"Repo root: {repoRoot}"); Console.WriteLine($"Repo root: {repoRoot}");
@@ -49,7 +49,7 @@ foreach (var file in mdFiles)
Attack = ParseInt(yaml, "attack"), Attack = ParseInt(yaml, "attack"),
Health = ParseInt(yaml, "health"), Health = ParseInt(yaml, "health"),
Description = StripWikiLinks(yaml.GetValueOrDefault("description")), Description = StripWikiLinks(yaml.GetValueOrDefault("description")),
Faction = StripWikiLink(yaml.GetValueOrDefault("faction")), Syndicate = StripWikiLink(yaml.GetValueOrDefault("faction")),
Set = StripWikiLink(yaml.GetValueOrDefault("set")), Set = StripWikiLink(yaml.GetValueOrDefault("set")),
Speed = StripWikiLink(yaml.GetValueOrDefault("speed")), Speed = StripWikiLink(yaml.GetValueOrDefault("speed")),
Archetypes = ParseList(yaml, "archetypes").Select(s => StripWikiLink(s) ?? "").Where(s => s != "").ToList(), Archetypes = ParseList(yaml, "archetypes").Select(s => StripWikiLink(s) ?? "").Where(s => s != "").ToList(),
@@ -66,32 +66,13 @@ foreach (var file in mdFiles)
cards.Add(card); cards.Add(card);
} }
// Copy PNGs to wwwroot/cards
var cardsDir = Path.Combine(webWwwRoot, "cards");
Directory.CreateDirectory(cardsDir);
var pngFiles = Directory.GetFiles(docsDir, "*.png", SearchOption.AllDirectories);
var pngMap = pngFiles
.GroupBy(Path.GetFileName)
.ToDictionary(g => g.Key!, g => g.First(), StringComparer.OrdinalIgnoreCase);
foreach (var card in cards)
{
if (card.ImageFile == null) continue;
if (pngMap.TryGetValue(card.ImageFile, out var src))
{
var dst = Path.Combine(cardsDir, card.ImageFile);
File.Copy(src, dst, true);
}
}
// Generate C# source file // Generate C# source file
Directory.CreateDirectory(Path.GetDirectoryName(generatedFile)!); Directory.CreateDirectory(Path.GetDirectoryName(generatedFile)!);
using var writer = new StreamWriter(generatedFile, false, Encoding.UTF8); using var writer = new StreamWriter(generatedFile, false, Encoding.UTF8);
writer.WriteLine("// <auto-generated/>"); writer.WriteLine("// <auto-generated/>");
writer.WriteLine("#nullable enable"); writer.WriteLine("#nullable enable");
writer.WriteLine(); writer.WriteLine();
writer.WriteLine("namespace Chrono.Model;"); writer.WriteLine("namespace Model;");
writer.WriteLine(); writer.WriteLine();
writer.WriteLine("public static class CardDatabase"); writer.WriteLine("public static class CardDatabase");
writer.WriteLine("{"); writer.WriteLine("{");
@@ -109,7 +90,7 @@ for (var i = 0; i < cards.Count; i++)
WriteNullProp(writer, "Attack", c.Attack, 3); WriteNullProp(writer, "Attack", c.Attack, 3);
WriteNullProp(writer, "Health", c.Health, 3); WriteNullProp(writer, "Health", c.Health, 3);
WriteStrProp(writer, "Description", c.Description, 3); WriteStrProp(writer, "Description", c.Description, 3);
WriteStrProp(writer, "Faction", c.Faction, 3); WriteStrProp(writer, "Syndicate", c.Syndicate, 3);
WriteStrProp(writer, "Set", c.Set, 3); WriteStrProp(writer, "Set", c.Set, 3);
WriteStrProp(writer, "Speed", c.Speed, 3); WriteStrProp(writer, "Speed", c.Speed, 3);
WriteListProp(writer, "Archetypes", c.Archetypes, 3); WriteListProp(writer, "Archetypes", c.Archetypes, 3);
@@ -157,7 +138,7 @@ foreach (var file in deckFiles)
Divers = ParseList(yaml, "divers").Select(s => StripWikiLink(s) ?? "").Where(s => s != "").ToList(), Divers = ParseList(yaml, "divers").Select(s => StripWikiLink(s) ?? "").Where(s => s != "").ToList(),
Description = StripWikiLinks(NullIfNa(yaml.GetValueOrDefault("description")))?.Replace("\r\n", "\n") Description = StripWikiLinks(NullIfNa(yaml.GetValueOrDefault("description")))?.Replace("\r\n", "\n")
.Replace("\r", "\n").Replace("\n\n", "\n").Replace("\n\n", "\n"), .Replace("\r", "\n").Replace("\n\n", "\n").Replace("\n\n", "\n"),
Factions = ParseList(yaml, "factions").Select(s => StripWikiLink(s) ?? "").Where(s => s != "").ToList(), Syndicates = ParseList(yaml, "factions").Select(s => StripWikiLink(s) ?? "").Where(s => s != "").ToList(),
IsVisible = isVisible, IsVisible = isVisible,
DeckCode = deckCode, DeckCode = deckCode,
DeckType = yaml.GetValueOrDefault("deckType") DeckType = yaml.GetValueOrDefault("deckType")
@@ -175,7 +156,7 @@ using var deckWriter = new StreamWriter(deckGeneratedFile, false, Encoding.UTF8)
deckWriter.WriteLine("// <auto-generated/>"); deckWriter.WriteLine("// <auto-generated/>");
deckWriter.WriteLine("#nullable enable"); deckWriter.WriteLine("#nullable enable");
deckWriter.WriteLine(); deckWriter.WriteLine();
deckWriter.WriteLine("namespace Chrono.Model;"); deckWriter.WriteLine("namespace Model;");
deckWriter.WriteLine(); deckWriter.WriteLine();
deckWriter.WriteLine("public static class DeckDatabase"); deckWriter.WriteLine("public static class DeckDatabase");
deckWriter.WriteLine("{"); deckWriter.WriteLine("{");
@@ -192,7 +173,7 @@ for (var i = 0; i < decks.Count; i++)
WriteListProp(deckWriter, "Keycards", d.Keycards, 3); WriteListProp(deckWriter, "Keycards", d.Keycards, 3);
WriteListProp(deckWriter, "Divers", d.Divers, 3); WriteListProp(deckWriter, "Divers", d.Divers, 3);
WriteStrProp(deckWriter, "Description", d.Description, 3); WriteStrProp(deckWriter, "Description", d.Description, 3);
WriteListProp(deckWriter, "Factions", d.Factions, 3); WriteListProp(deckWriter, "Syndicates", d.Syndicates, 3);
deckWriter.WriteLine($" IsVisible = {(d.IsVisible ? "true" : "false")},"); deckWriter.WriteLine($" IsVisible = {(d.IsVisible ? "true" : "false")},");
WriteStrProp(deckWriter, "DeckCode", d.DeckCode, 3); WriteStrProp(deckWriter, "DeckCode", d.DeckCode, 3);
WriteStrProp(deckWriter, "DeckType", d.DeckType, 3); WriteStrProp(deckWriter, "DeckType", d.DeckType, 3);
@@ -229,19 +210,38 @@ foreach (var file in mdFiles)
} }
} }
var category = yaml.GetValueOrDefault("category") ?? Path.GetFileName(Path.GetDirectoryName(file)) ?? ""; var category = yaml.GetValueOrDefault("category");
if (category == null)
{
var parentDir = Path.GetFileName(Path.GetDirectoryName(file)) ?? "";
category = parentDir;
}
if (excludedCategories.Contains(category)) continue; if (excludedCategories.Contains(category)) continue;
// Also exclude files that look like base templates // Also exclude files that look like base templates
var fileName = Path.GetFileName(file); var fileName = Path.GetFileName(file);
if (fileName.StartsWith("_")) continue; if (fileName.StartsWith("_")) continue;
// Special handling for Syndicates and Syndicate Pairings
List<string>? syndicatesProp = null;
if (category == "Syndicate Pairings")
{
syndicatesProp = ParseList(yaml, "syndicates");
}
else if (category == "Syndicate" || category == "Faction")
{
syndicatesProp = [Path.GetFileNameWithoutExtension(file)];
category = "Syndicate"; // Normalize Faction to Syndicate
}
docs.Add(new DocData docs.Add(new DocData
{ {
Title = Path.GetFileNameWithoutExtension(file), Title = Path.GetFileNameWithoutExtension(file),
Category = category, Category = category,
Content = body, Content = body,
Frontmatter = yaml Frontmatter = yaml,
Syndicates = syndicatesProp
}); });
} }
@@ -251,7 +251,7 @@ using var docWriter = new StreamWriter(docGeneratedFile, false, Encoding.UTF8);
docWriter.WriteLine("// <auto-generated/>"); docWriter.WriteLine("// <auto-generated/>");
docWriter.WriteLine("#nullable enable"); docWriter.WriteLine("#nullable enable");
docWriter.WriteLine(); docWriter.WriteLine();
docWriter.WriteLine("namespace Chrono.Model;"); docWriter.WriteLine("namespace Model;");
docWriter.WriteLine(); docWriter.WriteLine();
docWriter.WriteLine("public static class DocDatabase"); docWriter.WriteLine("public static class DocDatabase");
docWriter.WriteLine("{"); docWriter.WriteLine("{");
@@ -267,6 +267,7 @@ for (var i = 0; i < docs.Count; i++)
WriteProp(docWriter, "Category", d.Category, 3); WriteProp(docWriter, "Category", d.Category, 3);
WriteStrProp(docWriter, "Content", d.Content, 3); WriteStrProp(docWriter, "Content", d.Content, 3);
WriteDictProp(docWriter, "Frontmatter", d.Frontmatter, 3); WriteDictProp(docWriter, "Frontmatter", d.Frontmatter, 3);
WriteListProp(docWriter, "Syndicates", d.Syndicates, 3);
var comma = i < docs.Count - 1 ? "," : ""; var comma = i < docs.Count - 1 ? "," : "";
docWriter.WriteLine($" }}{comma}"); docWriter.WriteLine($" }}{comma}");
} }
-133
View File
@@ -1,133 +0,0 @@
"""
One-time script: Download card images from playchrono.com and add imageLink frontmatter.
Usage:
python process_cards.py
Requires a saved HTML copy of https://www.playchrono.com/collections/cards
with the embedded JSON.parse('...') card data.
"""
import re
import json
import os
import urllib.request
import sys
# Adjust these paths for your environment
html_file = r"../playchrono_cards_page.html"
docs_dir = r"../../chrono.docs"
if not os.path.exists(html_file):
# Fallback: search for saved tool output
possible = [f for f in os.listdir(r"C:\Users\jonmc\.local\share\opencode\tool-output")
if f.startswith("tool_") and os.path.isfile(os.path.join(r"C:\Users\jonmc\.local\share\opencode\tool-output", f))]
if possible:
html_file = os.path.join(r"C:\Users\jonmc\.local\share\opencode\tool-output", possible[-1])
with open(html_file, 'r', encoding='utf-8') as f:
html = f.read()
start_marker = "JSON.parse('"
idx = html.find(start_marker)
if idx < 0:
print("ERROR: Could not find JSON.parse in HTML")
sys.exit(1)
start = idx + len(start_marker)
quote_end = html.find("')", start)
if quote_end < 0:
print("ERROR: Could not find closing '")
sys.exit(1)
raw_json_str = html[start:quote_end]
json_str = raw_json_str.encode('utf-8').decode('unicode_escape')
json_str = json_str.replace('\\/', '/')
try:
cards = json.loads(json_str)
except json.JSONDecodeError as e:
print(f"ERROR parsing JSON: {e}")
sys.exit(1)
print(f"Found {len(cards)} cards")
name_to_image = {}
for card in cards:
name = card.get('name', '')
image_url = card.get('image_url', '')
if name and image_url:
name_to_image[name.lower()] = image_url
counterpart = card.get('counterpart')
if counterpart and isinstance(counterpart, dict):
cname = counterpart.get('name', '')
cimage = counterpart.get('image_url', '')
if cname and cimage:
name_to_image[cname.lower()] = cimage
print(f"Built mapping for {len(name_to_image)} card names")
md_files = [f for f in os.listdir(docs_dir) if f.endswith('.md')]
print(f"Found {len(md_files)} markdown files")
processed = 0
downloaded = 0
matched = 0
for md_file in sorted(md_files):
filepath = os.path.join(docs_dir, md_file)
card_name = md_file[:-3]
card_name_lower = card_name.lower()
if card_name_lower not in name_to_image:
continue
matched += 1
image_url = name_to_image[card_name_lower]
png_filename = f"{card_name}.png"
png_filepath = os.path.join(docs_dir, png_filename)
if not os.path.exists(png_filepath):
try:
print(f" DL: {png_filename}")
req = urllib.request.Request(image_url, headers={
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36'
})
with urllib.request.urlopen(req) as response:
with open(png_filepath, 'wb') as out:
out.write(response.read())
downloaded += 1
except Exception as e:
print(f" ERR: {png_filename} - {e}")
continue
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
has_image_link = 'imageLink:' in content
img_ref = f"![[{png_filename}]]"
has_img_ref = img_ref in content
if has_image_link and has_img_ref:
continue
modified = content
if not has_image_link:
modified = modified.rstrip()
if modified.endswith('---'):
modified = modified[:-3] + f'imageLink: "[[{png_filename}]]"\n---'
else:
modified = modified + f'\nimageLink: "[[{png_filename}]]"\n'
if not has_img_ref:
modified = modified.rstrip() + f'\n\n\n{img_ref}\n'
with open(filepath, 'w', encoding='utf-8') as f:
f.write(modified)
processed += 1
print(f"\nDone! Matched: {matched}, Downloaded: {downloaded}, Updated markdown: {processed}")
print(f"Skipped (no card match): {len(md_files) - matched}")
+28 -2
View File
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web", "Web\Web.csproj", "{18981096-443A-44BF-AE56-6499C2B03AEF}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Standalone", "Standalone\Standalone.csproj", "{18981096-443A-44BF-AE56-6499C2B03AEF}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "Build\Build.csproj", "{36E3775C-0E28-4EAE-AE92-4FB493E3787F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "Build\Build.csproj", "{36E3775C-0E28-4EAE-AE92-4FB493E3787F}"
EndProject EndProject
@@ -10,10 +10,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deploy", "Deploy\Deploy.csp
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{90F32056-6983-4224-8A8C-E797C71633F3}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{90F32056-6983-4224-8A8C-E797C71633F3}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{BFB7B73F-EFDD-4DE8-89F2-E1CBE1B55C27}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cloud", "Cloud\Cloud.csproj", "{BFB7B73F-EFDD-4DE8-89F2-E1CBE1B55C27}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\Shared.csproj", "{30D8468D-01E1-4D8A-99AF-EE4A75A5E956}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\Shared.csproj", "{30D8468D-01E1-4D8A-99AF-EE4A75A5E956}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Markdown", "Markdown\Markdown.csproj", "{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "md", "md", "{A4C572E4-E709-4553-B42F-709BFFFE0A7E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{92ED656F-1D94-4348-97AD-B76094B14A8E}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -108,8 +114,28 @@ Global
{30D8468D-01E1-4D8A-99AF-EE4A75A5E956}.Release|x64.Build.0 = Release|Any CPU {30D8468D-01E1-4D8A-99AF-EE4A75A5E956}.Release|x64.Build.0 = Release|Any CPU
{30D8468D-01E1-4D8A-99AF-EE4A75A5E956}.Release|x86.ActiveCfg = Release|Any CPU {30D8468D-01E1-4D8A-99AF-EE4A75A5E956}.Release|x86.ActiveCfg = Release|Any CPU
{30D8468D-01E1-4D8A-99AF-EE4A75A5E956}.Release|x86.Build.0 = Release|Any CPU {30D8468D-01E1-4D8A-99AF-EE4A75A5E956}.Release|x86.Build.0 = Release|Any CPU
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}.Debug|x64.ActiveCfg = Debug|Any CPU
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}.Debug|x64.Build.0 = Debug|Any CPU
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}.Debug|x86.ActiveCfg = Debug|Any CPU
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}.Debug|x86.Build.0 = Debug|Any CPU
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}.Release|Any CPU.Build.0 = Release|Any CPU
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}.Release|x64.ActiveCfg = Release|Any CPU
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}.Release|x64.Build.0 = Release|Any CPU
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}.Release|x86.ActiveCfg = Release|Any CPU
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{BA7A908C-FEF7-4AC7-ABCE-437259A6C34C} = {A4C572E4-E709-4553-B42F-709BFFFE0A7E}
{36E3775C-0E28-4EAE-AE92-4FB493E3787F} = {92ED656F-1D94-4348-97AD-B76094B14A8E}
{90F32056-6983-4224-8A8C-E797C71633F3} = {92ED656F-1D94-4348-97AD-B76094B14A8E}
{30D8468D-01E1-4D8A-99AF-EE4A75A5E956} = {92ED656F-1D94-4348-97AD-B76094B14A8E}
{3358AF7A-603B-4BAC-A7F5-07978FB87843} = {92ED656F-1D94-4348-97AD-B76094B14A8E}
{E5E9A799-76C8-43B3-B9C2-3CAEC2B5E1DD} = {92ED656F-1D94-4348-97AD-B76094B14A8E}
EndGlobalSection
EndGlobal EndGlobal
@@ -1,8 +1,8 @@
using Chrono.Model; using Cloud.Models;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Server.Models; using Model;
namespace Server; namespace Cloud;
public class AppDbContext : DbContext public class AppDbContext : DbContext
{ {
@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design; using Microsoft.EntityFrameworkCore.Design;
namespace Server; namespace Cloud;
public class AppDbContextFactory : IDesignTimeDbContextFactory<AppDbContext> public class AppDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
{ {
@@ -16,13 +16,20 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="MudBlazor" Version="9.6.0"/>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.2"/> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.2"/>
</ItemGroup> </ItemGroup>
<ItemGroup>
<AdditionalFiles Include="Components\Layout\MainLayout.razor"/>
<AdditionalFiles Include="Components\Layout\NavMenu.razor"/>
</ItemGroup>
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>Cloud</RootNamespace>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
@@ -13,7 +13,7 @@
<link href="/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> <link href="/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="/_content/Telerik.UI.for.Blazor/css/kendo-theme-bootstrap/all.css" rel="stylesheet"/> <link href="/_content/Telerik.UI.for.Blazor/css/kendo-theme-bootstrap/all.css" rel="stylesheet"/>
<link href="/css/app.css" rel="stylesheet"/> <link href="/css/app.css" rel="stylesheet"/>
<link href="/Server.styles.css" rel="stylesheet"/> <link href="/Cloud.styles.css" rel="stylesheet"/>
<script defer src="/_content/Telerik.UI.for.Blazor/js/telerik-blazor.js"></script> <script defer src="/_content/Telerik.UI.for.Blazor/js/telerik-blazor.js"></script>
<script src="/js/passkey.js"></script> <script src="/js/passkey.js"></script>
<link href="/favicon.png" rel="icon" type="image/png"/> <link href="/favicon.png" rel="icon" type="image/png"/>
@@ -11,7 +11,7 @@
{ {
<div class="detail-image"> <div class="detail-image">
<img src="@Card.ImagePath" alt="@Card.Name" <img src="@Card.ImagePath" alt="@Card.Name"
onerror="this.style.display='none';this.parentElement.style.display='none'"/> onerror="this.src='@Card.SmallImagePath';this.onerror=null;"/>
</div> </div>
} }
<div class="detail-info"> <div class="detail-info">
@@ -38,11 +38,11 @@
</div> </div>
</div> </div>
@if (Card.Faction != null) @if (Card.Syndicate != null)
{ {
<div class="detail-field"> <div class="detail-field">
<span class="field-label"><i class="bi bi-flag-fill"></i> Faction</span> <span class="field-label"><i class="bi bi-flag-fill"></i> Faction</span>
<span class="field-value">@Card.Faction</span> <span class="field-value">@Card.Syndicate</span>
</div> </div>
} }
@@ -26,7 +26,7 @@
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 16px; border-radius: 16px;
padding: 0; padding: 0;
max-width: 720px; max-width: 850px;
width: 92vw; width: 92vw;
max-height: 88vh; max-height: 88vh;
overflow-y: auto; overflow-y: auto;
@@ -76,13 +76,15 @@
} }
.detail-image { .detail-image {
flex: 0 0 260px; flex: 0 0 320px;
} }
.detail-image img { .detail-image img {
width: 100%; width: 100%;
border-radius: var(--radius); border-radius: var(--radius);
box-shadow: var(--shadow); box-shadow: var(--shadow);
max-height: 80vh;
object-fit: contain;
} }
/* ── No-image layout ── */ /* ── No-image layout ── */
@@ -1,5 +1,5 @@
@namespace Shared.Layout
@inherits LayoutComponentBase @inherits LayoutComponentBase
@inject Shared.Services.CardPreviewService PreviewService
<div class="page"> <div class="page">
<div class="sidebar"> <div class="sidebar">
<NavMenu/> <NavMenu/>
@@ -10,6 +10,9 @@
<article class="content px-4"> <article class="content px-4">
<TelerikRootComponent> <TelerikRootComponent>
@Body @Body
<Shared.Components.CardPreview />
<Shared.Components.DocDetailModal Doc="@PreviewService.SelectedDoc"
OnClose="@(() => PreviewService.SelectDoc(null))" />
</TelerikRootComponent> </TelerikRootComponent>
</article> </article>
</main> </main>
@@ -1,5 +1,3 @@
@namespace Shared.Layout
<div class="top-row ps-3 navbar navbar-dark"> <div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href=""> <a class="navbar-brand" href="">
@@ -14,12 +12,12 @@
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu"> <div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
<nav class="nav flex-column"> <nav class="nav flex-column">
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All"> <NavLink class="nav-link" href="home">
<i class="bi bi-house-door-fill nav-icon"></i> Home <i class="bi bi-house-door-fill nav-icon"></i> Home
</NavLink> </NavLink>
</div> </div>
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="cards"> <NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<i class="bi bi-collection-fill nav-icon"></i> Cards <i class="bi bi-collection-fill nav-icon"></i> Cards
</NavLink> </NavLink>
</div> </div>
@@ -33,6 +31,11 @@
<i class="bi bi-journal-text nav-icon"></i> Decks <i class="bi bi-journal-text nav-icon"></i> Decks
</NavLink> </NavLink>
</div> </div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="syndicates">
<i class="bi bi-diagram-2-fill nav-icon"></i> Syndicates
</NavLink>
</div>
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="my-decks"> <NavLink class="nav-link" href="my-decks">
<i class="bi bi-pencil-square nav-icon"></i> My Decks <i class="bi bi-pencil-square nav-icon"></i> My Decks
@@ -1,6 +1,7 @@
@page "/"
@page "/cards" @page "/cards"
@using Chrono.Components
@using Shared.Services @using Shared.Services
@inject HttpClient Http
@inject AnalyticsService AnalyticsService @inject AnalyticsService AnalyticsService
<PageTitle>Chrono CCG - Card Gallery</PageTitle> <PageTitle>Chrono CCG - Card Gallery</PageTitle>
@@ -28,7 +29,8 @@
<i class="bi bi-person-fill"></i> Immortalized <i class="bi bi-person-fill"></i> Immortalized
</button> </button>
<div class="tab link-toggle @(agentLink ? "active" : "")" @onclick="ToggleAgentLink" title="Link Agents and Immortalized cards"> <div class="tab link-toggle @(agentLink ? "active" : "")" @onclick="ToggleAgentLink"
title="Link Agents and Immortalized cards">
<i class="bi bi-link-45deg"></i> <i class="bi bi-link-45deg"></i>
<span>Linked</span> <span>Linked</span>
<span class="toggle-switch @(agentLink ? "on" : "off")"></span> <span class="toggle-switch @(agentLink ? "on" : "off")"></span>
@@ -134,6 +136,14 @@
<div class="card-shimmer"></div> <div class="card-shimmer"></div>
<img src="@card.ImagePath" alt="@card.Name" loading="lazy" <img src="@card.ImagePath" alt="@card.Name" loading="lazy"
onerror="this.src='data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%22280%22><rect fill=%22%23222244%22 width=%22200%22 height=%22280%22/><text fill=%22%23686888%22 font-size=%2214%22 x=%22100%22 y=%22140%22 text-anchor=%22middle%22 dominant-baseline=%22middle%22>No Image</text></svg>'"/> onerror="this.src='data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%22280%22><rect fill=%22%23222244%22 width=%22200%22 height=%22280%22/><text fill=%22%23686888%22 font-size=%2214%22 x=%22100%22 y=%22140%22 text-anchor=%22middle%22 dominant-baseline=%22middle%22>No Image</text></svg>'"/>
@if (card.IsSpell && !string.IsNullOrEmpty(card.Speed))
{
<div class="card-speed-badge" title="Speed">
<i class="bi bi-wind"></i> @card.Speed
</div>
}
@if (card.IsImmortalized) @if (card.IsImmortalized)
{ {
<div class="card-immortalize-badge" title="Immortalizes"><i class="bi bi-star-fill"></i> <div class="card-immortalize-badge" title="Immortalizes"><i class="bi bi-star-fill"></i>
@@ -200,7 +210,7 @@
{ {
allCards = CardDatabase.Cards; allCards = CardDatabase.Cards;
factions = allCards factions = allCards
.Select(c => c.Faction) .Select(c => c.Syndicate)
.Where(f => f != null) .Where(f => f != null)
.Distinct() .Distinct()
.OrderBy(f => f) .OrderBy(f => f)
@@ -212,7 +222,7 @@
var primarySet = allCards.Where(c => var primarySet = allCards.Where(c =>
c.MatchesSearch(search) && c.MatchesSearch(search) &&
(categoryFilter == "" || c.Category == categoryFilter) && (categoryFilter == "" || c.Category == categoryFilter) &&
(factionFilter == "" || c.Faction == factionFilter) && (factionFilter == "" || c.Syndicate == factionFilter) &&
(costFilter == "" || c.Cost?.ToString() == costFilter) (costFilter == "" || c.Cost?.ToString() == costFilter)
); );
@@ -272,6 +282,7 @@
seen.Add(card.Name); seen.Add(card.Name);
} }
} }
return result; return result;
} }
@@ -477,6 +477,29 @@
border: 1px solid rgba(255, 215, 0, 0.3); border: 1px solid rgba(255, 215, 0, 0.3);
} }
.card-speed-badge {
position: absolute;
top: 0.4rem;
right: 0.4rem;
background: rgba(0, 0, 0, 0.75);
backdrop-filter: blur(4px);
color: #ce93d8; /* Match spell category color */
font-weight: 700;
font-size: 0.65rem;
padding: 0.2rem 0.5rem;
border-radius: 4px;
border: 1px solid rgba(206, 147, 216, 0.3);
z-index: 2;
line-height: 1;
display: flex;
align-items: center;
gap: 0.2rem;
}
.card-speed-badge i {
font-size: 0.75rem;
}
/* ── Card Label ── */ /* ── Card Label ── */
.card-label { .card-label {
display: flex; display: flex;
@@ -1,9 +1,8 @@
@page "/deck-builder" @page "/deck-builder"
@page "/deck-builder/{Id:guid}" @page "/deck-builder/{Id:guid}"
@rendermode InteractiveServer @rendermode InteractiveServer
@using Chrono.Model
@inject AppDbContext Db
@inject NavigationManager Nav @inject NavigationManager Nav
@inject AppDbContext Db
<PageTitle>@(Id == null ? "New Deck" : "Edit Deck") - Chrono CCG</PageTitle> <PageTitle>@(Id == null ? "New Deck" : "Edit Deck") - Chrono CCG</PageTitle>
@@ -11,8 +10,10 @@
<a href="/my-decks" class="btn btn-sm btn-outline-secondary"> <a href="/my-decks" class="btn btn-sm btn-outline-secondary">
<i class="bi bi-arrow-left"></i> My Decks <i class="bi bi-arrow-left"></i> My Decks
</a> </a>
<input @bind="deckName" @bind:event="oninput" class="form-control deck-name-input" placeholder="Deck name..." maxlength="80"/> <input @bind="deckName" @bind:event="oninput" class="form-control deck-name-input" placeholder="Deck name..."
<input @bind="deckSeason" @bind:event="oninput" class="form-control season-input" placeholder="Season (e.g. S1)" maxlength="20"/> maxlength="80"/>
<input @bind="deckSeason" @bind:event="oninput" class="form-control season-input" placeholder="Season (e.g. S1)"
maxlength="20"/>
<span class="validity-badge @(IsValid ? "badge-valid" : "badge-invalid")"> <span class="validity-badge @(IsValid ? "badge-valid" : "badge-invalid")">
<i class="bi @(IsValid ? "bi-check-circle-fill" : "bi-exclamation-circle-fill")"></i> <i class="bi @(IsValid ? "bi-check-circle-fill" : "bi-exclamation-circle-fill")"></i>
@ValidationMessage @ValidationMessage
@@ -42,13 +43,16 @@
<button class="tab @(categoryFilter == "" ? "active" : "")" @onclick='() => categoryFilter = ""'> <button class="tab @(categoryFilter == "" ? "active" : "")" @onclick='() => categoryFilter = ""'>
<i class="bi bi-grid-3x3-gap-fill"></i> All <i class="bi bi-grid-3x3-gap-fill"></i> All
</button> </button>
<button class="tab agent @(categoryFilter == "Agent" ? "active" : "")" @onclick='() => categoryFilter = "Agent"'> <button class="tab agent @(categoryFilter == "Agent" ? "active" : "")"
@onclick='() => categoryFilter = "Agent"'>
<i class="bi bi-person-fill"></i> Agents <i class="bi bi-person-fill"></i> Agents
</button> </button>
<button class="tab agent @(categoryFilter == "Immortalized" ? "active" : "")" @onclick='() => categoryFilter = "Immortalized"'> <button class="tab agent @(categoryFilter == "Immortalized" ? "active" : "")"
@onclick='() => categoryFilter = "Immortalized"'>
<i class="bi bi-star-fill"></i> Immortalized <i class="bi bi-star-fill"></i> Immortalized
</button> </button>
<button class="tab spell @(categoryFilter == "Spell" ? "active" : "")" @onclick='() => categoryFilter = "Spell"'> <button class="tab spell @(categoryFilter == "Spell" ? "active" : "")"
@onclick='() => categoryFilter = "Spell"'>
<i class="bi bi-wand"></i> Spells <i class="bi bi-wand"></i> Spells
</button> </button>
</div> </div>
@@ -56,7 +60,8 @@
<div class="filter-bar"> <div class="filter-bar">
<div class="search-wrapper"> <div class="search-wrapper">
<i class="bi bi-search search-icon"></i> <i class="bi bi-search search-icon"></i>
<input @bind="search" @bind:event="oninput" class="form-control search-input" placeholder="Search cards..."/> <input @bind="search" @bind:event="oninput" class="form-control search-input"
placeholder="Search cards..."/>
@if (search.Length > 0) @if (search.Length > 0)
{ {
<button class="search-clear" @onclick='() => search = ""'><i class="bi bi-x-lg"></i></button> <button class="search-clear" @onclick='() => search = ""'><i class="bi bi-x-lg"></i></button>
@@ -73,7 +78,8 @@
@for (var c = 1; c <= 6; c++) @for (var c = 1; c <= 6; c++)
{ {
var cols = c; var cols = c;
<button class="col-btn @(gridColumns == cols ? "active" : "")" @onclick="() => gridColumns = cols">@cols</button> <button class="col-btn @(gridColumns == cols ? "active" : "")"
@onclick="() => gridColumns = cols">@cols</button>
} }
</div> </div>
</div> </div>
@@ -108,7 +114,8 @@
<div class="deck-panel"> <div class="deck-panel">
<div class="deck-status-bar"> <div class="deck-status-bar">
<span class="card-count @(deckCards.Count == 40 ? "count-ok" : deckCards.Count > 40 ? "count-over" : "count-under")"> <span
class="card-count @(deckCards.Count == 40 ? "count-ok" : deckCards.Count > 40 ? "count-over" : "count-under")">
<i class="bi bi-stack"></i> @deckCards.Count<span class="count-denom">/40</span> <i class="bi bi-stack"></i> @deckCards.Count<span class="count-denom">/40</span>
</span> </span>
<button class="btn btn-sm btn-outline-danger ms-auto" @onclick="ClearDeck" title="Clear deck"> <button class="btn btn-sm btn-outline-danger ms-auto" @onclick="ClearDeck" title="Clear deck">
@@ -158,7 +165,8 @@
<div class="deck-row-controls"> <div class="deck-row-controls">
<button class="count-btn" @onclick="() => RemoveCard(cardData.Name)"></button> <button class="count-btn" @onclick="() => RemoveCard(cardData.Name)"></button>
<span class="count-display">@group.Count</span> <span class="count-display">@group.Count</span>
<button class="count-btn" @onclick="() => AddCard(cardData)" disabled="@(group.Count >= 3)">+</button> <button class="count-btn" @onclick="() => AddCard(cardData)" disabled="@(group.Count >= 3)">+
</button>
</div> </div>
</div> </div>
} }
@@ -182,6 +190,7 @@
<img src="@diverCard.ImagePath" class="diver-thumb" alt="@diver" <img src="@diverCard.ImagePath" class="diver-thumb" alt="@diver"
onerror="this.style.display='none'"/> onerror="this.style.display='none'"/>
} }
<span class="diver-name">@diver</span> <span class="diver-name">@diver</span>
<button class="diver-remove" @onclick:stopPropagation="true" @onclick="() => RemoveDiver(idx)"> <button class="diver-remove" @onclick:stopPropagation="true" @onclick="() => RemoveDiver(idx)">
<i class="bi bi-x"></i> <i class="bi bi-x"></i>
@@ -216,7 +225,8 @@
<div class="filter-bar mb-2"> <div class="filter-bar mb-2">
<div class="search-wrapper"> <div class="search-wrapper">
<i class="bi bi-search search-icon"></i> <i class="bi bi-search search-icon"></i>
<input @bind="diverSearch" @bind:event="oninput" class="form-control search-input" placeholder="Search..."/> <input @bind="diverSearch" @bind:event="oninput" class="form-control search-input"
placeholder="Search..."/>
</div> </div>
</div> </div>
<div class="diver-picker-grid"> <div class="diver-picker-grid">
@@ -269,7 +279,7 @@
private IEnumerable<CardData> BrowserCards => AllCards private IEnumerable<CardData> BrowserCards => AllCards
.Where(c => c.Category is "Agent" or "Spell" or "Immortalized") .Where(c => c.Category is "Agent" or "Spell" or "Immortalized")
.Where(c => categoryFilter == "" || c.Category == categoryFilter) .Where(c => categoryFilter == "" || c.Category == categoryFilter)
.Where(c => factionFilter == "" || c.Faction == factionFilter) .Where(c => factionFilter == "" || c.Syndicate == factionFilter)
.Where(c => search == "" || c.MatchesSearch(search)); .Where(c => search == "" || c.MatchesSearch(search));
private record DeckGroup(CardData Card, int Count); private record DeckGroup(CardData Card, int Count);
@@ -287,8 +297,10 @@
{ {
var inDeck = deckCards.ToHashSet(); var inDeck = deckCards.ToHashSet();
var otherDiverSlot = activeDiverSlot == 0 var otherDiverSlot = activeDiverSlot == 0
? (divers.Count > 1 ? divers[1] : null) ? divers.Count > 1 ? divers[1] : null
: (divers.Count > 0 ? divers[0] : null); : divers.Count > 0
? divers[0]
: null;
return AllCards return AllCards
.Where(c => c.Category is "Agent" or "Spell" or "Immortalized") .Where(c => c.Category is "Agent" or "Spell" or "Immortalized")
@@ -310,23 +322,28 @@
var bucket = Math.Min(card.Cost ?? 0, 10); var bucket = Math.Min(card.Cost ?? 0, 10);
result[bucket] = result.GetValueOrDefault(bucket) + 1; result[bucket] = result.GetValueOrDefault(bucket) + 1;
} }
return result; return result;
} }
} }
private Dictionary<string, int> _deckCounts = new(); private Dictionary<string, int> _deckCounts = new();
private void RebuildDeckCounts() => private void RebuildDeckCounts()
{
_deckCounts = deckCards.GroupBy(n => n).ToDictionary(g => g.Key, g => g.Count()); _deckCounts = deckCards.GroupBy(n => n).ToDictionary(g => g.Key, g => g.Count());
}
private int CountInDeck(string name) => private int CountInDeck(string name)
_deckCounts.TryGetValue(name, out var c) ? c : 0; {
return _deckCounts.TryGetValue(name, out var c) ? c : 0;
}
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
factions = AllCards factions = AllCards
.Where(c => c.Faction != null) .Where(c => c.Syndicate != null)
.Select(c => c.Faction!) .Select(c => c.Syndicate!)
.Distinct() .Distinct()
.OrderBy(f => f) .OrderBy(f => f)
.ToList(); .ToList();
@@ -375,7 +392,10 @@
showDiverPicker = true; showDiverPicker = true;
} }
private void CloseDiverPicker() => showDiverPicker = false; private void CloseDiverPicker()
{
showDiverPicker = false;
}
private void SelectDiver(string name) private void SelectDiver(string name)
{ {
@@ -449,4 +469,5 @@
isSaving = false; isSaving = false;
} }
} }
} }
@@ -79,8 +79,13 @@
animation: fade-in 0.2s ease-out; animation: fade-in 0.2s ease-out;
} }
.save-ok { color: #66bb6a; } .save-ok {
.save-error { color: #ef5350; } color: #66bb6a;
}
.save-error {
color: #ef5350;
}
/* ── Main Layout ── */ /* ── Main Layout ── */
.builder-layout { .builder-layout {
@@ -193,7 +198,9 @@
align-items: center; align-items: center;
} }
.search-clear:hover { color: var(--text-primary); } .search-clear:hover {
color: var(--text-primary);
}
.filter-select { .filter-select {
width: 130px; width: 130px;
@@ -239,8 +246,15 @@
padding: 0; padding: 0;
} }
.col-btn:hover { background: var(--bg-hover); color: var(--text-primary); } .col-btn:hover {
.col-btn.active { background: var(--accent); color: #fff; } background: var(--bg-hover);
color: var(--text-primary);
}
.col-btn.active {
background: var(--accent);
color: #fff;
}
/* ── Browser Grid ── */ /* ── Browser Grid ── */
.browser-grid { .browser-grid {
@@ -379,10 +393,23 @@
gap: 0.15rem; gap: 0.15rem;
} }
.count-denom { font-size: 0.78rem; font-weight: 400; color: var(--text-muted); } .count-denom {
.count-ok { color: #66bb6a; } font-size: 0.78rem;
.count-over { color: #ef5350; } font-weight: 400;
.count-under { color: var(--text-secondary); } color: var(--text-muted);
}
.count-ok {
color: #66bb6a;
}
.count-over {
color: #ef5350;
}
.count-under {
color: var(--text-secondary);
}
/* ── Mana Curve ── */ /* ── Mana Curve ── */
.mana-curve { .mana-curve {
@@ -451,7 +478,9 @@
opacity: 0.7; opacity: 0.7;
} }
.deck-empty i { font-size: 2rem; } .deck-empty i {
font-size: 2rem;
}
.deck-row { .deck-row {
display: flex; display: flex;
@@ -462,7 +491,9 @@
transition: background 0.12s ease; transition: background 0.12s ease;
} }
.deck-row:hover { background: var(--bg-hover); } .deck-row:hover {
background: var(--bg-hover);
}
.deck-row-img { .deck-row-img {
width: 26px; width: 26px;
@@ -523,7 +554,10 @@
color: var(--accent); color: var(--accent);
} }
.count-btn:disabled { opacity: 0.3; cursor: not-allowed; } .count-btn:disabled {
opacity: 0.3;
cursor: not-allowed;
}
.count-display { .count-display {
font-size: 0.82rem; font-size: 0.82rem;
@@ -556,7 +590,9 @@
font-size: 0.72rem; font-size: 0.72rem;
} }
.divers-section { padding-bottom: 0.5rem; } .divers-section {
padding-bottom: 0.5rem;
}
.diver-slot { .diver-slot {
display: flex; display: flex;
@@ -621,10 +657,15 @@
transition: all 0.12s ease; transition: all 0.12s ease;
} }
.diver-remove:hover { color: #ef5350; background: rgba(239, 83, 80, 0.1); } .diver-remove:hover {
color: #ef5350;
background: rgba(239, 83, 80, 0.1);
}
/* ── Notes Section ── */ /* ── Notes Section ── */
.notes-section { padding-bottom: 1rem; } .notes-section {
padding-bottom: 1rem;
}
.notes-input { .notes-input {
margin: 0 0.75rem; margin: 0 0.75rem;
@@ -674,8 +715,14 @@
} }
@keyframes modal-enter { @keyframes modal-enter {
from { opacity: 0; transform: translate(-50%, -52%) scale(0.97); } from {
to { opacity: 1; transform: translate(-50%, -50%) scale(1); } opacity: 0;
transform: translate(-50%, -52%) scale(0.97);
}
to {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
}
} }
.diver-modal-header { .diver-modal-header {
@@ -1,3 +1,3 @@
@page "/test" @page "/test"
<h1>Test Page</h1> <h1>Test Page</h1>
<p>This is a test page.</p> <p>This is a test page.</p>
@@ -1,7 +1,6 @@
@page "/login" @page "/login"
@rendermode InteractiveServer @rendermode InteractiveServer
@attribute [Microsoft.AspNetCore.Authorization.AllowAnonymous] @attribute [AllowAnonymous]
@using Microsoft.AspNetCore.Components.Authorization
@inject IJSRuntime JS @inject IJSRuntime JS
@inject NavigationManager Nav @inject NavigationManager Nav
@inject AuthenticationStateProvider AuthStateProvider @inject AuthenticationStateProvider AuthStateProvider
@@ -75,7 +74,7 @@
try try
{ {
await JS.InvokeVoidAsync("passkeyLogin"); await JS.InvokeVoidAsync("passkeyLogin");
Nav.NavigateTo("/", forceLoad: true); Nav.NavigateTo("/", true);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -94,7 +93,7 @@
try try
{ {
await JS.InvokeVoidAsync("passkeyEnroll"); await JS.InvokeVoidAsync("passkeyEnroll");
Nav.NavigateTo("/", forceLoad: true); Nav.NavigateTo("/", true);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -107,4 +106,5 @@
} }
private record StatusResponse(bool Enrolled, bool Authenticated); private record StatusResponse(bool Enrolled, bool Authenticated);
} }
@@ -1,6 +1,6 @@
@page "/my-decks" @page "/my-decks"
@rendermode InteractiveServer
@using Microsoft.EntityFrameworkCore @using Microsoft.EntityFrameworkCore
@rendermode InteractiveServer
@inject AppDbContext Db @inject AppDbContext Db
@inject NavigationManager Nav @inject NavigationManager Nav
@@ -99,11 +99,15 @@
<div class="modal-backdrop" @onclick="CancelDelete"></div> <div class="modal-backdrop" @onclick="CancelDelete"></div>
<div class="confirm-modal"> <div class="confirm-modal">
<h5>Delete Deck</h5> <h5>Delete Deck</h5>
<p>Delete <strong>@(string.IsNullOrEmpty(deckToDelete.Name) ? "Untitled Deck" : deckToDelete.Name)</strong>? This cannot be undone.</p> <p>Delete <strong>@(string.IsNullOrEmpty(deckToDelete.Name) ? "Untitled Deck" : deckToDelete.Name)</strong>?
This cannot be undone.</p>
<div class="d-flex gap-2 justify-content-end"> <div class="d-flex gap-2 justify-content-end">
<button class="btn btn-outline-secondary" @onclick="CancelDelete">Cancel</button> <button class="btn btn-outline-secondary" @onclick="CancelDelete">Cancel</button>
<button class="btn btn-danger" @onclick="DeleteDeck" disabled="@deleting"> <button class="btn btn-danger" @onclick="DeleteDeck" disabled="@deleting">
@if (deleting) { <span class="spinner-border spinner-border-sm me-1"></span> } @if (deleting)
{
<span class="spinner-border spinner-border-sm me-1"></span>
}
Delete Delete
</button> </button>
</div> </div>
@@ -178,4 +182,5 @@
await LoadDecks(); await LoadDecks();
} }
} }
} }
@@ -1,8 +1,10 @@
@inject NavigationManager Nav @inject NavigationManager Nav
@code { @code {
protected override void OnInitialized() protected override void OnInitialized()
{ {
Nav.NavigateTo("/login", forceLoad: true); Nav.NavigateTo("/login", true);
} }
} }
@@ -1,4 +1,5 @@
<Router AppAssembly="@typeof(Program).Assembly" AdditionalAssemblies="new[] { typeof(Home).Assembly }"> <Router AppAssembly="@typeof(Program).Assembly"
AdditionalAssemblies="new[] { typeof(Home).Assembly, typeof(Syndicates).Assembly, typeof(Agents).Assembly }">
<Found Context="routeData"> <Found Context="routeData">
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"> <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
<NotAuthorized> <NotAuthorized>
@@ -2,18 +2,18 @@
@using System.Net.Http.Json @using System.Net.Http.Json
@using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization @using Microsoft.AspNetCore.Components.Authorization
@using Chrono.Model @using Model
@using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web @using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.AspNetCore.Components.Web.Virtualization
@using static Microsoft.AspNetCore.Components.Web.RenderMode @using static Microsoft.AspNetCore.Components.Web.RenderMode
@using Microsoft.JSInterop @using Microsoft.JSInterop
@using Shared.Layout
@using Shared.Pages @using Shared.Pages
@using Shared.Components @using Shared.Components
@using Server.Components @using Cloud.Components
@using Server.Models @using Cloud.Models
@using Telerik.Blazor @using Telerik.Blazor
@using Telerik.Blazor.Components @using Telerik.Blazor.Components
@using Telerik.DataSource @using Telerik.DataSource
@using Cloud.Components.Layout
@@ -1,4 +1,5 @@
using System.Security.Claims; using System.Security.Claims;
using Cloud.Models;
using Fido2NetLib; using Fido2NetLib;
using Fido2NetLib.Objects; using Fido2NetLib.Objects;
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
@@ -6,9 +7,8 @@ using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Server.Models;
namespace Server.Controllers; namespace Cloud.Controllers;
[AllowAnonymous] [AllowAnonymous]
[ApiController] [ApiController]
@@ -17,9 +17,9 @@ public class AuthController : ControllerBase
{ {
private const string RegOptionsKey = "fido2.reg.options"; private const string RegOptionsKey = "fido2.reg.options";
private const string AssertOptionsKey = "fido2.assert.options"; private const string AssertOptionsKey = "fido2.assert.options";
private readonly AppDbContext _db;
private readonly IFido2 _fido2; private readonly IFido2 _fido2;
private readonly AppDbContext _db;
public AuthController(IFido2 fido2, AppDbContext db) public AuthController(IFido2 fido2, AppDbContext db)
{ {
@@ -55,9 +55,9 @@ public class AuthController : ControllerBase
AuthenticatorSelection = new AuthenticatorSelection AuthenticatorSelection = new AuthenticatorSelection
{ {
ResidentKey = ResidentKeyRequirement.Required, ResidentKey = ResidentKeyRequirement.Required,
UserVerification = UserVerificationRequirement.Required, UserVerification = UserVerificationRequirement.Required
}, },
AttestationPreference = AttestationConveyancePreference.None, AttestationPreference = AttestationConveyancePreference.None
}); });
HttpContext.Session.SetString(RegOptionsKey, options.ToJson()); HttpContext.Session.SetString(RegOptionsKey, options.ToJson());
@@ -65,7 +65,8 @@ public class AuthController : ControllerBase
} }
[HttpPost("register/complete")] [HttpPost("register/complete")]
public async Task<IActionResult> RegisterComplete([FromBody] AuthenticatorAttestationRawResponse attestationResponse) public async Task<IActionResult> RegisterComplete(
[FromBody] AuthenticatorAttestationRawResponse attestationResponse)
{ {
var json = HttpContext.Session.GetString(RegOptionsKey); var json = HttpContext.Session.GetString(RegOptionsKey);
if (json is null) return BadRequest("Session expired. Please retry enrollment."); if (json is null) return BadRequest("Session expired. Please retry enrollment.");
@@ -84,7 +85,7 @@ public class AuthController : ControllerBase
{ {
AttestationResponse = attestationResponse, AttestationResponse = attestationResponse,
OriginalOptions = options, OriginalOptions = options,
IsCredentialIdUniqueToUserCallback = isUnique, IsCredentialIdUniqueToUserCallback = isUnique
}); });
var credential = new PasskeyCredential var credential = new PasskeyCredential
@@ -93,7 +94,7 @@ public class AuthController : ControllerBase
PublicKey = result.PublicKey, PublicKey = result.PublicKey,
SignCount = result.SignCount, SignCount = result.SignCount,
UserHandle = result.User.Id, UserHandle = result.User.Id,
AaGuid = result.AaGuid.ToString(), AaGuid = result.AaGuid.ToString()
}; };
_db.PasskeyCredentials.Add(credential); _db.PasskeyCredentials.Add(credential);
await _db.SaveChangesAsync(); await _db.SaveChangesAsync();
@@ -120,7 +121,7 @@ public class AuthController : ControllerBase
var options = _fido2.GetAssertionOptions(new GetAssertionOptionsParams var options = _fido2.GetAssertionOptions(new GetAssertionOptionsParams
{ {
AllowedCredentials = existingKeys, AllowedCredentials = existingKeys,
UserVerification = UserVerificationRequirement.Required, UserVerification = UserVerificationRequirement.Required
}); });
HttpContext.Session.SetString(AssertOptionsKey, options.ToJson()); HttpContext.Session.SetString(AssertOptionsKey, options.ToJson());
@@ -152,7 +153,7 @@ public class AuthController : ControllerBase
OriginalOptions = options, OriginalOptions = options,
StoredPublicKey = stored.PublicKey, StoredPublicKey = stored.PublicKey,
StoredSignatureCounter = (uint)stored.SignCount, StoredSignatureCounter = (uint)stored.SignCount,
IsUserHandleOwnerOfCredentialIdCallback = isOwner, IsUserHandleOwnerOfCredentialIdCallback = isOwner
}); });
stored.SignCount = result.SignCount; stored.SignCount = result.SignCount;
@@ -186,7 +187,7 @@ public class AuthController : ControllerBase
return Ok(new return Ok(new
{ {
enrolled = hasCredentials, enrolled = hasCredentials,
authenticated = User.Identity?.IsAuthenticated ?? false, authenticated = User.Identity?.IsAuthenticated ?? false
}); });
} }
@@ -1,9 +1,9 @@
using Cloud.Models;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Server.Models;
namespace Server.Controllers; namespace Cloud.Controllers;
[Authorize] [Authorize]
[ApiController] [ApiController]
@@ -1,8 +1,8 @@
using Chrono.Model;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Model;
namespace Server.Controllers; namespace Cloud.Controllers;
[Authorize] [Authorize]
[ApiController] [ApiController]
@@ -4,11 +4,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Server; using Cloud;
#nullable disable #nullable disable
namespace Server.Migrations namespace Cloud.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
[Migration("20260618210058_InitialCreate")] [Migration("20260618210058_InitialCreate")]
@@ -2,7 +2,7 @@
#nullable disable #nullable disable
namespace Server.Migrations namespace Cloud.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class InitialCreate : Migration public partial class InitialCreate : Migration
@@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Server; using Cloud;
#nullable disable #nullable disable
namespace Server.Migrations namespace Cloud.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
[Migration("20260703051336_AddUserDecks")] [Migration("20260703051336_AddUserDecks")]
@@ -39,7 +39,7 @@ namespace Server.Migrations
b.ToTable("CardNotes"); b.ToTable("CardNotes");
}); });
modelBuilder.Entity("Server.Models.UserDeck", b => modelBuilder.Entity("Cloud.Models.UserDeck", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace Server.Migrations namespace Cloud.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class AddUserDecks : Migration public partial class AddUserDecks : Migration
@@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Server; using Cloud;
#nullable disable #nullable disable
namespace Server.Migrations namespace Cloud.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
[Migration("20260703120000_AddPasskeyCredentials")] [Migration("20260703120000_AddPasskeyCredentials")]
@@ -39,7 +39,7 @@ namespace Server.Migrations
b.ToTable("CardNotes"); b.ToTable("CardNotes");
}); });
modelBuilder.Entity("Server.Models.PasskeyCredential", b => modelBuilder.Entity("Cloud.Models.PasskeyCredential", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -73,7 +73,7 @@ namespace Server.Migrations
b.ToTable("PasskeyCredentials"); b.ToTable("PasskeyCredentials");
}); });
modelBuilder.Entity("Server.Models.UserDeck", b => modelBuilder.Entity("Cloud.Models.UserDeck", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -4,7 +4,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable #nullable disable
namespace Server.Migrations namespace Cloud.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class AddPasskeyCredentials : Migration public partial class AddPasskeyCredentials : Migration
@@ -4,11 +4,10 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Server;
#nullable disable #nullable disable
namespace Server.Migrations namespace Cloud.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot partial class AppDbContextModelSnapshot : ModelSnapshot
@@ -36,7 +35,7 @@ namespace Server.Migrations
b.ToTable("CardNotes"); b.ToTable("CardNotes");
}); });
modelBuilder.Entity("Server.Models.PasskeyCredential", b => modelBuilder.Entity("Cloud.Models.PasskeyCredential", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -70,7 +69,7 @@ namespace Server.Migrations
b.ToTable("PasskeyCredentials"); b.ToTable("PasskeyCredentials");
}); });
modelBuilder.Entity("Server.Models.UserDeck", b => modelBuilder.Entity("Cloud.Models.UserDeck", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -1,4 +1,4 @@
namespace Server.Models; namespace Cloud.Models;
public class PasskeyCredential public class PasskeyCredential
{ {
@@ -1,4 +1,4 @@
namespace Server.Models; namespace Cloud.Models;
public class UserDeck public class UserDeck
{ {
@@ -1,8 +1,7 @@
using Fido2NetLib; using Cloud;
using Cloud.Components;
using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Server;
using Server.Components;
using Shared.Pages; using Shared.Pages;
using Shared.Services; using Shared.Services;
@@ -13,6 +12,7 @@ builder.Services.AddEndpointsApiExplorer();
builder.Services.AddRazorComponents().AddInteractiveServerComponents(); builder.Services.AddRazorComponents().AddInteractiveServerComponents();
builder.Services.AddTelerikBlazor(); builder.Services.AddTelerikBlazor();
builder.Services.AddSingleton<CardRenderingService>(); builder.Services.AddSingleton<CardRenderingService>();
builder.Services.AddScoped<CardPreviewService>();
builder.Services.AddScoped<AnalyticsService>(); builder.Services.AddScoped<AnalyticsService>();
builder.Services.AddHttpClient(); builder.Services.AddHttpClient();
@@ -9,6 +9,9 @@
"Fido2": { "Fido2": {
"ServerDomain": "localhost", "ServerDomain": "localhost",
"ServerName": "Chrono CCG", "ServerName": "Chrono CCG",
"Origins": [ "https://localhost:7001", "http://localhost:5000" ] "Origins": [
"https://localhost:7001",
"http://localhost:5000"
]
} }
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 KiB

Some files were not shown because too many files have changed in this diff Show More