-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 스크립트 연습 라우터 연결 * 영어 입력 활성화 * 영어 오타 분석 추출 기능 구현 * 스크립트 연습 결과창 연동 구현 * 스크립트 연습 진행 정보창 업데이트 * 스크립트 연습 결과 최종 정보 출력 구현 * 스크립트 연습 구현 완료 * 전체적인 ui 개선
- Loading branch information
Showing
23 changed files
with
470 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react"; | ||
import "../sass/main.css"; | ||
import { useLocation } from "react-router-dom"; | ||
|
||
function PracticeResult() { | ||
const location = useLocation(); | ||
return ( | ||
<div className="ScriptList"> | ||
최종 타수 : {location.state.typeSpeed} | ||
<ul className="ScriptListItem"> | ||
{location.state.scriptList.map((item, idx) => { | ||
return <li key={idx}>{item.name}</li>; | ||
})} | ||
</ul> | ||
</div> | ||
); | ||
} | ||
|
||
export default PracticeResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, {useState, useEffect} from 'react'; | ||
import useInterval from '@use-it/interval' | ||
import '../../../sass/main.css' | ||
import Title from '../../../components/Title'; | ||
import PracticeBox from '../../../components/PracticeBox'; | ||
import { useSelector, useDispatch } from 'react-redux'; | ||
import { initState, selectProgressPercent, selectTypeCount, updateTypeSpeed, selectTitle} from "./scriptSlice"; | ||
|
||
function PracticeScript() { | ||
const dispatch = useDispatch(); | ||
const progressPecent = useSelector(selectProgressPercent); | ||
const typeCount = useSelector(selectTypeCount); | ||
const [tick, setTick] = useState(0); // 시작 후 흐른 시간 | ||
const [typeSpeed, setTypeSpeed] = useState(0); | ||
const [maxTypeSpeed, setMaxTypeSpeed] = useState(0); | ||
const [praticeInformation, setPractiveInformation] = useState([]); | ||
const title = useSelector(selectTitle); | ||
|
||
useEffect(() => { | ||
dispatch(initState()); | ||
}, []); | ||
|
||
useEffect(() => { | ||
setPractiveInformation([ | ||
{ title: "진행도", figure: progressPecent, id: "noBorder" }, | ||
{ title: "현재 타수", figure: typeSpeed }, | ||
{ title: "최대 타수", figure: maxTypeSpeed }, | ||
{ title: "스크립트명", figure: title }, | ||
]); | ||
}, [tick]); | ||
|
||
useInterval(() => { | ||
setTypeSpeed(parseInt(typeCount / tick * 60) | 0); | ||
setMaxTypeSpeed(Math.max(typeSpeed, maxTypeSpeed)); | ||
setTick(tick + 0.1); | ||
dispatch(updateTypeSpeed(typeSpeed)); | ||
}, 100); | ||
|
||
return ( | ||
<div className="content"> | ||
<Title title="스크립트 연습" /> | ||
<PracticeBox type = "script" information = {praticeInformation}/> | ||
</div> | ||
); | ||
} | ||
|
||
export default PracticeScript; |
Oops, something went wrong.