@page "/dashboard" @attribute [Authorize] @rendermode InteractiveServer @inject ICVCheckService CVCheckService @inject NavigationManager NavigationManager @inject AuthenticationStateProvider AuthenticationStateProvider @inject ILogger Logger Dashboard - TrueCV

Dashboard

View and manage your CV verification checks

New Check
@if (_isLoading) {
Loading...

Loading your checks...

} else if (!string.IsNullOrEmpty(_errorMessage)) { } else if (_checks.Count == 0) {

No CV Checks Yet

Start by uploading your first CV for verification

Upload CV
} else {

@_checks.Count

Total Checks

@_checks.Count(c => c.Status == "Completed")

Completed

@_checks.Count(c => c.Status is "Pending" or "Processing")

In Progress
Recent CV Checks
@foreach (var check in _checks) { }
File Name Date Status Score Actions
@check.OriginalFileName
@check.CreatedAt.ToString("dd MMM yyyy HH:mm") @switch (check.Status) { case "Completed": Completed break; case "Processing": Processing break; case "Pending": Pending break; case "Failed": Failed break; default: @check.Status break; } @if (check.VeracityScore.HasValue) { @check.VeracityScore } else { - } @if (check.Status == "Completed") { View Report } else if (check.Status is "Pending" or "Processing") { } else { Retry }
}
@code { private List _checks = []; private bool _isLoading = true; private string? _errorMessage; protected override async Task OnInitializedAsync() { await LoadChecks(); } private async Task LoadChecks() { _isLoading = true; _errorMessage = null; try { var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); var userIdClaim = authState.User.FindFirst(ClaimTypes.NameIdentifier)?.Value; if (string.IsNullOrEmpty(userIdClaim) || !Guid.TryParse(userIdClaim, out var userId)) { _errorMessage = "Unable to identify user. Please log in again."; return; } _checks = await CVCheckService.GetUserChecksAsync(userId); } catch (Exception ex) { Logger.LogError(ex, "Error loading CV checks"); _errorMessage = "An error occurred while loading checks. Please try again."; } finally { _isLoading = false; } } private void ViewReport(CVCheckDto check) { if (check.Status == "Completed") { NavigationManager.NavigateTo($"/report/{check.Id}"); } } private static string GetScoreBadgeClass(int score) { return score switch { > 70 => "bg-success", >= 50 => "bg-warning text-dark", _ => "bg-danger" }; } }