(container: HTMLElement, stats: TimeRangeStats)
| 1125 | } |
| 1126 | |
| 1127 | private renderTimeRangeStats(container: HTMLElement, stats: TimeRangeStats) { |
| 1128 | container.empty(); |
| 1129 | |
| 1130 | const formatTime = (minutes: number): string => { |
| 1131 | if (minutes < 60) return `${Math.round(minutes)}m`; |
| 1132 | const hours = Math.floor(minutes / 60); |
| 1133 | const mins = Math.round(minutes % 60); |
| 1134 | return mins > 0 ? `${hours}h ${mins}m` : `${hours}h`; |
| 1135 | }; |
| 1136 | |
| 1137 | // Time Tracked |
| 1138 | const timeCard = container.createDiv({ cls: "stats-stat-card stats-view__stat-card" }); |
| 1139 | timeCard.createDiv({ |
| 1140 | cls: "stat-value stats-view__stat-value", |
| 1141 | text: `${formatTime(stats.overall.totalTimeSpent)} / ${formatTime(stats.overall.totalTimeEstimate)}`, |
| 1142 | }); |
| 1143 | timeCard.createDiv({ |
| 1144 | cls: "stat-label stats-view__stat-label", |
| 1145 | text: this.plugin.i18n.translate("views.stats.cards.timeTrackedEstimated"), |
| 1146 | }); |
| 1147 | |
| 1148 | // Tasks |
| 1149 | const tasksCard = container.createDiv({ cls: "stats-stat-card stats-view__stat-card" }); |
| 1150 | tasksCard.createDiv({ |
| 1151 | cls: "stat-value stats-view__stat-value", |
| 1152 | text: stats.overall.totalTasks.toString(), |
| 1153 | }); |
| 1154 | tasksCard.createDiv({ |
| 1155 | cls: "stat-label stats-view__stat-label", |
| 1156 | text: this.plugin.i18n.translate("views.stats.labels.tasks"), |
| 1157 | }); |
| 1158 | |
| 1159 | // Completed |
| 1160 | const completedCard = container.createDiv({ cls: "stats-stat-card stats-view__stat-card" }); |
| 1161 | completedCard.createDiv({ |
| 1162 | cls: "stat-value stats-view__stat-value", |
| 1163 | text: stats.overall.completedTasks.toString(), |
| 1164 | }); |
| 1165 | completedCard.createDiv({ |
| 1166 | cls: "stat-label stats-view__stat-label", |
| 1167 | text: this.plugin.i18n.translate("views.stats.labels.completed"), |
| 1168 | }); |
| 1169 | |
| 1170 | // Projects |
| 1171 | const projectsCard = container.createDiv({ cls: "stats-stat-card stats-view__stat-card" }); |
| 1172 | projectsCard.createDiv({ |
| 1173 | cls: "stat-value stats-view__stat-value", |
| 1174 | text: stats.overall.activeProjects.toString(), |
| 1175 | }); |
| 1176 | projectsCard.createDiv({ |
| 1177 | cls: "stat-label stats-view__stat-label", |
| 1178 | text: this.plugin.i18n.translate("views.stats.labels.projects"), |
| 1179 | }); |
| 1180 | } |
| 1181 | |
| 1182 | private async renderProjectStats(container: HTMLElement, projects: ProjectStats[]) { |
| 1183 | container.empty(); |
no test coverage detected