Added createdAt to logs

This commit is contained in:
glazk0 2024-04-04 17:10:43 +02:00
parent 81ee6ebd01
commit fadf1f4176
No known key found for this signature in database
GPG key ID: E45BF177782B9FEB

View file

@ -18,6 +18,7 @@
logged: boolean;
type: string;
pseudo?: string;
createdAt: Date;
};
const stateStore = createStateStore<Log>();
@ -31,7 +32,10 @@
(acc, log) => {
const key = log.pseudo || 'Unknown';
if (!acc[key]) acc[key] = [];
acc[key].unshift(log);
acc[key].unshift({
...log,
createdAt: new Date()
});
return acc;
},
{} as Record<string, Log[]>
@ -104,6 +108,11 @@
Pseudo: <span class="font-normal text-foreground">{log.pseudo}</span>
</p>
{/if}
<p class="text-sm font-medium text-muted-foreground">
Date:
<span class="font-normal text-foreground">
{log.createdAt.toLocaleString()}
</span>
</div>
</div>
{/each}