このコミットが含まれているのは:
2026-10-18 00:20:30 +09:00
コミット 9be0c7b1d9
45個のファイルの変更、355行の追加、199行の削除
+11 -8
ファイルの表示
@@ -6,6 +6,7 @@ import MdEditor from 'react-markdown-editor-lite'
import { useParams } from 'react-router-dom'
import { useLocale, useLocaleNavigate } from '@/lib/useLocale'
import { useUITranslation } from '@/lib/useUITranslation'
import FieldError from '@/components/common/FieldError'
import FormField from '@/components/common/FormField'
import MainArea from '@/components/layout/MainArea'
@@ -37,6 +38,7 @@ type WikiFormField = 'title' | 'body'
const WikiEditPage: FC<Props> = ({ user }) => {
const { message, label } = useUITranslation ('wiki')
const locale = useLocale ()
const editable = canEditContent (user)
@@ -66,13 +68,14 @@ const WikiEditPage: FC<Props> = ({ user }) => {
qc.setQueryData (wikiKeys.show (title, { }, locale),
(prev: WikiPage) => ({ ...prev, title, body }))
qc.invalidateQueries ({ queryKey: wikiKeys.root })
toast ({ title: '投稿成功!' })
toast ({ title: label ('shared:messages.postSuccess') })
navigate (`/wiki/${ title }`)
}
catch (e)
{
applyValidationError (e)
toast ({ title: '投稿失敗', description: '入力を確認してください。' })
toast ({ title: label ('shared:messages.postFailed'),
description: label ('shared:messages.checkInputModern') })
}
}
@@ -95,18 +98,18 @@ const WikiEditPage: FC<Props> = ({ user }) => {
return (
<MainArea>
<Helmet>
<title>{`Wiki ページを編輯 | ${ SITE_TITLE }`}</title>
<title>{`${ message ('editPage').text } | ${ SITE_TITLE }`}</title>
</Helmet>
<div className="max-w-xl mx-auto p-4 space-y-4">
<h1 className="text-2xl font-bold mb-2">Wiki ページを編輯</h1>
<h1 className="text-2xl font-bold mb-2">{label ('editPage')}</h1>
{loading ? 'Loading...' : (
{loading ? label ('common:loading') : (
<>
<FieldError messages={baseErrors}/>
{/* タイトル */}
{/* TODO: タグ補完 */}
<FormField label="タイトル" messages={fieldErrors.title}>
<FormField label={label ('shared:labels.title')} messages={fieldErrors.title}>
{({ describedBy, invalid }) => (
<input type="text"
value={title}
@@ -117,7 +120,7 @@ const WikiEditPage: FC<Props> = ({ user }) => {
</FormField>
{/* 本文 */}
<FormField label="本文" messages={fieldErrors.body}>
<FormField label={label ('shared:labels.body')} messages={fieldErrors.body}>
{() => (
<MdEditor value={body}
style={{ height: '500px' }}
@@ -129,7 +132,7 @@ const WikiEditPage: FC<Props> = ({ user }) => {
{/* 送信 */}
<button onClick={handleSubmit}
className="px-4 py-2 bg-blue-600 text-white rounded disabled:bg-gray-400">
編輯
{label ('shared:actions.edit')}
</button>
</>)}
</div>