| | | 1 | | using Microsoft.AspNetCore.Components; |
| | | 2 | | using Pomodoro.Web.Services.Formatters; |
| | | 3 | | |
| | | 4 | | namespace Pomodoro.Web.Components.History; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Code-behind for StatCard component |
| | | 8 | | /// Displays a single statistic with icon, value and label |
| | | 9 | | /// </summary> |
| | | 10 | | public class StatCardBase : ComponentBase |
| | | 11 | | { |
| | | 12 | | [Inject] |
| | 154 | 13 | | private StatCardFormatter Formatter { get; set; } = null!; |
| | | 14 | | |
| | | 15 | | #region Parameters |
| | | 16 | | |
| | | 17 | | [Parameter] |
| | 214 | 18 | | public string Icon { get; set; } = string.Empty; |
| | | 19 | | |
| | | 20 | | [Parameter] |
| | 214 | 21 | | public string Value { get; set; } = string.Empty; |
| | | 22 | | |
| | | 23 | | [Parameter] |
| | 213 | 24 | | public string Label { get; set; } = string.Empty; |
| | | 25 | | |
| | | 26 | | #endregion |
| | | 27 | | |
| | | 28 | | #region Methods for Testing |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Gets the formatted display value |
| | | 32 | | /// </summary> |
| | | 33 | | public string GetFormattedValue() |
| | 2 | 34 | | { |
| | 2 | 35 | | return Formatter.GetFormattedValue(Value); |
| | 2 | 36 | | } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Gets the formatted display label |
| | | 40 | | /// </summary> |
| | | 41 | | public string GetFormattedLabel() |
| | 2 | 42 | | { |
| | 2 | 43 | | return Formatter.GetFormattedLabel(Label); |
| | 2 | 44 | | } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Gets the formatted display icon |
| | | 48 | | /// </summary> |
| | | 49 | | public string GetFormattedIcon() |
| | 2 | 50 | | { |
| | 2 | 51 | | return Formatter.GetFormattedIcon(Icon); |
| | 2 | 52 | | } |
| | | 53 | | |
| | | 54 | | /// <summary> |
| | | 55 | | /// Checks if the card has all required data |
| | | 56 | | /// </summary> |
| | | 57 | | public bool HasRequiredData() |
| | 2 | 58 | | { |
| | 2 | 59 | | return Formatter.HasRequiredData(Icon, Value, Label); |
| | 2 | 60 | | } |
| | | 61 | | |
| | | 62 | | #endregion |
| | | 63 | | } |