Foro: selector de personaje también al crear tema

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-17 08:17:15 +00:00
parent 0f6e0d514f
commit aaf106ef55
@@ -1,10 +1,11 @@
import { notFound, redirect } from 'next/navigation'
import { getTranslations, setRequestLocale } from 'next-intl/server'
import { getForum, getForumPath } from '@/lib/forum'
import { getForum, getForumPath, getAccountCharactersForForum, getForumCharacterPick } from '@/lib/forum'
import { getSession } from '@/lib/session'
import { PageShell } from '@/components/PageShell'
import { ForumBreadcrumb } from '@/components/ForumBreadcrumb'
import { CreateTopicForm } from '@/components/CreateTopicForm'
import { ForumCharacterPicker } from '@/components/ForumCharacterPicker'
export const dynamic = 'force-dynamic'
@@ -24,6 +25,10 @@ export default async function CreateTopicPage({
const session = await getSession()
if (!session.username) redirect(`/${locale}/forum/${id}`)
const [forumChars, forumPick] = session.accountId
? await Promise.all([getAccountCharactersForForum(session.accountId), getForumCharacterPick(session.accountId)])
: [[], null]
const path = await getForumPath(id, locale)
return (
@@ -44,6 +49,19 @@ export default async function CreateTopicPage({
{forum.description && <h3>{forum.description}</h3>}
</div>
</div>
<ForumCharacterPicker
locale={locale}
initialChars={forumChars}
initialCurrent={forumPick}
labels={{
postingAs: t('postingAs'),
change: t('changeCharacter'),
title: t('changeCharacter'),
filter: t('filter'),
empty: t('noCharacters'),
auto: t('autoCharacter'),
}}
/>
<CreateTopicForm forumId={id} />
</div>
</PageShell>