From 2a63d4bada2a695a60b3a534c4f2f7dd44a25e68 Mon Sep 17 00:00:00 2001 From: pabl0cks Date: Tue, 17 Sep 2024 10:04:27 +0200 Subject: [PATCH] Add not voted and no submissions messages --- .../app/admin/_components/SubmissionTabs.tsx | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/nextjs/app/admin/_components/SubmissionTabs.tsx b/packages/nextjs/app/admin/_components/SubmissionTabs.tsx index c0bcade..8297d21 100644 --- a/packages/nextjs/app/admin/_components/SubmissionTabs.tsx +++ b/packages/nextjs/app/admin/_components/SubmissionTabs.tsx @@ -87,9 +87,15 @@ export const SubmissionTabs = ({ submissions }: { submissions: Submission[] }) = />
- {voted.map(submission => ( - - ))} + {voted.length === 0 ? ( +
+ You have not voted on any submissions yet. +
+ ) : ( + voted + .sort((a, b) => b.avgScore - a.avgScore) + .map(submission => ) + )}
@@ -105,11 +111,15 @@ export const SubmissionTabs = ({ submissions }: { submissions: Submission[] }) = />
- {all - .sort((a, b) => b.avgScore - a.avgScore) - .map(submission => ( - - ))} + {all.length === 0 ? ( +
+ There are no submissions yet. +
+ ) : ( + all + .sort((a, b) => b.avgScore - a.avgScore) + .map(submission => ) + )}