Refactor Home page into concern-based components and partials
This commit is contained in:
55
RpgRoller/Components/Pages/Home.Models.cs
Normal file
55
RpgRoller/Components/Pages/Home.Models.cs
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user