< Summary

Information
Class: Chronicis.Client.Components.Characters.CharacterClaimButton_REFACTORED
Assembly: Chronicis.Client
File(s): /home/runner/work/chronicis/chronicis/src/Chronicis.Client/Components/Characters/CharacterClaimButton_REFACTORED.razor
Line coverage
93%
Covered lines: 15
Uncovered lines: 1
Coverable lines: 16
Total lines: 101
Line coverage: 93.7%
Branch coverage
83%
Covered branches: 10
Total branches: 12
Branch coverage: 83.3%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
BuildRenderTree(...)87.5%88100%
get_ClaimStatus()100%11100%
get_IsLoading()100%11100%
get_IsProcessing()100%11100%
get_OnClaim()100%11100%
get_OnUnclaim()100%11100%
HandleClaim()100%11100%
HandleUnclaim()100%11100%

File(s)

/home/runner/work/chronicis/chronicis/src/Chronicis.Client/Components/Characters/CharacterClaimButton_REFACTORED.razor

#LineLine coverage
 1@* CharacterClaimButton.razor - Refactored to accept data as parameters *@
 2@* Pure presentation component - no service dependencies *@
 3
 94@if (IsLoading)
 5{
 6    <MudProgressCircular Size="Size.Small" Indeterminate="true" />
 7}
 88else if (ClaimStatus != null)
 9{
 810    @if (ClaimStatus.IsClaimedByMe)
 11    {
 12        <MudButton Variant="Variant.Outlined"
 13                   Color="Color.Success"
 14                   Size="Size.Small"
 15                   StartIcon="@Icons.Material.Filled.CheckCircle"
 16                   OnClick="HandleUnclaim"
 17                   Disabled="IsProcessing">
 318            @if (IsProcessing)
 19            {
 20                <MudProgressCircular Size="Size.Small" Indeterminate="true" Class="mr-2" />
 21            }
 22            My Character
 23        </MudButton>
 24    }
 525    else if (ClaimStatus.IsClaimed)
 26    {
 27        <MudTooltip Text="@($"Claimed by {ClaimStatus.ClaimedByName}")">
 28            <MudChip T="string"
 29                     Size="Size.Small"
 30                     Variant="Variant.Outlined"
 31                     Icon="@Icons.Material.Filled.Person">
 032                @ClaimStatus.ClaimedByName's Character
 33            </MudChip>
 34        </MudTooltip>
 35    }
 36    else
 37    {
 38        <MudButton Variant="Variant.Outlined"
 39                   Color="Color.Primary"
 40                   Size="Size.Small"
 41                   StartIcon="@Icons.Material.Filled.PersonAdd"
 42                   OnClick="HandleClaim"
 43                   Disabled="IsProcessing">
 544            @if (IsProcessing)
 45            {
 46                <MudProgressCircular Size="Size.Small" Indeterminate="true" Class="mr-2" />
 47            }
 48            Claim as My Character
 49        </MudButton>
 50    }
 51}
 52
 53@code {
 54    /// <summary>
 55    /// The character's claim status data.
 56    /// Parent component is responsible for loading this data.
 57    /// </summary>
 58    [Parameter]
 2759    public CharacterClaimStatusDto? ClaimStatus { get; set; }
 60
 61    /// <summary>
 62    /// Whether data is currently being loaded.
 63    /// Controls the loading indicator display.
 64    /// </summary>
 65    [Parameter]
 1666    public bool IsLoading { get; set; }
 67
 68    /// <summary>
 69    /// Whether a claim/unclaim operation is in progress.
 70    /// Controls button disabled state and processing indicator.
 71    /// </summary>
 72    [Parameter]
 1873    public bool IsProcessing { get; set; }
 74
 75    /// <summary>
 76    /// Event raised when the user requests to claim the character.
 77    /// Parent component handles the actual API call.
 78    /// </summary>
 79    [Parameter]
 280    public EventCallback OnClaim { get; set; }
 81
 82    /// <summary>
 83    /// Event raised when the user requests to unclaim the character.
 84    /// Parent component handles the actual API call.
 85    /// </summary>
 86    [Parameter]
 287    public EventCallback OnUnclaim { get; set; }
 88
 89    private async Task HandleClaim()
 90    {
 191        await OnClaim.InvokeAsync();
 192    }
 93
 94    private async Task HandleUnclaim()
 95    {
 196        await OnUnclaim.InvokeAsync();
 197    }
 98
 99    // Note: CharacterClaimStatusDto is defined in Chronicis.Api\Controllers\CharactersController.cs
 100    // This is a temporary location - ideally should be moved to Chronicis.Shared.DTOs
 101}