From 7037d125df8eb4187deacf4d00b45adbe7e30079 Mon Sep 17 00:00:00 2001 From: hakase61912 Date: Mon, 28 Oct 2024 17:37:03 +0900 Subject: [PATCH 1/2] =?UTF-8?q?change:=20=E3=83=AA=E3=83=BC=E3=82=B0?= =?UTF-8?q?=E7=B7=A8=E9=9B=86=E7=94=BB=E9=9D=A2=E3=81=AB=E3=83=88=E3=83=BC?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97=E3=81=BE?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/league/legacy/GameForm.tsx | 87 +++++++++++++++++---------- 1 file changed, 54 insertions(+), 33 deletions(-) diff --git a/components/league/legacy/GameForm.tsx b/components/league/legacy/GameForm.tsx index 3793f3b..695f30d 100644 --- a/components/league/legacy/GameForm.tsx +++ b/components/league/legacy/GameForm.tsx @@ -1,7 +1,7 @@ 'use client' import {Game, gameFactory} from "@/src/models/GameModel"; -import {FormEvent, useRef, useState} from "react"; -import {Button, Stack, TextFieldProps} from "@mui/material"; +import React, {FormEvent, useRef, useState} from "react"; +import {Alert, Button, Snackbar, Stack, TextFieldProps} from "@mui/material"; import {Tag} from "@/src/models/TagModel"; import {useRouter} from "next/navigation"; import GameEditFields from "@/components/league/legacy/GameEditFields"; @@ -22,6 +22,7 @@ export default function GameForm(props: GameFormProps) { const descriptionRef = useRef(null) const wightRef = useRef(null) // state + const [snackOpen, setSnackOpen] = React.useState(false) const [typeState, setTypeState] = useState(props.game?.type ?? '') const [calculationTypeState, setCalculationTypeState] = useState(props.game?.calculationType ?? '') const [tag, setTag] = useState(props.game?.tagId?.toString() ?? '') @@ -54,7 +55,6 @@ export default function GameForm(props: GameFormProps) { } - if (props.formType === "create") { const result = await gameFactory().create({ name: nameRef.current?.value as string, @@ -87,40 +87,61 @@ export default function GameForm(props: GameFormProps) { // refresh list router.refresh() + setSnackOpen(true) } + const handleSnackClose = () => { + setSnackOpen(false) + } return ( - - - - - - + + + + + + + + 変更が保存されました + + + ) } From 32626531052b4a28e9f3e41464033c81647afeff Mon Sep 17 00:00:00 2001 From: hakase61912 Date: Mon, 28 Oct 2024 17:45:41 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E8=A9=A6=E5=90=88=E7=B5=90=E6=9E=9C?= =?UTF-8?q?=E7=99=BB=E9=8C=B2=E7=94=BB=E9=9D=A2=E3=81=AE=E3=83=88=E3=83=BC?= =?UTF-8?q?=E3=82=B9=E3=83=88URL=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/match/matchEditor.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/match/matchEditor.tsx b/components/match/matchEditor.tsx index 2f73976..45e7c0c 100644 --- a/components/match/matchEditor.tsx +++ b/components/match/matchEditor.tsx @@ -510,7 +510,7 @@ export default function MatchEditor(props: MatchEditorProps) { variant={"contained"} color={"info"} component={NextLink} - href={`/sports/${props.sport.id}/${props.game.id}`} + href={`/sports/${props.sport.id}/games/${props.game.id}`} sx={{border: "1px solid #5f6dc2", py: 2}} > リーグに戻る @@ -542,7 +542,7 @@ export default function MatchEditor(props: MatchEditorProps) { variant={"contained"} color={"info"} component={NextLink} - href={`/sports/${props.sport.id}/${props.game.id}`} + href={`/sports/${props.sport.id}/games/${props.game.id}`} sx={{border: "1px solid #5f6dc2", py: 2}} > リーグに戻る