Openstatus www.openstatus.dev

fix: sorted array (#682)

authored by

Maximilian Kaske and committed by
GitHub
4e48a1e1 f91e56c5

+3 -8
+3 -8
apps/web/src/components/status-update/events.tsx
··· 1 1 "use client"; 2 2 3 3 import * as React from "react"; 4 - import Link from "next/link"; 5 - import { useRouter } from "next/navigation"; 6 4 import { format } from "date-fns"; 7 5 8 6 import type { StatusReportUpdate } from "@openstatus/db/src/schema"; ··· 25 23 collabsible?: boolean; 26 24 }) { 27 25 const [open, toggle] = React.useReducer((open) => !open, false); 28 - const router = useRouter(); 29 26 30 - // TODO: make it simpler.. 31 27 const sortedArray = statusReportUpdates.sort((a, b) => { 32 - const orderA = statusDict[a.status].order; 33 - const orderB = statusDict[b.status].order; 34 - return orderB - orderA; 28 + return b.date.getTime() - a.date.getTime(); 35 29 }); 30 + 36 31 const slicedArray = 37 32 open || !collabsible 38 33 ? sortedArray ··· 104 99 message: string; 105 100 className?: string; 106 101 }) { 107 - const Component = useProcessor(message); 102 + const Component = useProcessor(message); // FIXME: make it work with markdown without hook! 108 103 return ( 109 104 <div 110 105 className={cn(