| | | 1 | | namespace Pomodoro.Web.Services.Formatters; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Formatter service for SummaryCards component |
| | | 5 | | /// </summary> |
| | | 6 | | public class SummaryCardsFormatter |
| | | 7 | | { |
| | | 8 | | private readonly TimeFormatter _timeFormatter; |
| | | 9 | | |
| | | 10 | | /// <summary> |
| | | 11 | | /// Initializes a new instance of the SummaryCardsFormatter class |
| | | 12 | | /// </summary> |
| | | 13 | | /// <param name="timeFormatter">Time formatter service</param> |
| | 237 | 14 | | public SummaryCardsFormatter(TimeFormatter timeFormatter) |
| | 237 | 15 | | { |
| | 237 | 16 | | _timeFormatter = timeFormatter; |
| | 237 | 17 | | } |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Formats time in a simple format (e.g., "1h 30m") |
| | | 21 | | /// </summary> |
| | | 22 | | /// <param name="minutes">Minutes to format</param> |
| | | 23 | | /// <returns>Formatted time string</returns> |
| | | 24 | | public string FormatTime(int minutes) |
| | 39 | 25 | | { |
| | 39 | 26 | | return _timeFormatter.FormatSimpleTime(minutes); |
| | 39 | 27 | | } |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Formats a count value (e.g., "5 sessions") |
| | | 31 | | /// </summary> |
| | | 32 | | /// <param name="count">Count to format</param> |
| | | 33 | | /// <returns>Formatted count string</returns> |
| | | 34 | | public string FormatCount(int count) |
| | 10 | 35 | | { |
| | 10 | 36 | | return $"{count} sessions"; |
| | 10 | 37 | | } |
| | | 38 | | } |