| | | 1 | | using Microsoft.AspNetCore.Components; |
| | | 2 | | |
| | | 3 | | namespace Pomodoro.Web.Components; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Code-behind for TodaySummary component |
| | | 7 | | /// Separates business logic from view |
| | | 8 | | /// </summary> |
| | | 9 | | public class TodaySummaryBase : ComponentBase |
| | | 10 | | { |
| | | 11 | | #region Parameters (Model) |
| | | 12 | | |
| | | 13 | | [Parameter] |
| | 522 | 14 | | public int TotalFocusMinutes { get; set; } |
| | | 15 | | |
| | | 16 | | [Parameter] |
| | 522 | 17 | | public int PomodoroCount { get; set; } |
| | | 18 | | |
| | | 19 | | [Parameter] |
| | 522 | 20 | | public int TasksWorkedOn { get; set; } |
| | | 21 | | |
| | | 22 | | #endregion |
| | | 23 | | |
| | | 24 | | #region Business Logic Methods |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Formats minutes into human-readable time format |
| | | 28 | | /// </summary> |
| | | 29 | | protected string FormatTime(int minutes) |
| | 261 | 30 | | { |
| | 261 | 31 | | if (minutes < Constants.TimeConversion.MinutesPerHour) |
| | 253 | 32 | | return string.Format(Constants.TimeFormats.MinutesFormat, minutes); |
| | 8 | 33 | | var hours = minutes / Constants.TimeConversion.MinutesPerHour; |
| | 8 | 34 | | var mins = minutes % Constants.TimeConversion.MinutesPerHour; |
| | 8 | 35 | | return string.Format(Constants.TimeFormats.HoursMinutesFormat, hours, mins); |
| | 261 | 36 | | } |
| | | 37 | | |
| | | 38 | | #endregion |
| | | 39 | | } |