diff --git a/packages/nextjs/app/submissions/_components/SubmissionCard.tsx b/packages/nextjs/app/submissions/_components/SubmissionCard.tsx index efc73f1..44e0f80 100644 --- a/packages/nextjs/app/submissions/_components/SubmissionCard.tsx +++ b/packages/nextjs/app/submissions/_components/SubmissionCard.tsx @@ -1,15 +1,10 @@ import { Address } from "~~/components/scaffold-eth"; -import { SubmissionWithWinnerTag } from "~~/services/database/repositories/submissions"; +import { Submission } from "~~/services/database/repositories/submissions"; -export const SubmissionCard = ({ submission }: { submission: SubmissionWithWinnerTag }) => { +export const SubmissionCard = ({ submission }: { submission: Submission }) => { return (
- {submission.winnerTag && ( -
- {submission.winnerTag} -
- )}

{submission.title}

diff --git a/packages/nextjs/app/submissions/page.tsx b/packages/nextjs/app/submissions/page.tsx index cbf2f84..4b8547d 100644 --- a/packages/nextjs/app/submissions/page.tsx +++ b/packages/nextjs/app/submissions/page.tsx @@ -1,7 +1,6 @@ import { SubmissionCard } from "./_components/SubmissionCard"; import type { NextPage } from "next"; -import scaffoldConfig from "~~/scaffold.config"; -import { SubmissionWithWinnerTag, getAllSubmissions } from "~~/services/database/repositories/submissions"; +import { getAllSubmissions } from "~~/services/database/repositories/submissions"; import { getMetadata } from "~~/utils/scaffold-eth/getMetadata"; export const metadata = getMetadata({ @@ -11,30 +10,16 @@ export const metadata = getMetadata({ const Submissions: NextPage = async () => { const submissions = await getAllSubmissions(); - const { winnersThreshold, runnersUpThreshold } = scaffoldConfig; - - const submissionsWithAvgScore: SubmissionWithWinnerTag[] = submissions - .map(submission => { - const avgScore = - submission.votes.length > 0 - ? submission.votes.map(vote => vote.score).reduce((a, b) => a + b, 0) / submission.votes.length - : 0; - - const winnerTag = avgScore >= winnersThreshold ? "Winner" : avgScore >= runnersUpThreshold ? "Runner Up" : null; - - return { ...submission, avgScore, winnerTag }; - }) - .sort((a, b) => b.avgScore - a.avgScore); return (
-
+
{submissions.length === 0 && (
No submissions yet.
)} - {submissionsWithAvgScore.map((submission: SubmissionWithWinnerTag) => { + {submissions.map(submission => { return ; })}
diff --git a/packages/nextjs/scaffold.config.ts b/packages/nextjs/scaffold.config.ts index ec8f25b..ffe76bf 100644 --- a/packages/nextjs/scaffold.config.ts +++ b/packages/nextjs/scaffold.config.ts @@ -7,8 +7,6 @@ export type ScaffoldConfig = { walletConnectProjectId: string; onlyLocalBurnerWallet: boolean; votingEnabled: boolean; - winnersThreshold: number; - runnersUpThreshold: number; }; const scaffoldConfig = { @@ -36,10 +34,6 @@ const scaffoldConfig = { // Enable voting on submissions votingEnabled: false, - - // Score threshold for winners and runners up - winnersThreshold: 7, - runnersUpThreshold: 6, } as const satisfies ScaffoldConfig; export default scaffoldConfig; diff --git a/packages/nextjs/services/database/repositories/submissions.ts b/packages/nextjs/services/database/repositories/submissions.ts index 117fa26..145fd27 100644 --- a/packages/nextjs/services/database/repositories/submissions.ts +++ b/packages/nextjs/services/database/repositories/submissions.ts @@ -9,9 +9,6 @@ export type Submission = InferSelectModel & { comments: Comm export type SubmissionWithAvg = Submission & { avgScore: number; }; -export type SubmissionWithWinnerTag = Submission & { - winnerTag: string | null; -}; export async function getAllSubmissions() { return await db.query.submissions.findMany({