1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-18 01:50:50 +00:00

fix: use event date for sorting recent events

This commit is contained in:
Ash Keel 2023-01-27 00:28:43 +01:00
parent 4f0cc8e570
commit eaa3619a45
No known key found for this signature in database
GPG key ID: BAD8D93E7314ED3E

View file

@ -335,7 +335,6 @@ function TwitchEvent({ data }: { data: EventSubNotification }) {
function TwitchEventLog({ events }: { events: EventSubNotification[] }) {
const { t } = useTranslation();
console.log(events);
return (
<>
<SectionHeader>
@ -351,7 +350,9 @@ function TwitchEventLog({ events }: { events: EventSubNotification[] }) {
<EventListContainer>
{events
.filter((ev) => supportedMessages.includes(ev.subscription.type))
.reverse()
.sort((a, b) =>
a.date && b.date ? Date.parse(b.date) - Date.parse(a.date) : 0,
)
.map((ev) => (
<TwitchEvent key={`${ev.subscription.id}-${ev.date}`} data={ev} />
))}