Refactor Home page into concern-based components and partials

This commit is contained in:
2026-02-26 09:42:06 +01:00
parent 2d1bf9b9b7
commit b17490e5ac
21 changed files with 1791 additions and 1528 deletions

View File

@@ -0,0 +1,55 @@
namespace RpgRoller.Components.Pages;
public sealed class FormState<TModel>
where TModel : new()
{
public TModel Model { get; } = new();
public Dictionary<string, string> Errors { get; } = [];
public string? ErrorMessage { get; set; }
public void ResetValidation()
{
Errors.Clear();
ErrorMessage = null;
}
}
public sealed class RegisterFormModel
{
public string Username { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
public sealed class LoginFormModel
{
public string Username { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
public sealed class CampaignFormModel
{
public string Name { get; set; } = string.Empty;
public string RulesetId { get; set; } = string.Empty;
}
public sealed class CharacterFormModel
{
public string Name { get; set; } = string.Empty;
public string CampaignId { get; set; } = string.Empty;
}
public sealed class SkillFormModel
{
public string Name { get; set; } = string.Empty;
public string DiceRollDefinition { get; set; } = string.Empty;
public int WildDice { get; set; }
public bool AllowFumble { get; set; }
}
public enum HomeViewMode
{
Loading,
Anonymous,
Workspace
}