Skip to content

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

feat: add default title for solutions (#1088)

Dunsin620cdc69539f
diff --git a/apps/web/src/app/[locale]/challenge/[slug]/solutions/_components/solution-editor.tsx b/apps/web/src/app/[locale]/challenge/[slug]/solutions/_components/solution-editor.tsx
index 59fb2258..019b9d77 100644
--- a/apps/web/src/app/[locale]/challenge/[slug]/solutions/_components/solution-editor.tsx
+++ b/apps/web/src/app/[locale]/challenge/[slug]/solutions/_components/solution-editor.tsx
@@ -49,7 +49,7 @@ export function SolutionEditor({ dismiss, challenge }: Props) {
const form = useForm<FormSchema>({
resolver: zodResolver(formSchema),
defaultValues: {
- title: '',
+ title: `${session.user.name}'s Solution`,
content: getDefaultMarkdown(challenge.submission[0]?.code ?? ''),
},
});
@@ -61,7 +61,7 @@ export function SolutionEditor({ dismiss, challenge }: Props) {
challengeId: challenge.id,
description: data.content ?? '',
slug: slug as string,
- title: data.title ?? '',
+ title: data.title ?? `${session.user.name}'s Solution`,
userId: session.data?.user.id!,
});