Skip to content

Commit

Permalink
Add not voted and no submissions messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Pabl0cks committed Sep 17, 2024
1 parent 329302c commit 2a63d4b
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions packages/nextjs/app/admin/_components/SubmissionTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,15 @@ export const SubmissionTabs = ({ submissions }: { submissions: Submission[] }) =
/>
<div role="tabpanel" className="tab-content py-6">
<div className="grid gap-6 md:grid-cols-2 xl:grid-cols-3">
{voted.map(submission => (
<SubmissionCard key={submission.id} submission={submission} tabName="voted" />
))}
{voted.length === 0 ? (
<div role="alert" className="alert col-span-2">
<span>You have not voted on any submissions yet.</span>
</div>
) : (
voted
.sort((a, b) => b.avgScore - a.avgScore)
.map(submission => <SubmissionCard key={submission.id} submission={submission} tabName="voted" />)
)}
</div>
</div>

Expand All @@ -105,11 +111,15 @@ export const SubmissionTabs = ({ submissions }: { submissions: Submission[] }) =
/>
<div role="tabpanel" className="tab-content py-6">
<div className="grid gap-6 md:grid-cols-2 xl:grid-cols-3">
{all
.sort((a, b) => b.avgScore - a.avgScore)
.map(submission => (
<SubmissionCard key={submission.id} submission={submission} tabName="all" />
))}
{all.length === 0 ? (
<div role="alert" className="alert col-span-2">
<span>There are no submissions yet.</span>
</div>
) : (
all
.sort((a, b) => b.avgScore - a.avgScore)
.map(submission => <SubmissionCard key={submission.id} submission={submission} tabName="all" />)
)}
</div>
</div>
</>
Expand Down

0 comments on commit 2a63d4b

Please sign in to comment.