Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

chore: add default description

Chris Bautistabd42b09965ed
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 3670cea3..305f8a5b 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -127,8 +127,11 @@ model Challenge {
updatedAt DateTime @updatedAt
difficulty Difficulty
name String
+ /// this is the description to describe the challenge on description panel
description String @db.MediumText
+ /// this is a short blue thats shown on the explore card
shortDescription String
+ /// this is the test cases + default starter code
prompt String @db.MediumText
visibility Visibility @default(VISIBLE)
diff --git a/src/app/create/page.tsx b/src/app/create/page.tsx
index 6b41e1f4..f868e731 100644
--- a/src/app/create/page.tsx
+++ b/src/app/create/page.tsx
@@ -19,6 +19,28 @@ import { useTheme } from 'next-themes';
import { RichMarkdownEditor } from '~/components/ui/rich-markdown-editor';
+const DEFAULT_DESCRIPTION = `### Description
+Implement the built-in \`Pick<T, K>\` generic without using it.
+
+ Constructs a type by picking the set of properties \`K\` from \`T\`
+
+ For example:
+
+\`\`\`ts
+ interface Todo {
+ title: string
+ description: string
+ completed: boolean
+ }
+
+ type TodoPreview = MyPick<Todo, 'title' | 'completed'>
+
+ const todo: TodoPreview = {
+ title: 'Clean room',
+ completed: false,
+ }
+\`\`\`
+`;
const DEFAULT_CHALLENGE_TEMPLATE = `// TEST CASE START (code in test cases are not editable)
Equal<Expected1, MyPick<Todo, 'title'>>()
@@ -50,7 +72,9 @@ export default function CreateChallenge() {
const [isPreviewing, setIsPreviewing] = useState({
description: false,
});
- const [description, setDescription] = useState(createChallengeStore.data?.description ?? '');
+ const [description, setDescription] = useState(
+ createChallengeStore.data?.description ?? DEFAULT_DESCRIPTION,
+ );
const [difficulty, setDifficulty] = useState<Difficulty | 'BEGINNER'>(
createChallengeStore.data?.difficulty || 'BEGINNER',
);
@@ -116,25 +140,25 @@ export default function CreateChallenge() {
<ChallengeLayout
left={
<Tabs
- defaultValue="short-description"
+ defaultValue="card-editor"
className="flex h-full w-full flex-col border-zinc-300 dark:border-zinc-700"
>
<TabsList className="sticky top-0 z-10 grid h-auto w-full grid-cols-2 rounded-none border-b border-zinc-300 bg-background/90 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/90">
<TabsTrigger
- value="short-description"
+ value="card-editor"
className="rounded-md rounded-tl-xl duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
>
- Short Description
+ Card Editor
</TabsTrigger>
<TabsTrigger
- value="long-description"
+ value="challenge-description"
className="rounded-md rounded-tr-lg duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
>
- Long Description
+ Challenge Description
</TabsTrigger>
</TabsList>
<TabsContent
- value="short-description"
+ value="card-editor"
className="mt-0 flex flex-1 flex-col p-4 dark:bg-muted [&[hidden]]:hidden"
>
<ExploreCardInputs
@@ -147,7 +171,7 @@ export default function CreateChallenge() {
/>
</TabsContent>
<TabsContent
- value="long-description"
+ value="challenge-description"
className="relative mt-0 flex flex-1 flex-col dark:bg-muted [&[hidden]]:hidden"
>
<div className="absolute bottom-4 right-4 z-10 flex items-center justify-end">