All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 4s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Successful in 11m18s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Has been skipped
BCards Deployment Pipeline / Deploy to Release Swarm (ARM) (push) Successful in 17s
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using BCards.Web.Areas.Support.Services;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Security.Claims;
|
|
|
|
namespace BCards.Web.Areas.Support.ViewComponents;
|
|
|
|
public class SupportFabViewComponent : ViewComponent
|
|
{
|
|
private readonly ISupportService _supportService;
|
|
private readonly ILogger<SupportFabViewComponent> _logger;
|
|
|
|
public SupportFabViewComponent(ISupportService supportService, ILogger<SupportFabViewComponent> logger)
|
|
{
|
|
_supportService = supportService;
|
|
_logger = logger;
|
|
}
|
|
|
|
public async Task<IViewComponentResult> InvokeAsync()
|
|
{
|
|
try
|
|
{
|
|
var userId = UserClaimsPrincipal?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
|
var options = await _supportService.GetAvailableOptionsAsync(userId);
|
|
|
|
_logger.LogDebug("SupportFab invocado para usuário {UserId} - Opções: Rating={CanRate}, Form={CanUseContactForm}, Telegram={CanAccessTelegram}",
|
|
userId ?? "anônimo", options.CanRate, options.CanUseContactForm, options.CanAccessTelegram);
|
|
|
|
return View(options);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError(ex, "Erro ao carregar SupportFab ViewComponent");
|
|
return Content(string.Empty);
|
|
}
|
|
}
|
|
}
|