@page "/dashboard"
@using DiunaBI.UI.Shared.Services
@using MudBlazor
@inject AuthService AuthService
@inject NavigationManager NavigationManager

<MudText Typo="Typo.body1" Class="mt-4">Witaj w DiunaBI!</MudText>

@if (AuthService.IsAuthenticated && AuthService.CurrentUser != null)
{
    <MudCard Class="mt-4" Elevation="2">
        <MudCardHeader>
            <CardHeaderAvatar>
                @if (!string.IsNullOrEmpty(AuthService.CurrentUser.AvatarUrl))
                {
                    <MudAvatar Size="Size.Large" Style="background: transparent;">
                        <img src="@AuthService.CurrentUser.AvatarUrl" alt="Avatar" style="width: 100%; height: 100%; object-fit: cover; border-radius: 50%;" />
                    </MudAvatar>
                }
                else
                {
                    <MudAvatar Color="Color.Primary" Size="Size.Large">
                        @(AuthService.CurrentUser.FullName.Length > 0 ? AuthService.CurrentUser.FullName.Substring(0, 1) : "?")
                    </MudAvatar>
                }
            </CardHeaderAvatar>
            <CardHeaderContent>
                <MudText Typo="Typo.h6">@AuthService.CurrentUser.FullName</MudText>
                <MudText Typo="Typo.body2">@AuthService.CurrentUser.Email</MudText>
            </CardHeaderContent>
        </MudCardHeader>
        <MudCardContent>
            <MudText Typo="Typo.body2">
                ✅ Zalogowano przez Google
            </MudText>
        </MudCardContent>
    </MudCard>
}
else
{
    <MudAlert Severity="Severity.Warning" Class="mt-4">
        Nie jesteś zalogowany
    </MudAlert>
}