diff --git a/typing-app/src/components/templates/GameResult.tsx b/typing-app/src/components/templates/GameResult.tsx index 167c829..c58fca5 100644 --- a/typing-app/src/components/templates/GameResult.tsx +++ b/typing-app/src/components/templates/GameResult.tsx @@ -53,28 +53,28 @@ const GameResult: React.FC = ({ nextPage, resultScore }) => { - {resultScore.Keystrokes}回 + {resultScore.keystrokes}回 - {resultScore.Miss}回 + {resultScore.miss}回 - {resultScore.Time.getMinutes()}分{resultScore.Time.getSeconds()}秒 - {Math.floor(resultScore.Time.getMilliseconds() / 100)} + {resultScore.time.getMinutes()}分{resultScore.time.getSeconds()}秒 + {Math.floor(resultScore.time.getMilliseconds() / 100)} - {Math.floor(resultScore.WPM)}字/分 + {Math.floor(resultScore.wpm)}字/分 - {resultScore.Accuracy.toFixed(1)}% + {resultScore.accuracy.toFixed(1)}% diff --git a/typing-app/src/components/templates/GameTyping.tsx b/typing-app/src/components/templates/GameTyping.tsx index 4fc005e..678e2fd 100644 --- a/typing-app/src/components/templates/GameTyping.tsx +++ b/typing-app/src/components/templates/GameTyping.tsx @@ -1,6 +1,5 @@ import RegisterScore, { ResultScore } from "@/types/RegisterScore"; import { Box } from "@chakra-ui/react"; -import axios from "axios"; import Image from "next/image"; import React, { useEffect, useState } from "react"; import ProgressBar from "../atoms/ProgressBar"; @@ -33,11 +32,11 @@ const GameTyping: React.FC = ({ nextPage, filenames, setResultS const totalSeconds = 250; const [count, setCount] = useState(totalSeconds); const damyScoreData = { - Keystrokes: 123, - Accuracy: 456.7, - Score: 890.1, - StartedAt: new Date(), - EndedAt: new Date(), + keystrokes: 123, + accuracy: 456.7, + score: 890.1, + startedAt: new Date(), + endedAt: new Date(), } as RegisterScore; const damyUserId = "damyId"; @@ -67,11 +66,11 @@ const GameTyping: React.FC = ({ nextPage, filenames, setResultS const sendResultDat = () => { const typeTimeSeconds = totalSeconds - count; setResultScore({ - Keystrokes: correctType + incorrectType, - Miss: incorrectType, - Time: new Date(typeTimeSeconds * 1000), - WPM: (correctType / typeTimeSeconds) * 60, - Accuracy: (correctType / (correctType + incorrectType)) * 100, + keystrokes: correctType + incorrectType, + miss: incorrectType, + time: new Date(typeTimeSeconds * 1000), + wpm: (correctType / typeTimeSeconds) * 60, + accuracy: (correctType / (correctType + incorrectType)) * 100, }); fetch(`http://localhost:8080/users/${userId}/scores`,{ method: `POST`, @@ -83,11 +82,11 @@ const GameTyping: React.FC = ({ nextPage, filenames, setResultS .then((res) => res.json()) .then((data) => { console.log(data); + nextPage(); }) .catch((error) => { console.error(error); }); - nextPage(); }; const typingQueueListSize = 5; // ここで瞬間タイピング速度計算の粒度を決める 増やすほど変化が穏やかになる diff --git a/typing-app/src/types/RegisterScore.ts b/typing-app/src/types/RegisterScore.ts index 4c6515f..a3c7c05 100644 --- a/typing-app/src/types/RegisterScore.ts +++ b/typing-app/src/types/RegisterScore.ts @@ -1,17 +1,17 @@ interface RegisterScore { - Keystrokes: number; - Accuracy: number; - Score: number; - StartedAt: Date; - EndedAt: Date; + keystrokes: number; + accuracy: number; + score: number; + startedAt: Date; + endedAt: Date; } export interface ResultScore { - Keystrokes: number; - Miss: number; - Time: Date; - WPM: number; - Accuracy: number; + keystrokes: number; + miss: number; + time: Date; + wpm: number; + accuracy: number; } export default RegisterScore;