Skip to content

Commit

Permalink
fix(frontend): sort announcements by time (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
YanWQ-monad authored Aug 14, 2023
1 parent 2e270f7 commit 57c1923
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/GZCTF/ClientApp/src/components/GameNoticePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,9 @@ const GameNoticePanel: FC = () => {
const filteredNotices = ApplyFilter(allNotices, filter)

filteredNotices.sort((a, b) =>
a.type === NoticeType.Normal && b.type === NoticeType.Normal
? 0
: a.type === NoticeType.Normal
? -1
: 1
a.type !== b.type && (a.type === NoticeType.Normal || b.type == NoticeType.Normal)
? (a.type === NoticeType.Normal ? -1 : 1)
: (dayjs(a.time).isAfter(b.time) ? -1 : 1)
)

return (
Expand Down

0 comments on commit 57c1923

Please sign in to comment.