Connect, collaborate, and grow with a community of TypeScript developers
adds temp default template
bautistaaacc2a4eb03a74
diff --git a/prisma/challenges.mock.ts b/prisma/challenges.mock.tsindex 8eb15191..52291d58 100644--- a/prisma/challenges.mock.ts+++ b/prisma/challenges.mock.ts@@ -1,9 +1,8 @@import type { Difficulty, Prisma } from '@prisma/client';-import { gId, trashId } from './seed';import url from 'url';+import { gId, trashId } from './seed';import fs from 'fs';-import path from 'path';function randomTrueOrFalse() {return Math.random() > 0.5;diff --git a/src/app/create/page.tsx b/src/app/create/page.tsxindex ca94d52f..8c755472 100644--- a/src/app/create/page.tsx+++ b/src/app/create/page.tsx@@ -19,6 +19,32 @@ import { useTheme } from 'next-themes';import { RichMarkdownEditor } from '~/components/ui/rich-markdown-editor';+const DEFAULT_CHALLENGE_TEMPLATE = `// TEST CASE START (code in test cases are not editable)+Extends<Expected1, MyPick<Todo, 'title'>>()++Extends<Expected2, MyPick<Todo, 'title' | 'completed'>>()++// @ts-expect-error+MyPick<Todo, 'title' | 'completed' | 'invalid'>++interface Todo {+ title: string+ description: string+ completed: boolean+}++interface Expected1 {+ title: string+}++interface Expected2 {+ title: string+ completed: boolean+}++// CODE START (code below this line is editable)+type MyPick<T, K> = any`;+export default function CreateChallenge() {const createChallengeStore = useCreateChallengeStore();const [isPreviewing, setIsPreviewing] = useState({@@ -155,7 +181,7 @@ export default function CreateChallenge() {mode="create"onSubmit={onSubmit}submitText="Preview"- prompt={createChallengeStore.data?.prompt}+ prompt={createChallengeStore.data?.prompt ?? DEFAULT_CHALLENGE_TEMPLATE}/>}/>