(container: HTMLElement, stats: OverallStats)
| 1048 | } |
| 1049 | |
| 1050 | private renderOverviewStats(container: HTMLElement, stats: OverallStats) { |
| 1051 | container.empty(); |
| 1052 | |
| 1053 | // Format time duration in hours and minutes |
| 1054 | const formatTime = (minutes: number): string => { |
| 1055 | if (minutes < 60) return `${Math.round(minutes)}m`; |
| 1056 | const hours = Math.floor(minutes / 60); |
| 1057 | const mins = Math.round(minutes % 60); |
| 1058 | return mins > 0 ? `${hours}h ${mins}m` : `${hours}h`; |
| 1059 | }; |
| 1060 | |
| 1061 | // Total Time |
| 1062 | const totalTimeCard = container.createDiv({ |
| 1063 | cls: "stats-overview-card stats-view__overview-card", |
| 1064 | }); |
| 1065 | const totalTimeValue = totalTimeCard.createDiv({ |
| 1066 | cls: "overview-value stats-view__overview-value", |
| 1067 | }); |
| 1068 | totalTimeValue.textContent = `${formatTime(stats.totalTimeSpent)} / ${formatTime(stats.totalTimeEstimate)}`; |
| 1069 | totalTimeCard.createDiv({ |
| 1070 | cls: "overview-label stats-view__overview-label", |
| 1071 | text: this.plugin.i18n.translate("views.stats.cards.timeTrackedEstimated"), |
| 1072 | }); |
| 1073 | |
| 1074 | // Total Tasks |
| 1075 | const totalTasksCard = container.createDiv({ |
| 1076 | cls: "stats-overview-card stats-view__overview-card", |
| 1077 | }); |
| 1078 | const totalTasksValue = totalTasksCard.createDiv({ |
| 1079 | cls: "overview-value stats-view__overview-value", |
| 1080 | }); |
| 1081 | totalTasksValue.textContent = stats.totalTasks.toString(); |
| 1082 | totalTasksCard.createDiv({ |
| 1083 | cls: "overview-label stats-view__overview-label", |
| 1084 | text: this.plugin.i18n.translate("views.stats.cards.totalTasks"), |
| 1085 | }); |
| 1086 | |
| 1087 | // Completion Rate |
| 1088 | const completionCard = container.createDiv({ |
| 1089 | cls: "stats-overview-card stats-view__overview-card", |
| 1090 | }); |
| 1091 | const completionValue = completionCard.createDiv({ |
| 1092 | cls: "overview-value stats-view__overview-value", |
| 1093 | }); |
| 1094 | completionValue.textContent = `${Math.round(stats.completionRate)}%`; |
| 1095 | completionCard.createDiv({ |
| 1096 | cls: "overview-label stats-view__overview-label", |
| 1097 | text: this.plugin.i18n.translate("views.stats.cards.completionRate"), |
| 1098 | }); |
| 1099 | |
| 1100 | // Active Projects |
| 1101 | const projectsCard = container.createDiv({ |
| 1102 | cls: "stats-overview-card stats-view__overview-card", |
| 1103 | }); |
| 1104 | const projectsValue = projectsCard.createDiv({ |
| 1105 | cls: "overview-value stats-view__overview-value", |
| 1106 | }); |
| 1107 | projectsValue.textContent = stats.activeProjects.toString(); |
no test coverage detected