...vibing UI
This commit is contained in:
@@ -11,4 +11,8 @@
|
||||
<ProjectReference Include="..\Model\Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="YamlDotNet" Version="18.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
+256
-1
@@ -1 +1,256 @@
|
||||
Console.WriteLine("Hello, World!");
|
||||
using System.Text;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
using YamlDotNet.Core;
|
||||
|
||||
// Resolve paths: when run as pre-build from Web project, working dir is Web/
|
||||
var solutionDir = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), ".."));
|
||||
var docsDir = Path.GetFullPath(Path.Combine(solutionDir, "..", "fellowship.docs"));
|
||||
var outputFile = Path.Combine(solutionDir, "Model", "DocsData.cs");
|
||||
|
||||
if (!Directory.Exists(docsDir))
|
||||
{
|
||||
Console.Error.WriteLine($"Docs directory not found: {docsDir}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
var mdFiles = Directory.EnumerateFiles(docsDir, "*.md", SearchOption.AllDirectories)
|
||||
.OrderBy(f => f)
|
||||
.ToArray();
|
||||
|
||||
Console.WriteLine($"Found {mdFiles.Length} markdown files in {docsDir}");
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("// <auto-generated />");
|
||||
sb.AppendLine("// Generated by the Build project. Do not edit manually.");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("namespace Model;");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("public static class DocsData");
|
||||
sb.AppendLine("{");
|
||||
sb.AppendLine(" public static readonly List<DocEntry> All = new()");
|
||||
sb.AppendLine(" {");
|
||||
|
||||
foreach (var file in mdFiles)
|
||||
{
|
||||
var content = File.ReadAllText(file);
|
||||
var (yamlBlock, body) = ExtractFrontmatter(content);
|
||||
if (yamlBlock == null) continue;
|
||||
|
||||
var fields = ParseYamlFields(yamlBlock);
|
||||
var relativePath = Path.GetRelativePath(docsDir, file);
|
||||
var fileName = Path.GetFileName(file);
|
||||
var typeName = GetValue(fields, "type") ?? "Unknown";
|
||||
|
||||
var csharpType = typeName switch
|
||||
{
|
||||
"Skill" => "SkillDoc",
|
||||
"Debuff" => "DebuffDoc",
|
||||
"Buff" => "BuffDoc",
|
||||
"Key" or "Mouse" => "KeyDoc",
|
||||
"Character" => "CharacterDoc",
|
||||
_ => "SkillDoc"
|
||||
};
|
||||
|
||||
sb.AppendLine($" new {csharpType}");
|
||||
sb.AppendLine(" {");
|
||||
sb.AppendLine($" FileName = {EscapeString(fileName)},");
|
||||
sb.AppendLine($" FilePath = {EscapeString(relativePath)},");
|
||||
|
||||
if (body != null)
|
||||
sb.AppendLine($" Body = {EscapeString(body.TrimEnd())},");
|
||||
|
||||
var knownProps = typeName switch
|
||||
{
|
||||
"Skill" => GetSkillProperties(fields),
|
||||
"Debuff" => GetDebuffProperties(fields),
|
||||
"Buff" => GetBuffProperties(fields),
|
||||
"Key" or "Mouse" => GetKeyProperties(fields),
|
||||
"Character" => GetCharacterProperties(fields),
|
||||
_ => GetSkillProperties(fields)
|
||||
};
|
||||
|
||||
foreach (var (propName, propValue) in knownProps)
|
||||
sb.AppendLine($" {propName} = {propValue},");
|
||||
|
||||
sb.AppendLine(" },");
|
||||
}
|
||||
|
||||
sb.AppendLine(" };");
|
||||
sb.AppendLine("}");
|
||||
|
||||
File.WriteAllText(outputFile, sb.ToString());
|
||||
Console.WriteLine($"Generated {outputFile}");
|
||||
return 0;
|
||||
|
||||
static (string? yaml, string? body) ExtractFrontmatter(string content)
|
||||
{
|
||||
if (!content.StartsWith("---")) return (null, null);
|
||||
|
||||
var endIndex = content.IndexOf("---", 3, StringComparison.Ordinal);
|
||||
if (endIndex == -1) return (null, null);
|
||||
|
||||
var yaml = content[3..endIndex].Trim();
|
||||
var body = content[(endIndex + 3)..].Trim();
|
||||
return (yaml, string.IsNullOrEmpty(body) ? null : body);
|
||||
}
|
||||
|
||||
static Dictionary<string, object?> ParseYamlFields(string yamlBlock)
|
||||
{
|
||||
var result = new Dictionary<string, object?>();
|
||||
try
|
||||
{
|
||||
var yamlStream = new YamlStream();
|
||||
yamlStream.Load(new StringReader(yamlBlock));
|
||||
|
||||
if (yamlStream.Documents.Count > 0 && yamlStream.Documents[0].RootNode is YamlMappingNode mapping)
|
||||
foreach (var (keyNode, valueNode) in mapping)
|
||||
{
|
||||
var key = keyNode.ToString();
|
||||
result[key] = ConvertYamlNode(valueNode);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"Warning: Failed to parse YAML: {ex.Message}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static object? ConvertYamlNode(YamlNode node)
|
||||
{
|
||||
return node switch
|
||||
{
|
||||
YamlScalarNode scalar => scalar.Value,
|
||||
YamlSequenceNode seq => seq.Children.Select(ConvertYamlNode).ToList(),
|
||||
YamlMappingNode map => map.ToDictionary(kvp => kvp.Key.ToString(), kvp => ConvertYamlNode(kvp.Value)),
|
||||
_ => node.ToString()
|
||||
};
|
||||
}
|
||||
|
||||
static string? GetValue(Dictionary<string, object?> fields, string key)
|
||||
{
|
||||
if (fields.TryGetValue(key, out var val) && val is string s && !string.IsNullOrEmpty(s))
|
||||
return s;
|
||||
return null;
|
||||
}
|
||||
|
||||
static string EscapeString(string? s)
|
||||
{
|
||||
if (s == null) return "null";
|
||||
if (s.Contains('\n') || s.Contains('"') || s.Contains('\\'))
|
||||
{
|
||||
var escaped = s.Replace("\"", "\"\"");
|
||||
return $"@\"{escaped}\"";
|
||||
}
|
||||
return $"\"{s}\"";
|
||||
}
|
||||
|
||||
static string EscapeBool(object? val)
|
||||
{
|
||||
if (val is string s)
|
||||
{
|
||||
if (bool.TryParse(s, out var b)) return b ? "true" : "false";
|
||||
return "null";
|
||||
}
|
||||
return "null";
|
||||
}
|
||||
|
||||
static string EscapeStringOrNull(object? val)
|
||||
{
|
||||
if (val is string s) return EscapeString(s);
|
||||
return "null";
|
||||
}
|
||||
|
||||
static string EscapeList(object? val)
|
||||
{
|
||||
if (val is List<object> list && list.Count > 0)
|
||||
{
|
||||
var items = list.OfType<string>().Select(EscapeString);
|
||||
return $"new() {{ {string.Join(", ", items)} }}";
|
||||
}
|
||||
return "null";
|
||||
}
|
||||
|
||||
static string EscapeNumericString(object? val)
|
||||
{
|
||||
if (val is string s) return EscapeString(s);
|
||||
if (val is int i) return EscapeString(i.ToString());
|
||||
if (val is double d) return EscapeString(d.ToString("0.##"));
|
||||
return "null";
|
||||
}
|
||||
|
||||
static IEnumerable<(string prop, string value)> GetSkillProperties(Dictionary<string, object?> f)
|
||||
{
|
||||
if (GetValue(f, "character") is { } c) yield return ("Character", EscapeString(c));
|
||||
if (f.TryGetValue("cast", out var cast)) yield return ("Cast", EscapeStringOrNull(cast));
|
||||
if (f.TryGetValue("description", out var desc)) yield return ("Description", EscapeStringOrNull(desc));
|
||||
if (f.TryGetValue("key", out var key)) yield return ("Key", EscapeStringOrNull(key));
|
||||
if (f.TryGetValue("range", out var range)) yield return ("Range", EscapeStringOrNull(range));
|
||||
if (f.TryGetValue("offGlobalCooldown", out var ogc))
|
||||
{
|
||||
if (ogc is string s && bool.TryParse(s, out var b))
|
||||
yield return ("OffGlobalCooldown", b ? "true" : "false");
|
||||
else if (ogc is null)
|
||||
yield return ("OffGlobalCooldown", "true");
|
||||
}
|
||||
if (f.TryGetValue("damage", out var dmg)) yield return ("Damage", EscapeNumericString(dmg));
|
||||
if (f.TryGetValue("cooldown", out var cd)) yield return ("Cooldown", EscapeNumericString(cd));
|
||||
if (f.TryGetValue("mana", out var mana)) yield return ("Mana", EscapeNumericString(mana));
|
||||
if (f.TryGetValue("damageType", out var dt)) yield return ("DamageType", EscapeStringOrNull(dt));
|
||||
if (f.TryGetValue("heal", out var heal)) yield return ("Heal", EscapeNumericString(heal));
|
||||
if (f.TryGetValue("shield", out var shield)) yield return ("Shield", EscapeNumericString(shield));
|
||||
if (f.TryGetValue("order", out var order)) yield return ("Order", EscapeNumericString(order));
|
||||
if (f.TryGetValue("priority", out var priority)) yield return ("Priority", EscapeNumericString(priority));
|
||||
if (f.TryGetValue("completed", out var completed)) yield return ("Completed", EscapeBool(completed));
|
||||
if (f.TryGetValue("gdc", out var gdc)) yield return ("Gdc", EscapeNumericString(gdc));
|
||||
if (f.TryGetValue("tags", out var tags)) yield return ("Tags", EscapeList(tags));
|
||||
if (f.TryGetValue("related", out var related) || f.TryGetValue("releated", out related))
|
||||
yield return ("Related", EscapeList(related));
|
||||
if (f.TryGetValue("swiftReprievalChance", out var src)) yield return ("SwiftReprievalChance", EscapeNumericString(src));
|
||||
if (f.TryGetValue("areaDamagePercentage", out var adp)) yield return ("AreaDamagePercentage", EscapeNumericString(adp));
|
||||
if (f.TryGetValue("generatesSpirit", out var gs)) yield return ("GeneratesSpirit", EscapeNumericString(gs));
|
||||
if (f.TryGetValue("duration", out var dur)) yield return ("Duration", EscapeNumericString(dur));
|
||||
if (f.TryGetValue("damageReduction", out var dr)) yield return ("DamageReduction", EscapeNumericString(dr));
|
||||
if (f.TryGetValue("damageTickTime", out var dtt)) yield return ("DamageTickTime", EscapeNumericString(dtt));
|
||||
if (f.TryGetValue("isToggle", out var isTog)) yield return ("IsToggle", EscapeBool(isTog));
|
||||
if (f.TryGetValue("manaUpkeepTick", out var mut)) yield return ("ManaUpkeepTick", EscapeNumericString(mut));
|
||||
if (f.TryGetValue("parryChance", out var pc)) yield return ("ParryChance", EscapeNumericString(pc));
|
||||
if (f.TryGetValue("damageRedirection", out var dredirect)) yield return ("DamageRedirection", EscapeNumericString(dredirect));
|
||||
if (f.TryGetValue("spiritCost", out var sc)) yield return ("SpiritCost", EscapeNumericString(sc));
|
||||
if (f.TryGetValue("secondEffectDuration", out var sed)) yield return ("SecondEffectDuration", EscapeNumericString(sed));
|
||||
if (f.TryGetValue("secondEffectDamageReduction", out var sedr)) yield return ("SecondEffectDamageReduction", EscapeNumericString(sedr));
|
||||
if (f.TryGetValue("healingDuration", out var hd)) yield return ("HealingDuration", EscapeNumericString(hd));
|
||||
if (f.TryGetValue("healingTickTime", out var htt)) yield return ("HealingTickTime", EscapeNumericString(htt));
|
||||
if (f.TryGetValue("costSwiftReprieval", out var csr)) yield return ("CostSwiftReprieval", EscapeNumericString(csr));
|
||||
if (f.TryGetValue("gdcDuration", out var gd)) yield return ("GdcDuration", EscapeNumericString(gd));
|
||||
if (f.TryGetValue("effect", out var effect)) yield return ("Effect", EscapeStringOrNull(effect));
|
||||
if (f.TryGetValue("raw", out var raw)) yield return ("Raw", EscapeStringOrNull(raw));
|
||||
}
|
||||
|
||||
static IEnumerable<(string prop, string value)> GetDebuffProperties(Dictionary<string, object?> f)
|
||||
{
|
||||
if (GetValue(f, "character") is { } c) yield return ("Character", EscapeString(c));
|
||||
if (f.TryGetValue("maxStacks", out var ms)) yield return ("MaxStacks", EscapeNumericString(ms));
|
||||
if (f.TryGetValue("duration", out var dur)) yield return ("Duration", EscapeNumericString(dur));
|
||||
if (f.TryGetValue("description", out var desc)) yield return ("Description", EscapeStringOrNull(desc));
|
||||
if (f.TryGetValue("parryChanceBonus", out var pcb)) yield return ("ParryChanceBonus", EscapeNumericString(pcb));
|
||||
if (f.TryGetValue("manaRestoreBase", out var mrb)) yield return ("ManaRestoreBase", EscapeNumericString(mrb));
|
||||
if (f.TryGetValue("manaRestorePerStack", out var mrps)) yield return ("ManaRestorePerStack", EscapeNumericString(mrps));
|
||||
}
|
||||
|
||||
static IEnumerable<(string prop, string value)> GetBuffProperties(Dictionary<string, object?> f)
|
||||
{
|
||||
if (GetValue(f, "character") is { } c) yield return ("Character", EscapeString(c));
|
||||
if (f.TryGetValue("maxStacks", out var ms)) yield return ("MaxStacks", EscapeNumericString(ms));
|
||||
if (f.TryGetValue("description", out var desc)) yield return ("Description", EscapeStringOrNull(desc));
|
||||
}
|
||||
|
||||
static IEnumerable<(string prop, string value)> GetKeyProperties(Dictionary<string, object?> f)
|
||||
{
|
||||
if (f.TryGetValue("action", out var action)) yield return ("Action", EscapeStringOrNull(action));
|
||||
}
|
||||
|
||||
static IEnumerable<(string prop, string value)> GetCharacterProperties(Dictionary<string, object?> f)
|
||||
{
|
||||
if (GetValue(f, "character") is { } c) yield return ("Character", EscapeString(c));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Model;
|
||||
|
||||
public record BuffDoc : DocEntry
|
||||
{
|
||||
public required string Character { get; init; }
|
||||
public string? MaxStacks { get; init; }
|
||||
public string? Description { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Model;
|
||||
|
||||
public record CharacterDoc : DocEntry
|
||||
{
|
||||
public required string Character { get; init; }
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
namespace Model;
|
||||
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Model;
|
||||
|
||||
public record DebuffDoc : DocEntry
|
||||
{
|
||||
public required string Character { get; init; }
|
||||
public string? MaxStacks { get; init; }
|
||||
public string? Duration { get; init; }
|
||||
public string? Description { get; init; }
|
||||
public string? ParryChanceBonus { get; init; }
|
||||
public string? ManaRestoreBase { get; init; }
|
||||
public string? ManaRestorePerStack { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Model;
|
||||
|
||||
public abstract record DocEntry
|
||||
{
|
||||
public required string FileName { get; init; }
|
||||
public required string FilePath { get; init; }
|
||||
public string? Body { get; init; }
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
namespace Model;
|
||||
|
||||
public record KeyDoc : DocEntry
|
||||
{
|
||||
public string? Action { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
namespace Model;
|
||||
|
||||
public record SkillDoc : DocEntry
|
||||
{
|
||||
public required string Character { get; init; }
|
||||
public string? Cast { get; init; }
|
||||
public string? Description { get; init; }
|
||||
public string? Key { get; init; }
|
||||
public string? Range { get; init; }
|
||||
public bool? OffGlobalCooldown { get; init; }
|
||||
public string? Damage { get; init; }
|
||||
public string? Cooldown { get; init; }
|
||||
public string? Mana { get; init; }
|
||||
public string? DamageType { get; init; }
|
||||
public string? Heal { get; init; }
|
||||
public string? Shield { get; init; }
|
||||
public string? Order { get; init; }
|
||||
public string? Priority { get; init; }
|
||||
public bool? Completed { get; init; }
|
||||
public string? Gdc { get; init; }
|
||||
public List<string>? Tags { get; init; }
|
||||
public List<string>? Related { get; init; }
|
||||
public string? SwiftReprievalChance { get; init; }
|
||||
public string? AreaDamagePercentage { get; init; }
|
||||
public string? GeneratesSpirit { get; init; }
|
||||
public string? Duration { get; init; }
|
||||
public string? DamageReduction { get; init; }
|
||||
public string? DamageTickTime { get; init; }
|
||||
public bool? IsToggle { get; init; }
|
||||
public string? ManaUpkeepTick { get; init; }
|
||||
public string? ParryChance { get; init; }
|
||||
public string? DamageRedirection { get; init; }
|
||||
public string? SpiritCost { get; init; }
|
||||
public string? SecondEffectDuration { get; init; }
|
||||
public string? SecondEffectDamageReduction { get; init; }
|
||||
public string? HealingDuration { get; init; }
|
||||
public string? HealingTickTime { get; init; }
|
||||
public string? CostSwiftReprieval { get; init; }
|
||||
public string? GdcDuration { get; init; }
|
||||
public string? Effect { get; init; }
|
||||
public string? Raw { get; init; }
|
||||
}
|
||||
@@ -19,6 +19,11 @@
|
||||
<span class="bi bi-keyboard-nav-menu" aria-hidden="true"></span> Keyboard
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="docs">
|
||||
<span class="bi bi-book-nav-menu" aria-hidden="true"></span> Docs
|
||||
</NavLink>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,331 @@
|
||||
@page "/docs"
|
||||
@using System.Text.RegularExpressions
|
||||
|
||||
<PageTitle>Fellowship Docs</PageTitle>
|
||||
|
||||
<div class="docs-page">
|
||||
<div class="docs-header">
|
||||
<h1 class="docs-title">Fellowship Reference</h1>
|
||||
<p class="docs-subtitle">@DocsData.All.Count entries across @Groups.Count() categories</p>
|
||||
<div class="docs-search">
|
||||
<span class="search-icon">🔍</span>
|
||||
<input type="text" class="search-input" placeholder="Search docs..." @bind="searchTerm" @bind:after="OnSearchChanged" />
|
||||
@if (!string.IsNullOrEmpty(searchTerm))
|
||||
{
|
||||
<button class="search-clear" @onclick="ClearSearch">×</button>
|
||||
}
|
||||
</div>
|
||||
<div class="docs-filter-bar">
|
||||
<button class="filter-btn @(activeFilter == null ? "active" : "")" @onclick="FilterAll">All</button>
|
||||
<button class="filter-btn @(activeFilter == "Skill" ? "active" : "")" @onclick="FilterSkills">Skills</button>
|
||||
<button class="filter-btn @(activeFilter == "Debuff" ? "active" : "")" @onclick="FilterDebuffs">Debuffs</button>
|
||||
<button class="filter-btn @(activeFilter == "Buff" ? "active" : "")" @onclick="FilterBuffs">Buffs</button>
|
||||
<button class="filter-btn @(activeFilter == "Key" ? "active" : "")" @onclick="FilterKeys">Keys</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="docs-body">
|
||||
<nav class="docs-sidebar">
|
||||
<div class="sidebar-inner">
|
||||
@foreach (var group in FilteredGroups)
|
||||
{
|
||||
var groupId = GetGroupId(group.Key);
|
||||
<div class="sidebar-group">
|
||||
<a class="sidebar-group-title" href="@($"#{groupId}")">@group.Key</a>
|
||||
<div class="sidebar-items">
|
||||
@foreach (var doc in group)
|
||||
{
|
||||
var docId = GetDocId(doc);
|
||||
<a class="sidebar-item" href="@($"#{docId}")" title="@doc.FileName">
|
||||
<span class="sidebar-item-badge @GetTypeClass(doc)"></span>
|
||||
@GetDisplayName(doc)
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="docs-content">
|
||||
@if (!FilteredGroups.Any())
|
||||
{
|
||||
<div class="no-results">
|
||||
<p>No docs match "@searchTerm"</p>
|
||||
<button class="filter-btn" @onclick="ClearSearch">Clear search</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
@foreach (var group in FilteredGroups)
|
||||
{
|
||||
var groupId = GetGroupId(group.Key);
|
||||
<section class="group-section">
|
||||
<div class="group-header" id="@groupId">
|
||||
<h2 class="group-title">@group.Key</h2>
|
||||
<span class="group-count">@group.Count()</span>
|
||||
</div>
|
||||
|
||||
@foreach (var doc in group)
|
||||
{
|
||||
var docId = GetDocId(doc);
|
||||
var typeName = doc.GetType().Name.Replace("Doc", "");
|
||||
<article class="doc-card" id="@docId">
|
||||
<div class="doc-card-header">
|
||||
<div class="doc-card-title-row">
|
||||
<h3 class="doc-card-title">@GetDisplayName(doc)</h3>
|
||||
<span class="doc-type-badge @GetTypeClass(doc)">@typeName</span>
|
||||
</div>
|
||||
@if (doc is SkillDoc { Key: { } key } && !string.IsNullOrEmpty(key))
|
||||
{
|
||||
<div class="doc-key-badge">
|
||||
<span class="key-icon">⌨</span>
|
||||
<span class="key-text">@key</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="doc-card-body">
|
||||
@if (doc is SkillDoc { Description: { } desc } && !string.IsNullOrEmpty(desc))
|
||||
{
|
||||
<div class="doc-description">
|
||||
@{
|
||||
var lines = desc.Split('\n');
|
||||
foreach (var line in lines)
|
||||
{
|
||||
<p>@RenderWikiLinks(line)</p>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="doc-fields">
|
||||
@foreach (var field in GetOrderedFields(doc))
|
||||
{
|
||||
<div class="doc-field">
|
||||
<span class="doc-field-label">@field.Label</span>
|
||||
<span class="doc-field-value">@field.Value</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (GetBody(doc) is { } body && !string.IsNullOrWhiteSpace(body) && (doc is not SkillDoc || string.IsNullOrWhiteSpace(((SkillDoc)doc).Description)))
|
||||
{
|
||||
<div class="doc-body">
|
||||
<pre class="doc-body-text">@body.Trim()</pre>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (doc is SkillDoc { Tags: { } tags } && tags.Count > 0)
|
||||
{
|
||||
<div class="doc-card-footer">
|
||||
@foreach (var tag in tags)
|
||||
{
|
||||
<span class="tag-badge">@tag</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</article>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private string? searchTerm;
|
||||
private string? activeFilter;
|
||||
private List<IGrouping<string, DocEntry>> Groups = [];
|
||||
private IEnumerable<IGrouping<string, DocEntry>> FilteredGroups => Groups
|
||||
.Where(g => g.Any(d => MatchesFilter(d)))
|
||||
.OrderBy(g => SortOrder(g.Key));
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Groups = DocsData.All
|
||||
.GroupBy(d => GetCharacterOrType(d))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private bool MatchesFilter(DocEntry doc)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(searchTerm))
|
||||
{
|
||||
var term = searchTerm.Trim().ToLowerInvariant();
|
||||
var name = GetDisplayName(doc).ToLowerInvariant();
|
||||
if (!name.Contains(term)) return false;
|
||||
}
|
||||
if (activeFilter != null)
|
||||
{
|
||||
var type = doc.GetType().Name.Replace("Doc", "");
|
||||
if (type != activeFilter) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static int SortOrder(string groupKey) => groupKey switch
|
||||
{
|
||||
"Xavian" => 0,
|
||||
"Rime" => 1,
|
||||
"Vigour" => 2,
|
||||
"Keys" => 3,
|
||||
_ => 99
|
||||
};
|
||||
|
||||
private void OnSearchChanged()
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void ClearSearch()
|
||||
{
|
||||
searchTerm = null;
|
||||
activeFilter = null;
|
||||
}
|
||||
|
||||
private void FilterAll() { activeFilter = null; }
|
||||
private void FilterSkills() { activeFilter = activeFilter == "Skill" ? null : "Skill"; }
|
||||
private void FilterDebuffs() { activeFilter = activeFilter == "Debuff" ? null : "Debuff"; }
|
||||
private void FilterBuffs() { activeFilter = activeFilter == "Buff" ? null : "Buff"; }
|
||||
private void FilterKeys() { activeFilter = activeFilter == "Key" ? null : "Key"; }
|
||||
|
||||
private static string GetCharacterOrType(DocEntry doc) => doc switch
|
||||
{
|
||||
SkillDoc s => s.Character,
|
||||
DebuffDoc d => d.Character,
|
||||
BuffDoc b => b.Character,
|
||||
CharacterDoc c => c.Character,
|
||||
KeyDoc => "Keys",
|
||||
_ => "Other"
|
||||
};
|
||||
|
||||
private static string GetDisplayName(DocEntry doc) =>
|
||||
Path.GetFileNameWithoutExtension(doc.FileName);
|
||||
|
||||
private static string GetGroupId(string group) =>
|
||||
$"group-{group.GetHashCode():x}";
|
||||
|
||||
private static string GetDocId(DocEntry doc) =>
|
||||
$"doc-{doc.FileName.GetHashCode():x}";
|
||||
|
||||
private static string GetTypeClass(DocEntry doc) => doc switch
|
||||
{
|
||||
SkillDoc => "type-skill",
|
||||
DebuffDoc => "type-debuff",
|
||||
BuffDoc => "type-buff",
|
||||
KeyDoc => "type-key",
|
||||
CharacterDoc => "type-character",
|
||||
_ => ""
|
||||
};
|
||||
|
||||
private static MarkupString RenderWikiLinks(string line)
|
||||
{
|
||||
var result = Regex.Replace(line, @"\[\[([^\]]+)\]\]", m =>
|
||||
{
|
||||
var name = m.Groups[1].Value;
|
||||
return $"<span class=\"wiki-link\">{name}</span>";
|
||||
});
|
||||
return new MarkupString(result);
|
||||
}
|
||||
|
||||
private static readonly Dictionary<string, string> FieldLabels = new()
|
||||
{
|
||||
["Character"] = "Character",
|
||||
["Cast"] = "Cast Time",
|
||||
["Key"] = "Key Bind",
|
||||
["Range"] = "Range",
|
||||
["Damage"] = "Damage",
|
||||
["DamageType"] = "Damage Type",
|
||||
["Heal"] = "Healing",
|
||||
["Shield"] = "Shield",
|
||||
["Cooldown"] = "Cooldown",
|
||||
["Mana"] = "Mana Cost",
|
||||
["OffGlobalCooldown"] = "Off GCD",
|
||||
["Gdc"] = "GDC",
|
||||
["Duration"] = "Duration",
|
||||
["DamageReduction"] = "Dmg Reduction",
|
||||
["DamageTickTime"] = "Tick Interval",
|
||||
["IsToggle"] = "Toggle",
|
||||
["ManaUpkeepTick"] = "Mana Upkeep",
|
||||
["ParryChance"] = "Parry Chance",
|
||||
["DamageRedirection"] = "Dmg Redirection",
|
||||
["SpiritCost"] = "Spirit Cost",
|
||||
["SecondEffectDuration"] = "Effect 2 Duration",
|
||||
["SecondEffectDamageReduction"] = "Effect 2 Dmg Reduction",
|
||||
["HealingDuration"] = "Healing Duration",
|
||||
["HealingTickTime"] = "Healing Tick",
|
||||
["CostSwiftReprieval"] = "Cost: Swift Reprieval",
|
||||
["GdcDuration"] = "GDC Duration",
|
||||
["Effect"] = "Effect",
|
||||
["GeneratesSpirit"] = "Generates Spirit",
|
||||
["AreaDamagePercentage"] = "Cleave %",
|
||||
["SwiftReprievalChance"] = "Swift Reprieval %",
|
||||
["MaxStacks"] = "Max Stacks",
|
||||
["Action"] = "Action",
|
||||
["ParryChanceBonus"] = "Parry Bonus",
|
||||
["ManaRestoreBase"] = "Mana Restore Base",
|
||||
["ManaRestorePerStack"] = "Mana Per Stack",
|
||||
["Order"] = "Order",
|
||||
["Priority"] = "Priority",
|
||||
["Completed"] = "Completed",
|
||||
["Raw"] = "Raw",
|
||||
};
|
||||
|
||||
private static readonly Dictionary<Type, string[]> FieldOrder = new()
|
||||
{
|
||||
[typeof(SkillDoc)] = ["Character", "Cast", "Key", "Range", "Damage", "DamageType", "Heal", "Shield", "Cooldown", "Mana", "OffGlobalCooldown", "Gdc", "Duration", "DamageReduction", "DamageTickTime", "IsToggle", "ManaUpkeepTick", "ParryChance", "DamageRedirection", "GeneratesSpirit", "AreaDamagePercentage", "SwiftReprievalChance", "Effect", "SpiritCost", "SecondEffectDuration", "SecondEffectDamageReduction", "HealingDuration", "HealingTickTime", "CostSwiftReprieval", "GdcDuration"],
|
||||
[typeof(DebuffDoc)] = ["Character", "MaxStacks", "Duration", "ParryChanceBonus", "ManaRestoreBase", "ManaRestorePerStack"],
|
||||
[typeof(BuffDoc)] = ["Character", "MaxStacks"],
|
||||
[typeof(KeyDoc)] = ["Action"],
|
||||
[typeof(CharacterDoc)] = ["Character"],
|
||||
};
|
||||
|
||||
private static List<FieldEntry> GetOrderedFields(DocEntry doc)
|
||||
{
|
||||
var result = new List<FieldEntry>();
|
||||
var type = doc.GetType();
|
||||
var order = FieldOrder.GetValueOrDefault(type, []);
|
||||
var allProps = new Dictionary<string, string>();
|
||||
|
||||
foreach (var prop in type.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance))
|
||||
{
|
||||
var name = prop.Name;
|
||||
if (name is "FileName" or "FilePath" or "Body" or "Description") continue;
|
||||
|
||||
var value = prop.GetValue(doc);
|
||||
if (value == null) continue;
|
||||
|
||||
if (value is bool bVal && !bVal) continue;
|
||||
if (value is string s && string.IsNullOrEmpty(s)) continue;
|
||||
|
||||
var display = value switch
|
||||
{
|
||||
List<string> list => string.Join(", ", list),
|
||||
_ => value.ToString()
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(display)) continue;
|
||||
allProps[name] = display;
|
||||
}
|
||||
|
||||
foreach (var key in order)
|
||||
{
|
||||
if (allProps.Remove(key, out var val))
|
||||
{
|
||||
result.Add(new FieldEntry(FieldLabels.GetValueOrDefault(key, key), val));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var (key, val) in allProps)
|
||||
{
|
||||
result.Add(new FieldEntry(FieldLabels.GetValueOrDefault(key, key), val));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string? GetBody(DocEntry doc) => doc.Body;
|
||||
|
||||
private record FieldEntry(string Label, string Value);
|
||||
}
|
||||
@@ -0,0 +1,433 @@
|
||||
.docs-page {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
color: #e0e0e0;
|
||||
}
|
||||
|
||||
.docs-header {
|
||||
padding: 24px 0 16px;
|
||||
border-bottom: 1px solid #2a2a2a;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.docs-title {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
|
||||
.docs-subtitle {
|
||||
color: #888;
|
||||
font-size: 13px;
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
|
||||
.docs-search {
|
||||
position: relative;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
position: absolute;
|
||||
left: 12px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 14px;
|
||||
opacity: 0.5;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
width: 100%;
|
||||
padding: 10px 36px 10px 36px;
|
||||
border: 1px solid #333;
|
||||
border-radius: 8px;
|
||||
background: #1a1a1a;
|
||||
color: #e0e0e0;
|
||||
font-size: 14px;
|
||||
outline: none;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.search-input:focus {
|
||||
border-color: #5588ff;
|
||||
box-shadow: 0 0 0 3px rgba(85, 136, 255, 0.15);
|
||||
}
|
||||
|
||||
.search-input::placeholder {
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.search-clear {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: none;
|
||||
border: none;
|
||||
color: #888;
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
padding: 4px 8px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.search-clear:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.docs-filter-bar {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.filter-btn {
|
||||
padding: 6px 14px;
|
||||
border: 1px solid #333;
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
color: #aaa;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.filter-btn:hover {
|
||||
border-color: #5588ff;
|
||||
color: #5588ff;
|
||||
background: rgba(85, 136, 255, 0.08);
|
||||
}
|
||||
|
||||
.filter-btn.active {
|
||||
border-color: #5588ff;
|
||||
color: #fff;
|
||||
background: #5588ff;
|
||||
}
|
||||
|
||||
.docs-body {
|
||||
display: flex;
|
||||
gap: 28px;
|
||||
}
|
||||
|
||||
.docs-sidebar {
|
||||
width: 220px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.sidebar-inner {
|
||||
position: sticky;
|
||||
top: 16px;
|
||||
max-height: calc(100vh - 120px);
|
||||
overflow-y: auto;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.sidebar-inner::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.sidebar-inner::-webkit-scrollbar-thumb {
|
||||
background: #333;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.sidebar-group {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.sidebar-group-title {
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1.2px;
|
||||
color: #666;
|
||||
text-decoration: none;
|
||||
padding: 4px 8px;
|
||||
margin-bottom: 4px;
|
||||
transition: color 0.15s;
|
||||
}
|
||||
|
||||
.sidebar-group-title:hover {
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.sidebar-items {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sidebar-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 5px 8px 5px 12px;
|
||||
font-size: 13px;
|
||||
color: #999;
|
||||
text-decoration: none;
|
||||
border-radius: 4px;
|
||||
transition: all 0.15s;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.sidebar-item:hover {
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.sidebar-item-badge {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.sidebar-item-badge.type-skill { background: #5588ff; }
|
||||
.sidebar-item-badge.type-debuff { background: #ff5544; }
|
||||
.sidebar-item-badge.type-buff { background: #44bb66; }
|
||||
.sidebar-item-badge.type-key { background: #888; }
|
||||
.sidebar-item-badge.type-character { background: #ffaa33; }
|
||||
|
||||
.docs-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.no-results {
|
||||
text-align: center;
|
||||
padding: 60px 20px;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.no-results p {
|
||||
font-size: 16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.group-section {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.group-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 2px solid #2a2a2a;
|
||||
}
|
||||
|
||||
.group-title {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.group-count {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
background: #1a1a1a;
|
||||
padding: 2px 10px;
|
||||
border-radius: 10px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.doc-card {
|
||||
background: #161616;
|
||||
border: 1px solid #2a2a2a;
|
||||
border-radius: 12px;
|
||||
margin-bottom: 16px;
|
||||
overflow: hidden;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.doc-card:hover {
|
||||
border-color: #3a3a3a;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.doc-card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
padding: 16px 20px 12px;
|
||||
background: linear-gradient(135deg, #1e1e1e, #181818);
|
||||
border-bottom: 1px solid #2a2a2a;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.doc-card-title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.doc-card-title {
|
||||
font-size: 17px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.doc-type-badge {
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.8px;
|
||||
padding: 3px 10px;
|
||||
border-radius: 4px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.doc-type-badge.type-skill { background: rgba(85, 136, 255, 0.15); color: #7799ff; border: 1px solid rgba(85, 136, 255, 0.3); }
|
||||
.doc-type-badge.type-debuff { background: rgba(255, 85, 68, 0.15); color: #ff7766; border: 1px solid rgba(255, 85, 68, 0.3); }
|
||||
.doc-type-badge.type-buff { background: rgba(68, 187, 102, 0.15); color: #66dd88; border: 1px solid rgba(68, 187, 102, 0.3); }
|
||||
.doc-type-badge.type-key { background: rgba(136, 136, 136, 0.15); color: #aaa; border: 1px solid rgba(136, 136, 136, 0.3); }
|
||||
.doc-type-badge.type-character { background: rgba(255, 170, 51, 0.15); color: #ffbb55; border: 1px solid rgba(255, 170, 51, 0.3); }
|
||||
|
||||
.doc-key-badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: #0f0f0f;
|
||||
border: 1px solid #333;
|
||||
border-radius: 6px;
|
||||
padding: 5px 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.key-icon {
|
||||
font-size: 14px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.key-text {
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
|
||||
.doc-card-body {
|
||||
padding: 16px 20px;
|
||||
}
|
||||
|
||||
.doc-description {
|
||||
margin-bottom: 14px;
|
||||
padding: 12px 16px;
|
||||
background: #121212;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #222;
|
||||
}
|
||||
|
||||
.doc-description p {
|
||||
margin: 0 0 4px;
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.doc-description p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.wiki-link {
|
||||
color: #7799ff;
|
||||
font-weight: 600;
|
||||
border-bottom: 1px dashed rgba(85, 136, 255, 0.3);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.doc-fields {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
gap: 6px 16px;
|
||||
}
|
||||
|
||||
.doc-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 6px 10px;
|
||||
background: #131313;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #222;
|
||||
}
|
||||
|
||||
.doc-field-label {
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.6px;
|
||||
color: #666;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.doc-field-value {
|
||||
font-size: 14px;
|
||||
color: #ddd;
|
||||
font-weight: 500;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.doc-body {
|
||||
margin-top: 14px;
|
||||
padding: 12px 16px;
|
||||
background: #0f0f0f;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #1a1a1a;
|
||||
}
|
||||
|
||||
.doc-body-text {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: #888;
|
||||
white-space: pre-wrap;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.doc-card-footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
padding: 10px 20px 14px;
|
||||
border-top: 1px solid #222;
|
||||
}
|
||||
|
||||
.tag-badge {
|
||||
font-size: 11px;
|
||||
padding: 4px 12px;
|
||||
border-radius: 4px;
|
||||
background: rgba(85, 136, 255, 0.1);
|
||||
color: #7799ff;
|
||||
border: 1px solid rgba(85, 136, 255, 0.2);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.docs-sidebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.docs-fields {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.doc-card-header {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.doc-fields {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -16,4 +16,7 @@
|
||||
<ProjectReference Include="..\Model\Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="GenerateDocs" BeforeTargets="BeforeBuild">
|
||||
<Exec Command="dotnet run --project ../Build/Build.csproj" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
@@ -6,5 +6,6 @@
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.AspNetCore.Components.WebAssembly.Http
|
||||
@using Microsoft.JSInterop
|
||||
@using Model
|
||||
@using Web
|
||||
@using Web.Layout
|
||||
Reference in New Issue
Block a user