Connect, collaborate, and grow with a community of TypeScript developers
feat(db): Update seed to pull from type-challenges repo(#179)
Jim Burbridgec0fbbfba1a06
diff --git a/.env.example b/.env.exampleindex 520b2649..6b5a78ae 100644--- a/.env.example+++ b/.env.example@@ -1,4 +1,5 @@DATABASE_URL="mysql://dev:dev@localhost/typehero"+STAGE=localGITHUB_ID=GITHUB_SECRET=# Next Authdiff --git a/package.json b/package.jsonindex 527d2eb4..f344aa3f 100644--- a/package.json+++ b/package.json@@ -61,6 +61,7 @@"react-syntax-highlighter": "^15.5.0","recharts": "^2.7.2","remark-gfm": "^3.0.1",+ "simple-git": "^3.19.1","superjson": "1.12.2","tailwind-merge": "^1.12.0","tailwindcss-animate": "^1.0.5",@@ -72,6 +73,7 @@"zustand": "^4.3.8"},"devDependencies": {+ "@faker-js/faker": "^8.0.2","@tailwindcss/container-queries": "^0.1.1","@tailwindcss/typography": "^0.5.9","@types/eslint": "^8.37.0",@@ -94,7 +96,8 @@"prisma": "^5.0.0","raw-loader": "^4.0.2","tailwindcss": "^3.3.0",- "tsx": "^3.12.7"+ "tsx": "^3.12.7",+ "yaml": "^2.3.1"},"ct3aMetadata": {"initVersion": "7.13.1"diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 7681701d..6a524fa9 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -138,6 +138,9 @@ dependencies:remark-gfm:specifier: ^3.0.1version: 3.0.1+ simple-git:+ specifier: ^3.19.1+ version: 3.19.1superjson:specifier: 1.12.2version: 1.12.2@@ -167,6 +170,9 @@ dependencies:version: 4.3.8([email protected])devDependencies:+ '@faker-js/faker':+ specifier: ^8.0.2+ version: 8.0.2'@tailwindcss/container-queries':specifier: ^0.1.1version: 0.1.1([email protected])@@ -236,6 +242,9 @@ devDependencies:tsx:specifier: ^3.12.7version: 3.12.7+ yaml:+ specifier: ^2.3.1+ version: 2.3.1packages:@@ -501,6 +510,11 @@ packages:engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}dev: true+ /@faker-js/[email protected]:+ resolution: {integrity: sha512-Uo3pGspElQW91PCvKSIAXoEgAUlRnH29sX2/p89kg7sP1m2PzCufHINd0FhTXQf6DYGiUlVncdSPa2F9wxed2A==}+ engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0, npm: '>=6.14.13'}+ dev: true+/@floating-ui/[email protected]:resolution: {integrity: sha512-Bu+AMaXNjrpjh41znzHqaz3r2Nr8hHuHZT6V2LBKMhyMl0FgKA62PNYbqnfgmzOhoWZj70Zecisbo4H1rotP5g==}dev: false@@ -585,6 +599,18 @@ packages:'@jridgewell/resolve-uri': 3.1.0'@jridgewell/sourcemap-codec': 1.4.14+ /@kwsites/[email protected]:+ resolution: {integrity: sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==}+ dependencies:+ debug: 4.3.4+ transitivePeerDependencies:+ - supports-color+ dev: false++ /@kwsites/[email protected]:+ resolution: {integrity: sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==}+ dev: false+/@monaco-editor/[email protected]([email protected]):resolution: {integrity: sha512-6KKF4CTzcJiS8BJwtxtfyYt9shBiEv32ateQ9T4UVogwn4HM/uPo9iJd2Dmbkpz8CM6Y0PDUpjnZzCwC+eYo2Q==}peerDependencies:@@ -6176,6 +6202,16 @@ packages:resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==}dev: true+ resolution: {integrity: sha512-Ck+rcjVaE1HotraRAS8u/+xgTvToTuoMkT9/l9lvuP5jftwnYUp6DwuJzsKErHgfyRk8IB8pqGHWEbM3tLgV1w==}+ dependencies:+ '@kwsites/file-exists': 1.1.1+ '@kwsites/promise-deferred': 1.1.1+ debug: 4.3.4+ transitivePeerDependencies:+ - supports-color+ dev: false+resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}engines: {node: '>=8'}diff --git a/prisma/challenges.mock.ts b/prisma/challenges.mock.tsindex 52291d58..b3deeeaf 100644--- a/prisma/challenges.mock.ts+++ b/prisma/challenges.mock.ts@@ -1,81 +1,160 @@-import type { Difficulty, Prisma } from '@prisma/client';-import url from 'url';-import { gId, trashId } from './seed';+import { type Difficulty, type Prisma } from "@prisma/client";+import { gId, trashId } from "./seed";+import url from "url";+import { parse } from "yaml";+import { readdir, readFile, rm } from "fs/promises";+import fs from "fs";+import { faker } from "@faker-js/faker";+import { simpleGit } from "simple-git";+import { resolve } from "path";-import fs from 'fs';+export type InfoFile = {+ title: string;+ author: {+ name: string;+ email: string;+ github: string;+ };+ tags: string;+ difficulty: "easy" | "medium" | "warm" | "hard" | "extreme";+};++/**+ * @description clones the type-challenges repo and extracts our necessary data from them+ * @returns an array of data for the type challenges from the repo+ */+export async function loadChallengesFromTypeChallenge() {+ // Clone Repo+ const git = simpleGit();+ await git.clone(+ "https://github.com/type-challenges/type-challenges.git",+ "tmp/type-challenges",+ );+ const QUESTIONS_PATH = "./tmp/type-challenges/questions";+ const folders = await readdir(QUESTIONS_PATH, { withFileTypes: true }).then(+ (f) => f.filter((a) => a.isDirectory)+ );++ const arr = [];+ for (const dir of folders) {+ const infoFile = resolve(+ "./tmp/type-challenges/questions",+ dir.name,+ "info.yml",+ );+ const contents = await readFile(infoFile).then((r) => r.toString());+ const { title, difficulty } = parse(contents) as InfoFile;++ const README = await readFile(+ resolve(QUESTIONS_PATH, dir.name, "README.md"),+ ).then((r) =>+ r.toString().replace(+ /<!--info-(header|footer)-start-->.*?<!--info-\1-end-->/g,+ "",+ )+ );++ const prompt = await readFile(+ resolve(QUESTIONS_PATH, dir.name, "template.ts"),+ ).then((f) => f.toString());-function randomTrueOrFalse() {- return Math.random() > 0.5;+ const testData = await readFile(+ resolve(QUESTIONS_PATH, dir.name, 'test-cases.ts')+ ).then(f => f.toString().replace(/import .* from '@type-challenges\/utils';?/g, ''));++ const [selfId] = dir.name.split("-");++ const idNum = Number(selfId);+ if (isNaN(idNum)) {+ console.info("Skipping ", dir.name, "due to bad ID parse");+ continue;+ }++ arr.push({+ id: idNum,+ name: title,+ description: README,+ prompt: `// TEST CASE START\n${testData}\n\n// CODE START\n${prompt}`,+ difficulty: difficulty === "warm"+ ? "BEGINNER"+ : difficulty.toUpperCase() as Difficulty,+ shortDescription: README.slice(0, 100),+ });+ }++ // Cleanup+ await rm("./tmp", {+ recursive: true,+ force: true,+ });++ return arr;}/*** Load markdown file synchronously from the __seed__*/-function loadChallenegeSync(challengeSlug: string) {+function loadChallengeSync(challengeSlug: string) {// read from the __seed__ folder all the markdown filesconst filePath = new URL(`../__seed__/${challengeSlug}.md`, import.meta.url);// return the file contents- return fs.readFileSync(url.fileURLToPath(filePath), 'utf8');+ return fs.readFileSync(url.fileURLToPath(filePath), "utf8");}-const shortDescription = `This is a typescript challenge short description area in which we can place text.-- In this challenge you will learn how to do something or at the least you learn how to use \`any\``;-export const CHALLENGE_MAP: Record<Difficulty,(v: number) => Prisma.ChallengeCreateWithoutUserInput> = {- BEGINNER: (challengeIndex: number) => ({- name: `Beginner Challenge ${challengeIndex + 1}`,- createdAt: new Date(),- updatedAt: new Date(),- bookmark: randomTrueOrFalse()+ BEGINNER: () => ({+ name: faker.hacker.phrase(),+ createdAt: faker.date.between({ from: "2022-01-01", to: new Date() }),+ updatedAt: faker.date.between({ from: "2023-05-01", to: new Date() }),+ bookmark: faker.datatype.boolean()? {- create: {- userId: randomTrueOrFalse() ? trashId : gId,- },- }+ create: {+ userId: faker.datatype.boolean() ? trashId : gId,+ },+ }: undefined,- description: loadChallenegeSync('beginner/desc'),- shortDescription,- prompt: loadChallenegeSync('beginner/prompt'),- difficulty: 'BEGINNER',+ description: loadChallengeSync("beginner/desc"),+ shortDescription: faker.lorem.lines({ min: 1, max: 2 }),+ prompt: loadChallengeSync("beginner/prompt"),+ difficulty: "BEGINNER",}),- EASY: (challengeIndex: number) => ({- name: `Easy Challenge ${challengeIndex + 1}`,- createdAt: new Date(),- updatedAt: new Date(),- description: loadChallenegeSync('easy/desc'),- shortDescription,- prompt: loadChallenegeSync('easy/prompt'),- difficulty: 'EASY',+ EASY: () => ({+ name: faker.hacker.phrase(),+ createdAt: faker.date.between({ from: "2022-01-01", to: new Date() }),+ updatedAt: faker.date.between({ from: "2023-05-01", to: new Date() }),+ description: loadChallengeSync("easy/desc"),+ shortDescription: faker.lorem.lines({ min: 1, max: 2 }),+ prompt: loadChallengeSync("easy/prompt"),+ difficulty: "EASY",}),- MEDIUM: (challengeIndex: number) => ({- name: `Medium Challenge ${challengeIndex + 1}`,- createdAt: new Date(),- updatedAt: new Date(),- description: loadChallenegeSync('medium/desc'),- shortDescription,- prompt: loadChallenegeSync('medium/prompt'),- difficulty: 'MEDIUM',+ MEDIUM: () => ({+ name: faker.hacker.phrase(),+ createdAt: faker.date.between({ from: "2022-01-01", to: new Date() }),+ updatedAt: faker.date.between({ from: "2023-05-01", to: new Date() }),+ description: loadChallengeSync("medium/desc"),+ shortDescription: faker.lorem.lines({ min: 1, max: 2 }),+ prompt: loadChallengeSync("medium/prompt"),+ difficulty: "MEDIUM",}),- HARD: (challengeIndex: number) => ({- name: `Hard Challenge ${challengeIndex + 1}`,- createdAt: new Date(),- updatedAt: new Date(),- description: loadChallenegeSync('hard/desc'),- shortDescription,- prompt: loadChallenegeSync('hard/prompt'),- difficulty: 'HARD',+ HARD: () => ({+ name: faker.hacker.phrase(),+ createdAt: faker.date.between({ from: "2022-01-01", to: new Date() }),+ updatedAt: faker.date.between({ from: "2023-05-01", to: new Date() }),+ description: loadChallengeSync("hard/desc"),+ shortDescription: faker.lorem.lines({ min: 1, max: 2 }),+ prompt: loadChallengeSync("hard/prompt"),+ difficulty: "HARD",}),- EXTREME: (challengeIndex: number) => ({- name: `Extreme Challenge ${challengeIndex + 1}`,- createdAt: new Date(),- updatedAt: new Date(),- description: loadChallenegeSync('extreme/desc'),- shortDescription,- prompt: loadChallenegeSync('extreme/prompt'),- difficulty: 'EXTREME',+ EXTREME: () => ({+ name: faker.hacker.phrase(),+ createdAt: faker.date.between({ from: "2022-01-01", to: new Date() }),+ updatedAt: faker.date.between({ from: "2023-05-01", to: new Date() }),+ description: loadChallengeSync("extreme/desc"),+ shortDescription: faker.lorem.lines({ min: 1, max: 2 }),+ prompt: loadChallengeSync("extreme/prompt"),+ difficulty: "EXTREME",}),};diff --git a/prisma/seed.ts b/prisma/seed.tsindex 38fd7ccb..67038f6a 100644--- a/prisma/seed.ts+++ b/prisma/seed.ts@@ -1,61 +1,84 @@-import { type Difficulty, type Prisma, PrismaClient } from '@prisma/client';-import uuidByString from 'uuid-by-string';-import { CHALLENGE_MAP } from './challenges.mock';+import { type Difficulty, PrismaClient } from "@prisma/client";+import uuidByString from "uuid-by-string";+import { loadChallengesFromTypeChallenge } from "./challenges.mock";+import { faker } from "@faker-js/faker";+import UserMock from "./user.mock";+const prisma = new PrismaClient();-const CHALLENGES_TO_CREATE = 20;-const DIFFICULTIES = ['BEGINNER', 'EASY', 'MEDIUM', 'HARD', 'EXTREME'];+if(process.env.STAGE === 'local') {++ const usersToBeMade = Array.from({ length: 15 }, () => UserMock());++ await prisma.user.createMany({+ data: usersToBeMade+ });++ // Load the challenges.+ const data = await loadChallengesFromTypeChallenge();+ const users = await prisma.user.findMany({+ select: {+ id: true+ }+ }).then(r => r.map(u => u.id));++ await prisma.challenge.createMany({+ data: data.map(challenge => ({+ ...challenge,+ userId: faker.helpers.arrayElement(users)+ }))+ });+}+++const DIFFICULTIES = ["BEGINNER", "EASY", "MEDIUM", "HARD", "EXTREME"];const randomDifficulty = (): Difficulty => {- return DIFFICULTIES[Math.floor(Math.random() * DIFFICULTIES.length)] as Difficulty;+ return DIFFICULTIES[+ Math.floor(Math.random() * DIFFICULTIES.length)+ ] as Difficulty;};-// TODO: make this deterministic as the seed should always have the same difficulty-const challenges = (): Prisma.ChallengeCreateNestedManyWithoutUserInput => ({- create: Array.from({ length: CHALLENGES_TO_CREATE }, (_, challengeIndex) =>- CHALLENGE_MAP[randomDifficulty()](challengeIndex),- ),-});--export const trashId = uuidByString('trash');-export const gId = uuidByString('g');+export const trashId = uuidByString("trash");+export const gId = uuidByString("g");// NOTE: we can use top-level await because we are in a moduletry {- await prisma.user.upsert({- where: { id: trashId },- update: {},- create: {- id: trashId,- email: '[email protected]',- name: 'chris',- challenge: challenges(),- },- });- await prisma.user.upsert({- where: { id: gId },- update: {},- create: {- id: gId,- email: '[email protected]',- name: 'g',- challenge: challenges(),- submission: {- create: {- code: 'const a: string = "hello world"',- isSuccessful: true,- challengeId: 1,- },- },- sharedSolution: {- create: {- challengeId: 1,- title: 'This is a solution',- description: 'this is a description',- },- },- },- });+ // await prisma.user.upsert({+ // where: { id: trashId },+ // update: {},+ // create: {+ // id: trashId,+ // email: "[email protected]",+ // name: "chris",+ // challenge: challenges(),+ // },+ // });++ // await prisma.user.upsert({+ // where: { id: gId },+ // update: {},+ // create: {+ // id: gId,+ // email: "[email protected]",+ // name: "g",+ // challenge: challenges(),+ // solution: {+ // create: {+ // code: 'const a: string = "hello world"',+ // isSuccessful: true,+ // challengeId: 1,+ // },+ // },+ // sharedSolution: {+ // create: {+ // challengeId: 1,+ // title: faker.lorem.words(7),+ // description: faker.lorem.words({ min: 5, max: 25 }),+ // },+ // },+ // },+ // });await prisma.$disconnect();} catch (e) {diff --git a/prisma/user.mock.ts b/prisma/user.mock.tsnew file mode 100644index 00000000..ba8692be--- /dev/null+++ b/prisma/user.mock.ts@@ -0,0 +1,21 @@+import { faker } from '@faker-js/faker';+import { type Prisma, UserStatus } from '@prisma/client';++/**+ *+ * @returns Creates a mock user.+ */+export default function UserMock(): Prisma.UserCreateManyInput {+ // Create email+ const email = faker.internet.email();+ // Created At+ const createdAt = faker.date.between({ from: '2022-06-01', to: new Date() });++ return {+ email,+ emailVerified: faker.date.between({ from: createdAt, to: new Date() }),+ name: faker.person.fullName(),+ status: faker.helpers.enumValue(UserStatus),+ createdAt,+ };+}diff --git a/prisma/vote.mock.ts b/prisma/vote.mock.tsnew file mode 100644index 00000000..9e991c6a--- /dev/null+++ b/prisma/vote.mock.ts@@ -0,0 +1,11 @@+import {+ type Prisma+} from '@prisma/client';++import { faker } from '@faker-js/faker';++export function VoteMock(userIds: string[]): Prisma.VoteCreateManyInput {+ return {+ userId: faker.helpers.arrayElement(userIds),+ };+}diff --git a/src/app/admin/report/page.tsx b/src/app/admin/report/page.tsxindex 0931d338..b2ebe540 100644--- a/src/app/admin/report/page.tsx+++ b/src/app/admin/report/page.tsx@@ -1,11 +1,15 @@-import { getChallengeReports } from '~/components/admin/admin.actions';+import { RoleTypes } from '@prisma/client';+import { getServerAuthSession } from '~/server/auth';+import { redirect } from 'next/navigation';-export default async function ReportPage() {- const reports = await getChallengeReports();- return (- <div>- Reports table here. List all- {reports.length}- </div>- );+export default async function ListReportPage() {+ const session = await getServerAuthSession();+ const roles = session?.user?.role ?? [];+ const isMod = roles.includes(RoleTypes.ADMIN) || roles.includes(RoleTypes.MODERATOR);++ if (!isMod) {+ return redirect('/');+ }++ return <div>I am amazing</div>;}diff --git a/src/app/challenge/[id]/solutions/loading.tsx b/src/app/challenge/[id]/solutions/loading.tsxindex 840ee045..a9a722a8 100644--- a/src/app/challenge/[id]/solutions/loading.tsx+++ b/src/app/challenge/[id]/solutions/loading.tsx@@ -1,4 +1,4 @@-import { SolutionsSkeleton } from "~/components/challenge/solutions/solution-skeleton";+import { SolutionsSkeleton } from '~/components/challenge/solutions/solution-skeleton';export default function Loading() {return <SolutionsSkeleton />;}diff --git a/src/app/challenge/[id]/submissions/loading.tsx b/src/app/challenge/[id]/submissions/loading.tsxindex b94083a7..e07889a0 100644--- a/src/app/challenge/[id]/submissions/loading.tsx+++ b/src/app/challenge/[id]/submissions/loading.tsx@@ -1,4 +1,4 @@-import { SolutionsSkeleton } from "~/components/challenge/solutions/solution-skeleton";+import { SolutionsSkeleton } from '~/components/challenge/solutions/solution-skeleton';export default function Loading() {return <SolutionsSkeleton />;diff --git a/src/components/challenge/editor/editor-types.ts b/src/components/challenge/editor/editor-types.tsindex 9b4326fe..11c3ac11 100644--- a/src/components/challenge/editor/editor-types.ts+++ b/src/components/challenge/editor/editor-types.ts@@ -4,10 +4,22 @@* based on: https://github.com/type-challenges/type-challenges/blob/main/utils/index.d.ts*/export const libSource = `+type Expect<T extends true> = T+type ExpectTrue<T extends true> = T+type ExpectFalse<T extends false> = T+type IsTrue<T extends true> = T+type IsFalse<T extends false> = T++type NotEqual<X, Y> = true extends Equal<X, Y> ? false : truetype Equal<X, Y> =(<T>() => T extends X ? 1 : 2) extends(<T>() => T extends Y ? 1 : 2) ? true : false+// https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360+type IsAny<T> = 0 extends (1 & T) ? true : false+type NotAny<T> = true extends IsAny<T> ? false : true++type Debug<T> = { [K in keyof T]: T[K] }type MergeInsertions<T> =T extends object? { [K in keyof T]: MergeInsertions<T[K]> }@@ -15,44 +27,10 @@ type MergeInsertions<T> =type Alike<X, Y> = Equal<MergeInsertions<X>, MergeInsertions<Y>>-type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never--type NoInfer<T> = [T][T extends any ? 0 : never];+type ExpectExtends<VALUE, EXPECTED> = EXPECTED extends VALUE ? true : false+type ExpectValidArgs<FUNC extends (...args: any[]) => any, ARGS extends any[]> = ARGS extends Parameters<FUNC>+ ? true+ : false-type IsUnion<T, U = T> = [T] extends [never]- ? false- : T extends unknown- ? [U] extends [T]- ? false- : true- : false;---/**- * Helper function to test your code.- *- * Checks if two types have all the same properties and modifiers- *- * To check what it is failing, you can hover over \`Equal\` and see what the types failing are- */-declare function Equal<A, B>(...args: Alike<A, B> extends true ? [] : [msg: "not equal"]): void;---/**- * Helper function to test your code.- *- * Checks that two types aren't the same- *- * To check what it is failing, you can hover over \`NotEqual\` and see what the types failing are- */-declare function NotEqual<A, B>(...args: Alike<A, B> extends true ? [msg: "equal"] : []): void;--/**- * Helper function to test your code.- *- * Checks if type \`A\` extends \`B\`- *- * To check what it is failing, you can hover over \`Extends\` and see what the types failing are- */-declare function Extends<A, B>(...args: A extends B ? [] : [msg: [A, "doesn't extend", B]]): void;+type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never`;diff --git a/src/components/challenge/solutions/solution-skeleton.tsx b/src/components/challenge/solutions/solution-skeleton.tsxindex d18a3e79..ed2fcbb6 100644--- a/src/components/challenge/solutions/solution-skeleton.tsx+++ b/src/components/challenge/solutions/solution-skeleton.tsx@@ -1,4 +1,4 @@-import { Skeleton } from "~/components/ui/skeleton";+import { Skeleton } from '~/components/ui/skeleton';export function SolutionsSkeleton() {return (diff --git a/src/components/challenge/submissions/index.tsx b/src/components/challenge/submissions/index.tsxindex e2606c54..3fa58392 100644--- a/src/components/challenge/submissions/index.tsx+++ b/src/components/challenge/submissions/index.tsx@@ -76,7 +76,13 @@ export function Submissions({ submissions }: Props) {}// eslint-disable-next-line @typescript-eslint/no-unused-vars-function SubmissionRow({ challengeId, submission }: { challengeId: number; submission: Submission }) {+function SubmissionRow({+ challengeId,+ submission,+}: {+ challengeId: number;+ submission: Submission;+}) {return (<li className="flex cursor-pointer items-center justify-between px-4 py-2 duration-300 hover:bg-neutral-100 dark:rounded-none dark:hover:bg-zinc-700/50"><Link className="w-full" href={`/challenge/${challengeId}/submissions/${submission.id}`}>diff --git a/src/components/user/dashboard/solutions-tab.tsx b/src/components/user/dashboard/solutions-tab.tsxindex 3c1cbbe3..79eaf787 100644--- a/src/components/user/dashboard/solutions-tab.tsx+++ b/src/components/user/dashboard/solutions-tab.tsx@@ -24,7 +24,9 @@ export function SolutionsTab({ submissions = [] }: { submissions: UserData['subm{submissions.map((submission) => (<TableRow key={submission.id}><TableCell className="font-medium underline">- <Link href={`/challenge/${submission.challenge.id}`}>{submission.challenge.name}</Link>+ <Link href={`/challenge/${submission.challenge.id}`}>+ {submission.challenge.name}+ </Link></TableCell><TableCell>{submission.isSuccessful ? 'Accepted' : 'Rejected'}</TableCell></TableRow>