feat: sort table by time

This commit is contained in:
robin committed 2026-08-25 13:38:22 +02:00
1 parent c5e351cec3
commit 966554e615
1 file changed
+6 -3
+6 -3
View File
@@ -120,11 +120,13 @@ export default async function EvaluationPage({ searchParams }: PageProps) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{Object.entries(times).map(([category, minutes]) => ( {Object.entries(times)
.sort(([, minutesA], [, minutesB]) => minutesB - minutesA)
.map(([category, minutes]) => (
<tr key={category} style={{ borderBottom: '1px solid #e5e7eb' }}> <tr key={category} style={{ borderBottom: '1px solid #e5e7eb' }}>
<td style={{ padding: '0.5rem' }}>{category}</td> <td style={{ padding: '0.5rem' }}>{category}</td>
<td style={{ padding: '0.5rem', whiteSpace: 'nowrap' }}> <td style={{ padding: '0.5rem', whiteSpace: 'nowrap' }}>
{Math.floor(minutes / 60)}:{Math.round(minutes % 60)}h (={Math.round(minutes)} min) {Math.floor(minutes / 60)}:{Math.round(minutes % 60).toString().padStart(2, '0')}h (={Math.round(minutes)} min)
</td> </td>
<td style={{ padding: '0.5rem' }}> <td style={{ padding: '0.5rem' }}>
{total > 0 ? Math.round((minutes / total) * 1000) / 10 : 0}% {total > 0 ? Math.round((minutes / total) * 1000) / 10 : 0}%
@@ -133,7 +135,8 @@ export default async function EvaluationPage({ searchParams }: PageProps) {
{total > 0 ? Math.round((minutes / (daysToFetch * 24 * 60)) * 1000) / 10 : 0}% {total > 0 ? Math.round((minutes / (daysToFetch * 24 * 60)) * 1000) / 10 : 0}%
</td> </td>
</tr> </tr>
))} ))
}
</tbody> </tbody>
<tfoot> <tfoot>
<tr style={{ fontWeight: 'bold' }}> <tr style={{ fontWeight: 'bold' }}>