Compare commits
11 Commits
678e20d402
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| af64b9e95c | |||
| 4ce33bdb36 | |||
| 74f065e0f5 | |||
| 6062d5b60c | |||
| c8d10c19de | |||
| 54e7dc06c0 | |||
| 8690334a80 | |||
| e64193639e | |||
| 8fa0422be4 | |||
| 5aff9910c1 | |||
| 7b0f2ce1a5 |
@@ -1,10 +1,10 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Chrono.Model;
|
||||
using Model;
|
||||
|
||||
var repoRoot = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", ".."));
|
||||
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");
|
||||
|
||||
Console.WriteLine($"Repo root: {repoRoot}");
|
||||
@@ -49,7 +49,7 @@ foreach (var file in mdFiles)
|
||||
Attack = ParseInt(yaml, "attack"),
|
||||
Health = ParseInt(yaml, "health"),
|
||||
Description = StripWikiLinks(yaml.GetValueOrDefault("description")),
|
||||
Faction = StripWikiLink(yaml.GetValueOrDefault("faction")),
|
||||
Syndicate = StripWikiLink(yaml.GetValueOrDefault("faction")),
|
||||
Set = StripWikiLink(yaml.GetValueOrDefault("set")),
|
||||
Speed = StripWikiLink(yaml.GetValueOrDefault("speed")),
|
||||
Archetypes = ParseList(yaml, "archetypes").Select(s => StripWikiLink(s) ?? "").Where(s => s != "").ToList(),
|
||||
@@ -66,32 +66,13 @@ foreach (var file in mdFiles)
|
||||
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
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(generatedFile)!);
|
||||
using var writer = new StreamWriter(generatedFile, false, Encoding.UTF8);
|
||||
writer.WriteLine("// <auto-generated/>");
|
||||
writer.WriteLine("#nullable enable");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("namespace Chrono.Model;");
|
||||
writer.WriteLine("namespace Model;");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("public static class CardDatabase");
|
||||
writer.WriteLine("{");
|
||||
@@ -109,7 +90,7 @@ for (var i = 0; i < cards.Count; i++)
|
||||
WriteNullProp(writer, "Attack", c.Attack, 3);
|
||||
WriteNullProp(writer, "Health", c.Health, 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, "Speed", c.Speed, 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(),
|
||||
Description = StripWikiLinks(NullIfNa(yaml.GetValueOrDefault("description")))?.Replace("\r\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,
|
||||
DeckCode = deckCode,
|
||||
DeckType = yaml.GetValueOrDefault("deckType")
|
||||
@@ -175,7 +156,7 @@ using var deckWriter = new StreamWriter(deckGeneratedFile, false, Encoding.UTF8)
|
||||
deckWriter.WriteLine("// <auto-generated/>");
|
||||
deckWriter.WriteLine("#nullable enable");
|
||||
deckWriter.WriteLine();
|
||||
deckWriter.WriteLine("namespace Chrono.Model;");
|
||||
deckWriter.WriteLine("namespace Model;");
|
||||
deckWriter.WriteLine();
|
||||
deckWriter.WriteLine("public static class DeckDatabase");
|
||||
deckWriter.WriteLine("{");
|
||||
@@ -192,7 +173,7 @@ for (var i = 0; i < decks.Count; i++)
|
||||
WriteListProp(deckWriter, "Keycards", d.Keycards, 3);
|
||||
WriteListProp(deckWriter, "Divers", d.Divers, 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")},");
|
||||
WriteStrProp(deckWriter, "DeckCode", d.DeckCode, 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;
|
||||
|
||||
// Also exclude files that look like base templates
|
||||
var fileName = Path.GetFileName(file);
|
||||
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
|
||||
{
|
||||
Title = Path.GetFileNameWithoutExtension(file),
|
||||
Category = category,
|
||||
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("#nullable enable");
|
||||
docWriter.WriteLine();
|
||||
docWriter.WriteLine("namespace Chrono.Model;");
|
||||
docWriter.WriteLine("namespace Model;");
|
||||
docWriter.WriteLine();
|
||||
docWriter.WriteLine("public static class DocDatabase");
|
||||
docWriter.WriteLine("{");
|
||||
@@ -267,6 +267,7 @@ for (var i = 0; i < docs.Count; i++)
|
||||
WriteProp(docWriter, "Category", d.Category, 3);
|
||||
WriteStrProp(docWriter, "Content", d.Content, 3);
|
||||
WriteDictProp(docWriter, "Frontmatter", d.Frontmatter, 3);
|
||||
WriteListProp(docWriter, "Syndicates", d.Syndicates, 3);
|
||||
var comma = i < docs.Count - 1 ? "," : "";
|
||||
docWriter.WriteLine($" }}{comma}");
|
||||
}
|
||||
|
||||
@@ -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}")
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
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
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "Build\Build.csproj", "{36E3775C-0E28-4EAE-AE92-4FB493E3787F}"
|
||||
EndProject
|
||||
@@ -10,10 +10,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deploy", "Deploy\Deploy.csp
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{90F32056-6983-4224-8A8C-E797C71633F3}"
|
||||
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
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\Shared.csproj", "{30D8468D-01E1-4D8A-99AF-EE4A75A5E956}"
|
||||
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
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
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|x86.ActiveCfg = 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
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Chrono.Model;
|
||||
using Cloud.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Server.Models;
|
||||
using Model;
|
||||
|
||||
namespace Server;
|
||||
namespace Cloud;
|
||||
|
||||
public class AppDbContext : DbContext
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
|
||||
namespace Server;
|
||||
namespace Cloud;
|
||||
|
||||
public class AppDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
|
||||
{
|
||||
@@ -12,4 +12,4 @@ public class AppDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
|
||||
.Options;
|
||||
return new AppDbContext(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,20 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MudBlazor" Version="9.6.0"/>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.2"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="Components\Layout\MainLayout.razor"/>
|
||||
<AdditionalFiles Include="Components\Layout\NavMenu.razor"/>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>Cloud</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -13,7 +13,7 @@
|
||||
<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="/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 src="/js/passkey.js"></script>
|
||||
<link href="/favicon.png" rel="icon" type="image/png"/>
|
||||
@@ -11,7 +11,7 @@
|
||||
{
|
||||
<div class="detail-image">
|
||||
<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 class="detail-info">
|
||||
@@ -38,11 +38,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (Card.Faction != null)
|
||||
@if (Card.Syndicate != null)
|
||||
{
|
||||
<div class="detail-field">
|
||||
<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>
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 16px;
|
||||
padding: 0;
|
||||
max-width: 720px;
|
||||
max-width: 850px;
|
||||
width: 92vw;
|
||||
max-height: 88vh;
|
||||
overflow-y: auto;
|
||||
@@ -76,13 +76,15 @@
|
||||
}
|
||||
|
||||
.detail-image {
|
||||
flex: 0 0 260px;
|
||||
flex: 0 0 320px;
|
||||
}
|
||||
|
||||
.detail-image img {
|
||||
width: 100%;
|
||||
border-radius: var(--radius);
|
||||
box-shadow: var(--shadow);
|
||||
max-height: 80vh;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
/* ── No-image layout ── */
|
||||
@@ -1,5 +1,5 @@
|
||||
@namespace Shared.Layout
|
||||
@inherits LayoutComponentBase
|
||||
@inject Shared.Services.CardPreviewService PreviewService
|
||||
<div class="page">
|
||||
<div class="sidebar">
|
||||
<NavMenu/>
|
||||
@@ -10,6 +10,9 @@
|
||||
<article class="content px-4">
|
||||
<TelerikRootComponent>
|
||||
@Body
|
||||
<Shared.Components.CardPreview />
|
||||
<Shared.Components.DocDetailModal Doc="@PreviewService.SelectedDoc"
|
||||
OnClose="@(() => PreviewService.SelectDoc(null))" />
|
||||
</TelerikRootComponent>
|
||||
</article>
|
||||
</main>
|
||||
@@ -1,5 +1,3 @@
|
||||
@namespace Shared.Layout
|
||||
|
||||
<div class="top-row ps-3 navbar navbar-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="">
|
||||
@@ -14,12 +12,12 @@
|
||||
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
|
||||
<nav class="nav flex-column">
|
||||
<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
|
||||
</NavLink>
|
||||
</div>
|
||||
<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
|
||||
</NavLink>
|
||||
</div>
|
||||
@@ -33,6 +31,11 @@
|
||||
<i class="bi bi-journal-text nav-icon"></i> Decks
|
||||
</NavLink>
|
||||
</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">
|
||||
<NavLink class="nav-link" href="my-decks">
|
||||
<i class="bi bi-pencil-square nav-icon"></i> My Decks
|
||||
@@ -1,6 +1,7 @@
|
||||
@page "/"
|
||||
@page "/cards"
|
||||
@using Chrono.Components
|
||||
@using Shared.Services
|
||||
@inject HttpClient Http
|
||||
@inject AnalyticsService AnalyticsService
|
||||
|
||||
<PageTitle>Chrono CCG - Card Gallery</PageTitle>
|
||||
@@ -28,7 +29,8 @@
|
||||
<i class="bi bi-person-fill"></i> Immortalized
|
||||
</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>
|
||||
<span>Linked</span>
|
||||
<span class="toggle-switch @(agentLink ? "on" : "off")"></span>
|
||||
@@ -134,6 +136,14 @@
|
||||
<div class="card-shimmer"></div>
|
||||
<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>'"/>
|
||||
|
||||
@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)
|
||||
{
|
||||
<div class="card-immortalize-badge" title="Immortalizes"><i class="bi bi-star-fill"></i>
|
||||
@@ -200,7 +210,7 @@
|
||||
{
|
||||
allCards = CardDatabase.Cards;
|
||||
factions = allCards
|
||||
.Select(c => c.Faction)
|
||||
.Select(c => c.Syndicate)
|
||||
.Where(f => f != null)
|
||||
.Distinct()
|
||||
.OrderBy(f => f)
|
||||
@@ -212,7 +222,7 @@
|
||||
var primarySet = allCards.Where(c =>
|
||||
c.MatchesSearch(search) &&
|
||||
(categoryFilter == "" || c.Category == categoryFilter) &&
|
||||
(factionFilter == "" || c.Faction == factionFilter) &&
|
||||
(factionFilter == "" || c.Syndicate == factionFilter) &&
|
||||
(costFilter == "" || c.Cost?.ToString() == costFilter)
|
||||
);
|
||||
|
||||
@@ -272,6 +282,7 @@
|
||||
seen.Add(card.Name);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -477,6 +477,29 @@
|
||||
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 {
|
||||
display: flex;
|
||||
@@ -1,9 +1,8 @@
|
||||
@page "/deck-builder"
|
||||
@page "/deck-builder/{Id:guid}"
|
||||
@rendermode InteractiveServer
|
||||
@using Chrono.Model
|
||||
@inject AppDbContext Db
|
||||
@inject NavigationManager Nav
|
||||
@inject AppDbContext Db
|
||||
|
||||
<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">
|
||||
<i class="bi bi-arrow-left"></i> My Decks
|
||||
</a>
|
||||
<input @bind="deckName" @bind:event="oninput" class="form-control deck-name-input" placeholder="Deck name..." maxlength="80"/>
|
||||
<input @bind="deckSeason" @bind:event="oninput" class="form-control season-input" placeholder="Season (e.g. S1)" maxlength="20"/>
|
||||
<input @bind="deckName" @bind:event="oninput" class="form-control deck-name-input" placeholder="Deck name..."
|
||||
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")">
|
||||
<i class="bi @(IsValid ? "bi-check-circle-fill" : "bi-exclamation-circle-fill")"></i>
|
||||
@ValidationMessage
|
||||
@@ -42,13 +43,16 @@
|
||||
<button class="tab @(categoryFilter == "" ? "active" : "")" @onclick='() => categoryFilter = ""'>
|
||||
<i class="bi bi-grid-3x3-gap-fill"></i> All
|
||||
</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
|
||||
</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
|
||||
</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
|
||||
</button>
|
||||
</div>
|
||||
@@ -56,7 +60,8 @@
|
||||
<div class="filter-bar">
|
||||
<div class="search-wrapper">
|
||||
<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)
|
||||
{
|
||||
<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++)
|
||||
{
|
||||
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>
|
||||
@@ -108,7 +114,8 @@
|
||||
<div class="deck-panel">
|
||||
|
||||
<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>
|
||||
</span>
|
||||
<button class="btn btn-sm btn-outline-danger ms-auto" @onclick="ClearDeck" title="Clear deck">
|
||||
@@ -158,7 +165,8 @@
|
||||
<div class="deck-row-controls">
|
||||
<button class="count-btn" @onclick="() => RemoveCard(cardData.Name)">−</button>
|
||||
<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>
|
||||
}
|
||||
@@ -182,6 +190,7 @@
|
||||
<img src="@diverCard.ImagePath" class="diver-thumb" alt="@diver"
|
||||
onerror="this.style.display='none'"/>
|
||||
}
|
||||
|
||||
<span class="diver-name">@diver</span>
|
||||
<button class="diver-remove" @onclick:stopPropagation="true" @onclick="() => RemoveDiver(idx)">
|
||||
<i class="bi bi-x"></i>
|
||||
@@ -216,7 +225,8 @@
|
||||
<div class="filter-bar mb-2">
|
||||
<div class="search-wrapper">
|
||||
<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 class="diver-picker-grid">
|
||||
@@ -269,7 +279,7 @@
|
||||
private IEnumerable<CardData> BrowserCards => AllCards
|
||||
.Where(c => c.Category is "Agent" or "Spell" or "Immortalized")
|
||||
.Where(c => categoryFilter == "" || c.Category == categoryFilter)
|
||||
.Where(c => factionFilter == "" || c.Faction == factionFilter)
|
||||
.Where(c => factionFilter == "" || c.Syndicate == factionFilter)
|
||||
.Where(c => search == "" || c.MatchesSearch(search));
|
||||
|
||||
private record DeckGroup(CardData Card, int Count);
|
||||
@@ -287,8 +297,10 @@
|
||||
{
|
||||
var inDeck = deckCards.ToHashSet();
|
||||
var otherDiverSlot = activeDiverSlot == 0
|
||||
? (divers.Count > 1 ? divers[1] : null)
|
||||
: (divers.Count > 0 ? divers[0] : null);
|
||||
? divers.Count > 1 ? divers[1] : null
|
||||
: divers.Count > 0
|
||||
? divers[0]
|
||||
: null;
|
||||
|
||||
return AllCards
|
||||
.Where(c => c.Category is "Agent" or "Spell" or "Immortalized")
|
||||
@@ -310,23 +322,28 @@
|
||||
var bucket = Math.Min(card.Cost ?? 0, 10);
|
||||
result[bucket] = result.GetValueOrDefault(bucket) + 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, int> _deckCounts = new();
|
||||
|
||||
private void RebuildDeckCounts() =>
|
||||
private void RebuildDeckCounts()
|
||||
{
|
||||
_deckCounts = deckCards.GroupBy(n => n).ToDictionary(g => g.Key, g => g.Count());
|
||||
}
|
||||
|
||||
private int CountInDeck(string name) =>
|
||||
_deckCounts.TryGetValue(name, out var c) ? c : 0;
|
||||
private int CountInDeck(string name)
|
||||
{
|
||||
return _deckCounts.TryGetValue(name, out var c) ? c : 0;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
factions = AllCards
|
||||
.Where(c => c.Faction != null)
|
||||
.Select(c => c.Faction!)
|
||||
.Where(c => c.Syndicate != null)
|
||||
.Select(c => c.Syndicate!)
|
||||
.Distinct()
|
||||
.OrderBy(f => f)
|
||||
.ToList();
|
||||
@@ -375,7 +392,10 @@
|
||||
showDiverPicker = true;
|
||||
}
|
||||
|
||||
private void CloseDiverPicker() => showDiverPicker = false;
|
||||
private void CloseDiverPicker()
|
||||
{
|
||||
showDiverPicker = false;
|
||||
}
|
||||
|
||||
private void SelectDiver(string name)
|
||||
{
|
||||
@@ -449,4 +469,5 @@
|
||||
isSaving = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
box-shadow: 0 2px 12px rgba(0,0,0,0.25);
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.deck-name-input {
|
||||
@@ -79,8 +79,13 @@
|
||||
animation: fade-in 0.2s ease-out;
|
||||
}
|
||||
|
||||
.save-ok { color: #66bb6a; }
|
||||
.save-error { color: #ef5350; }
|
||||
.save-ok {
|
||||
color: #66bb6a;
|
||||
}
|
||||
|
||||
.save-error {
|
||||
color: #ef5350;
|
||||
}
|
||||
|
||||
/* ── Main Layout ── */
|
||||
.builder-layout {
|
||||
@@ -193,7 +198,9 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.search-clear:hover { color: var(--text-primary); }
|
||||
.search-clear:hover {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.filter-select {
|
||||
width: 130px;
|
||||
@@ -239,8 +246,15 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.col-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
|
||||
.col-btn.active { background: var(--accent); color: #fff; }
|
||||
.col-btn:hover {
|
||||
background: var(--bg-hover);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.col-btn.active {
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* ── Browser Grid ── */
|
||||
.browser-grid {
|
||||
@@ -322,19 +336,19 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 1.5px solid rgba(255,255,255,0.25);
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.4);
|
||||
border: 1.5px solid rgba(255, 255, 255, 0.25);
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
.maxed-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.5);
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.4rem;
|
||||
color: rgba(255,255,255,0.45);
|
||||
color: rgba(255, 255, 255, 0.45);
|
||||
}
|
||||
|
||||
.browser-card-name {
|
||||
@@ -368,7 +382,7 @@
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.card-count {
|
||||
@@ -379,10 +393,23 @@
|
||||
gap: 0.15rem;
|
||||
}
|
||||
|
||||
.count-denom { font-size: 0.78rem; font-weight: 400; color: var(--text-muted); }
|
||||
.count-ok { color: #66bb6a; }
|
||||
.count-over { color: #ef5350; }
|
||||
.count-under { color: var(--text-secondary); }
|
||||
.count-denom {
|
||||
font-size: 0.78rem;
|
||||
font-weight: 400;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.count-ok {
|
||||
color: #66bb6a;
|
||||
}
|
||||
|
||||
.count-over {
|
||||
color: #ef5350;
|
||||
}
|
||||
|
||||
.count-under {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* ── Mana Curve ── */
|
||||
.mana-curve {
|
||||
@@ -451,18 +478,22 @@
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.deck-empty i { font-size: 2rem; }
|
||||
.deck-empty i {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.deck-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.3rem 0.75rem;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.04);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
|
||||
transition: background 0.12s ease;
|
||||
}
|
||||
|
||||
.deck-row:hover { background: var(--bg-hover); }
|
||||
.deck-row:hover {
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
|
||||
.deck-row-img {
|
||||
width: 26px;
|
||||
@@ -523,7 +554,10 @@
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.count-btn:disabled { opacity: 0.3; cursor: not-allowed; }
|
||||
.count-btn:disabled {
|
||||
opacity: 0.3;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.count-display {
|
||||
font-size: 0.82rem;
|
||||
@@ -556,7 +590,9 @@
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
|
||||
.divers-section { padding-bottom: 0.5rem; }
|
||||
.divers-section {
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.diver-slot {
|
||||
display: flex;
|
||||
@@ -621,10 +657,15 @@
|
||||
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 { padding-bottom: 1rem; }
|
||||
.notes-section {
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.notes-input {
|
||||
margin: 0 0.75rem;
|
||||
@@ -648,7 +689,7 @@
|
||||
.modal-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.6);
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
z-index: 1040;
|
||||
backdrop-filter: blur(2px);
|
||||
}
|
||||
@@ -669,13 +710,19 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 0 1px rgba(108, 99, 255, 0.1);
|
||||
box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(108, 99, 255, 0.1);
|
||||
animation: modal-enter 0.18s ease-out;
|
||||
}
|
||||
|
||||
@keyframes modal-enter {
|
||||
from { opacity: 0; transform: translate(-50%, -52%) scale(0.97); }
|
||||
to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translate(-50%, -52%) scale(0.97);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.diver-modal-header {
|
||||
@@ -1,3 +1,3 @@
|
||||
@page "/test"
|
||||
@page "/test"
|
||||
<h1>Test Page</h1>
|
||||
<p>This is a test page.</p>
|
||||
@@ -1,7 +1,6 @@
|
||||
@page "/login"
|
||||
@rendermode InteractiveServer
|
||||
@attribute [Microsoft.AspNetCore.Authorization.AllowAnonymous]
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@attribute [AllowAnonymous]
|
||||
@inject IJSRuntime JS
|
||||
@inject NavigationManager Nav
|
||||
@inject AuthenticationStateProvider AuthStateProvider
|
||||
@@ -75,7 +74,7 @@
|
||||
try
|
||||
{
|
||||
await JS.InvokeVoidAsync("passkeyLogin");
|
||||
Nav.NavigateTo("/", forceLoad: true);
|
||||
Nav.NavigateTo("/", true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -94,7 +93,7 @@
|
||||
try
|
||||
{
|
||||
await JS.InvokeVoidAsync("passkeyEnroll");
|
||||
Nav.NavigateTo("/", forceLoad: true);
|
||||
Nav.NavigateTo("/", true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -107,4 +106,5 @@
|
||||
}
|
||||
|
||||
private record StatusResponse(bool Enrolled, bool Authenticated);
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
.login-card {
|
||||
background: #fff;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 24px rgba(0,0,0,0.10);
|
||||
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
|
||||
padding: 2.5rem 2rem;
|
||||
width: 100%;
|
||||
max-width: 380px;
|
||||
@@ -1,6 +1,6 @@
|
||||
@page "/my-decks"
|
||||
@rendermode InteractiveServer
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@rendermode InteractiveServer
|
||||
@inject AppDbContext Db
|
||||
@inject NavigationManager Nav
|
||||
|
||||
@@ -99,11 +99,15 @@
|
||||
<div class="modal-backdrop" @onclick="CancelDelete"></div>
|
||||
<div class="confirm-modal">
|
||||
<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">
|
||||
<button class="btn btn-outline-secondary" @onclick="CancelDelete">Cancel</button>
|
||||
<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
|
||||
</button>
|
||||
</div>
|
||||
@@ -178,4 +182,5 @@
|
||||
await LoadDecks();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
@inject NavigationManager Nav
|
||||
|
||||
@code {
|
||||
|
||||
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">
|
||||
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
|
||||
<NotAuthorized>
|
||||
@@ -2,18 +2,18 @@
|
||||
@using System.Net.Http.Json
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using Chrono.Model
|
||||
@using Model
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using static Microsoft.AspNetCore.Components.Web.RenderMode
|
||||
@using Microsoft.JSInterop
|
||||
@using Shared.Layout
|
||||
@using Shared.Pages
|
||||
@using Shared.Components
|
||||
@using Server.Components
|
||||
@using Server.Models
|
||||
@using Cloud.Components
|
||||
@using Cloud.Models
|
||||
@using Telerik.Blazor
|
||||
@using Telerik.Blazor.Components
|
||||
@using Telerik.DataSource
|
||||
@using Cloud.Components.Layout
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Security.Claims;
|
||||
using Cloud.Models;
|
||||
using Fido2NetLib;
|
||||
using Fido2NetLib.Objects;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
@@ -6,9 +7,8 @@ using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Server.Models;
|
||||
|
||||
namespace Server.Controllers;
|
||||
namespace Cloud.Controllers;
|
||||
|
||||
[AllowAnonymous]
|
||||
[ApiController]
|
||||
@@ -17,9 +17,9 @@ public class AuthController : ControllerBase
|
||||
{
|
||||
private const string RegOptionsKey = "fido2.reg.options";
|
||||
private const string AssertOptionsKey = "fido2.assert.options";
|
||||
private readonly AppDbContext _db;
|
||||
|
||||
private readonly IFido2 _fido2;
|
||||
private readonly AppDbContext _db;
|
||||
|
||||
public AuthController(IFido2 fido2, AppDbContext db)
|
||||
{
|
||||
@@ -55,9 +55,9 @@ public class AuthController : ControllerBase
|
||||
AuthenticatorSelection = new AuthenticatorSelection
|
||||
{
|
||||
ResidentKey = ResidentKeyRequirement.Required,
|
||||
UserVerification = UserVerificationRequirement.Required,
|
||||
UserVerification = UserVerificationRequirement.Required
|
||||
},
|
||||
AttestationPreference = AttestationConveyancePreference.None,
|
||||
AttestationPreference = AttestationConveyancePreference.None
|
||||
});
|
||||
|
||||
HttpContext.Session.SetString(RegOptionsKey, options.ToJson());
|
||||
@@ -65,7 +65,8 @@ public class AuthController : ControllerBase
|
||||
}
|
||||
|
||||
[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);
|
||||
if (json is null) return BadRequest("Session expired. Please retry enrollment.");
|
||||
@@ -84,7 +85,7 @@ public class AuthController : ControllerBase
|
||||
{
|
||||
AttestationResponse = attestationResponse,
|
||||
OriginalOptions = options,
|
||||
IsCredentialIdUniqueToUserCallback = isUnique,
|
||||
IsCredentialIdUniqueToUserCallback = isUnique
|
||||
});
|
||||
|
||||
var credential = new PasskeyCredential
|
||||
@@ -93,7 +94,7 @@ public class AuthController : ControllerBase
|
||||
PublicKey = result.PublicKey,
|
||||
SignCount = result.SignCount,
|
||||
UserHandle = result.User.Id,
|
||||
AaGuid = result.AaGuid.ToString(),
|
||||
AaGuid = result.AaGuid.ToString()
|
||||
};
|
||||
_db.PasskeyCredentials.Add(credential);
|
||||
await _db.SaveChangesAsync();
|
||||
@@ -120,7 +121,7 @@ public class AuthController : ControllerBase
|
||||
var options = _fido2.GetAssertionOptions(new GetAssertionOptionsParams
|
||||
{
|
||||
AllowedCredentials = existingKeys,
|
||||
UserVerification = UserVerificationRequirement.Required,
|
||||
UserVerification = UserVerificationRequirement.Required
|
||||
});
|
||||
|
||||
HttpContext.Session.SetString(AssertOptionsKey, options.ToJson());
|
||||
@@ -152,7 +153,7 @@ public class AuthController : ControllerBase
|
||||
OriginalOptions = options,
|
||||
StoredPublicKey = stored.PublicKey,
|
||||
StoredSignatureCounter = (uint)stored.SignCount,
|
||||
IsUserHandleOwnerOfCredentialIdCallback = isOwner,
|
||||
IsUserHandleOwnerOfCredentialIdCallback = isOwner
|
||||
});
|
||||
|
||||
stored.SignCount = result.SignCount;
|
||||
@@ -186,7 +187,7 @@ public class AuthController : ControllerBase
|
||||
return Ok(new
|
||||
{
|
||||
enrolled = hasCredentials,
|
||||
authenticated = User.Identity?.IsAuthenticated ?? false,
|
||||
authenticated = User.Identity?.IsAuthenticated ?? false
|
||||
});
|
||||
}
|
||||
|
||||
@@ -216,4 +217,4 @@ public class AuthController : ControllerBase
|
||||
await _db.SaveChangesAsync();
|
||||
return Ok(new { message = "All credentials deleted." });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using Cloud.Models;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Server.Models;
|
||||
|
||||
namespace Server.Controllers;
|
||||
namespace Cloud.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
@@ -107,4 +107,4 @@ public class DecksController : ControllerBase
|
||||
return StatusCode(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Chrono.Model;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Model;
|
||||
|
||||
namespace Server.Controllers;
|
||||
namespace Cloud.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
@@ -4,11 +4,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Server;
|
||||
using Cloud;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Server.Migrations
|
||||
namespace Cloud.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260618210058_InitialCreate")]
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Server.Migrations
|
||||
namespace Cloud.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
@@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Server;
|
||||
using Cloud;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Server.Migrations
|
||||
namespace Cloud.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260703051336_AddUserDecks")]
|
||||
@@ -39,7 +39,7 @@ namespace Server.Migrations
|
||||
b.ToTable("CardNotes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.Models.UserDeck", b =>
|
||||
modelBuilder.Entity("Cloud.Models.UserDeck", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Server.Migrations
|
||||
namespace Cloud.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddUserDecks : Migration
|
||||
@@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Server;
|
||||
using Cloud;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Server.Migrations
|
||||
namespace Cloud.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260703120000_AddPasskeyCredentials")]
|
||||
@@ -39,7 +39,7 @@ namespace Server.Migrations
|
||||
b.ToTable("CardNotes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.Models.PasskeyCredential", b =>
|
||||
modelBuilder.Entity("Cloud.Models.PasskeyCredential", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -73,7 +73,7 @@ namespace Server.Migrations
|
||||
b.ToTable("PasskeyCredentials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.Models.UserDeck", b =>
|
||||
modelBuilder.Entity("Cloud.Models.UserDeck", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -4,7 +4,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Server.Migrations
|
||||
namespace Cloud.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddPasskeyCredentials : Migration
|
||||
@@ -4,11 +4,10 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using Server;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Server.Migrations
|
||||
namespace Cloud.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
partial class AppDbContextModelSnapshot : ModelSnapshot
|
||||
@@ -36,7 +35,7 @@ namespace Server.Migrations
|
||||
b.ToTable("CardNotes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.Models.PasskeyCredential", b =>
|
||||
modelBuilder.Entity("Cloud.Models.PasskeyCredential", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -70,7 +69,7 @@ namespace Server.Migrations
|
||||
b.ToTable("PasskeyCredentials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Server.Models.UserDeck", b =>
|
||||
modelBuilder.Entity("Cloud.Models.UserDeck", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Models;
|
||||
namespace Cloud.Models;
|
||||
|
||||
public class PasskeyCredential
|
||||
{
|
||||
@@ -9,4 +9,4 @@ public class PasskeyCredential
|
||||
public required byte[] UserHandle { get; set; }
|
||||
public string AaGuid { get; set; } = string.Empty;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Server.Models;
|
||||
namespace Cloud.Models;
|
||||
|
||||
public class UserDeck
|
||||
{
|
||||
@@ -9,4 +9,4 @@ public class UserDeck
|
||||
public string? Notes { get; set; }
|
||||
public string? Season { get; set; }
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
using Fido2NetLib;
|
||||
using Cloud;
|
||||
using Cloud.Components;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Server;
|
||||
using Server.Components;
|
||||
using Shared.Pages;
|
||||
using Shared.Services;
|
||||
|
||||
@@ -13,6 +12,7 @@ builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
|
||||
builder.Services.AddTelerikBlazor();
|
||||
builder.Services.AddSingleton<CardRenderingService>();
|
||||
builder.Services.AddScoped<CardPreviewService>();
|
||||
builder.Services.AddScoped<AnalyticsService>();
|
||||
builder.Services.AddHttpClient();
|
||||
|
||||
@@ -81,4 +81,4 @@ app.MapRazorComponents<App>()
|
||||
.AddInteractiveServerRenderMode()
|
||||
.AddAdditionalAssemblies(typeof(Home).Assembly);
|
||||
|
||||
app.Run();
|
||||
app.Run();
|
||||
@@ -9,6 +9,9 @@
|
||||
"Fido2": {
|
||||
"ServerDomain": "localhost",
|
||||
"ServerName": "Chrono CCG",
|
||||
"Origins": [ "https://localhost:7001", "http://localhost:5000" ]
|
||||
"Origins": [
|
||||
"https://localhost:7001",
|
||||
"http://localhost:5000"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 434 KiB |
|
After Width: | Height: | Size: 560 KiB |
|
After Width: | Height: | Size: 656 KiB |
|
After Width: | Height: | Size: 568 KiB |
|
After Width: | Height: | Size: 243 KiB |
|
After Width: | Height: | Size: 808 KiB |
|
After Width: | Height: | Size: 386 KiB |
|
After Width: | Height: | Size: 573 KiB |
|
After Width: | Height: | Size: 532 KiB |
|
After Width: | Height: | Size: 514 KiB |
|
After Width: | Height: | Size: 843 KiB |
|
After Width: | Height: | Size: 12 MiB |
|
After Width: | Height: | Size: 603 KiB |
|
After Width: | Height: | Size: 571 KiB |
|
After Width: | Height: | Size: 380 KiB |
|
After Width: | Height: | Size: 360 KiB |
|
After Width: | Height: | Size: 449 KiB |
|
After Width: | Height: | Size: 275 KiB |
|
After Width: | Height: | Size: 621 KiB |
|
After Width: | Height: | Size: 398 KiB |
|
After Width: | Height: | Size: 397 KiB |
|
After Width: | Height: | Size: 548 KiB |
|
After Width: | Height: | Size: 582 KiB |
|
After Width: | Height: | Size: 425 KiB |
|
After Width: | Height: | Size: 524 KiB |
|
After Width: | Height: | Size: 584 KiB |
|
After Width: | Height: | Size: 691 KiB |
|
After Width: | Height: | Size: 446 KiB |
|
After Width: | Height: | Size: 570 KiB |
|
After Width: | Height: | Size: 493 KiB |
|
After Width: | Height: | Size: 531 KiB |
|
After Width: | Height: | Size: 515 KiB |
|
After Width: | Height: | Size: 410 KiB |
|
After Width: | Height: | Size: 583 KiB |
|
After Width: | Height: | Size: 432 KiB |
|
After Width: | Height: | Size: 551 KiB |
|
After Width: | Height: | Size: 536 KiB |
|
After Width: | Height: | Size: 418 KiB |
|
After Width: | Height: | Size: 512 KiB |
|
After Width: | Height: | Size: 611 KiB |
|
After Width: | Height: | Size: 577 KiB |
|
After Width: | Height: | Size: 466 KiB |
|
After Width: | Height: | Size: 586 KiB |
|
After Width: | Height: | Size: 630 KiB |
|
After Width: | Height: | Size: 515 KiB |
|
After Width: | Height: | Size: 517 KiB |
|
After Width: | Height: | Size: 511 KiB |
|
After Width: | Height: | Size: 588 KiB |
|
After Width: | Height: | Size: 564 KiB |
|
After Width: | Height: | Size: 706 KiB |
|
After Width: | Height: | Size: 571 KiB |
|
After Width: | Height: | Size: 549 KiB |
|
After Width: | Height: | Size: 562 KiB |
|
After Width: | Height: | Size: 509 KiB |
|
After Width: | Height: | Size: 551 KiB |
|
After Width: | Height: | Size: 544 KiB |
|
After Width: | Height: | Size: 654 KiB |
|
After Width: | Height: | Size: 689 KiB |
|
After Width: | Height: | Size: 567 KiB |