From 18a657ec0122d625a2cf31568166217414e4445b Mon Sep 17 00:00:00 2001 From: cp-20 Date: Sat, 15 Feb 2025 15:40:08 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A3=E3=83=BC=E3=83=89=E3=83=90?= =?UTF-8?q?=E3=83=83=E3=82=AF=E5=86=85=E3=81=A7=E6=97=A2=E3=81=AB=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B=E3=82=B2=E3=83=BC?= =?UTF-8?q?=E3=83=A0=E3=82=B7=E3=82=B9=E3=83=86=E3=83=A0=E3=81=AB=E5=AF=BE?= =?UTF-8?q?=E3=81=97=E3=81=A6=E8=AD=A6=E5=91=8A=E3=82=92=E5=87=BA=E3=81=99?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_components/GameSystemRequest.tsx | 16 ++++++++++++++-- src/locales/en.ts | 1 + src/locales/ja.ts | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/app/[locale]/(app)/analyze-logs/_components/GameSystemRequest.tsx b/src/app/[locale]/(app)/analyze-logs/_components/GameSystemRequest.tsx index 60e6df0..e667fdf 100644 --- a/src/app/[locale]/(app)/analyze-logs/_components/GameSystemRequest.tsx +++ b/src/app/[locale]/(app)/analyze-logs/_components/GameSystemRequest.tsx @@ -13,7 +13,6 @@ import { Input } from '@/shared/components/ui/input'; import { Label } from '@/shared/components/ui/label'; import { useToast } from '@/shared/components/ui/use-toast'; import { sendGameSystemRequest } from '@/shared/lib/webhook'; -import { DialogDescription } from '@radix-ui/react-dialog'; import { IconMessageReply } from '@tabler/icons-react'; import { t } from 'i18next'; import { useState, type FC } from 'react'; @@ -23,6 +22,15 @@ export const GameSystemRequest: FC = () => { const [open, setOpen] = useState(false); const [system, setSystem] = useState(''); const [logFile, setLogFile] = useState(null); + const [errorMessage, setErrorMessage] = useState(null); + + const validate = (value: string) => { + if (/(CoC|クトゥルフ|エモクロア|シノビガミ)/.test(value)) { + setErrorMessage(t('analyze-logs:game-system-request:already-implemented')); + } else { + setErrorMessage(null); + } + }; const submitHandler = async (e: React.FormEvent) => { e.preventDefault(); @@ -63,9 +71,13 @@ export const GameSystemRequest: FC = () => { setSystem(e.currentTarget.value)} + onChange={(e) => { + setSystem(e.currentTarget.value); + validate(e.currentTarget.value); + }} required /> + {errorMessage &&
{errorMessage}
}
diff --git a/src/locales/en.ts b/src/locales/en.ts index 5e1246c..a7f859f 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -107,6 +107,7 @@ export const en = { submitted: 'Request submitted!', 'submitted-description': 'Thank you for your request!', error: 'Failed to submit request', + 'already-implemented': 'This game system has already been implemented.', }, upload: { button: 'Click to upload or drag and drop to upload', diff --git a/src/locales/ja.ts b/src/locales/ja.ts index a21f155..58ca7a4 100644 --- a/src/locales/ja.ts +++ b/src/locales/ja.ts @@ -108,6 +108,7 @@ export const ja = { submitted: 'リクエストを送信しました!', 'submitted-description': 'リクエストありがとうございます!', error: 'リクエストの送信に失敗しました', + 'already-implemented': 'このゲームシステムは今すぐ使えます', }, upload: { button: 'クリックしてアップロード、あるいはドラッグアンドドロップしてアップロード',