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 ( - - - - - - + + + + + + + + 変更が保存されました + + + ) } 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}} > リーグに戻る