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
+17 -14
+17 -14
View File
@@ -120,20 +120,23 @@ export default async function EvaluationPage({ searchParams }: PageProps) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{Object.entries(times).map(([category, minutes]) => ( {Object.entries(times)
<tr key={category} style={{ borderBottom: '1px solid #e5e7eb' }}> .sort(([, minutesA], [, minutesB]) => minutesB - minutesA)
<td style={{ padding: '0.5rem' }}>{category}</td> .map(([category, minutes]) => (
<td style={{ padding: '0.5rem', whiteSpace: 'nowrap' }}> <tr key={category} style={{ borderBottom: '1px solid #e5e7eb' }}>
{Math.floor(minutes / 60)}:{Math.round(minutes % 60)}h (={Math.round(minutes)} min) <td style={{ padding: '0.5rem' }}>{category}</td>
</td> <td style={{ padding: '0.5rem', whiteSpace: 'nowrap' }}>
<td style={{ padding: '0.5rem' }}> {Math.floor(minutes / 60)}:{Math.round(minutes % 60).toString().padStart(2, '0')}h (={Math.round(minutes)} min)
{total > 0 ? Math.round((minutes / total) * 1000) / 10 : 0}% </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 / (daysToFetch * 24 * 60)) * 1000) / 10 : 0}% </td>
</td> <td style={{ padding: '0.5rem' }}>
</tr> {total > 0 ? Math.round((minutes / (daysToFetch * 24 * 60)) * 1000) / 10 : 0}%
))} </td>
</tr>
))
}
</tbody> </tbody>
<tfoot> <tfoot>
<tr style={{ fontWeight: 'bold' }}> <tr style={{ fontWeight: 'bold' }}>