-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: QuizVisualization 컴포넌트 grid 생성 및 캐릭터 움직임 조작, QuizEditor 컴포넌트 #14
Conversation
… return없는 함수 배열에 리스트저장, useQuiz useAnswer상태관리저장.
p1) |
src/components/QuizEditor.tsx
Outdated
let executedList: string[] = [] | ||
currentQuiz.commands.forEach((cmd) => { | ||
(window as any)[cmd.name] = () => { | ||
executedList.push(cmd.name); | ||
return cmd.function(); | ||
}; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분을 읽어선 뭘 하고자 하는지 잘 모르겠는데 순수했던 executeCode랑 꼭 엮였어야 하나요?
src/store/useQuiz.ts
Outdated
userAnswer: string[] | string; | ||
setUserAnswer: (answer: string[] | string) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기는 왜 string
일 수도 있고 string[]
일 수도 있나요? 타입이 나뉘면 힘들어질 텐데요.
src/components/QuizVisualization.tsx
Outdated
|
||
useEffect(() => { | ||
if (!userAnswer || !Array.isArray(userAnswer) || userAnswer.length === 0) return; | ||
let newPos = { ...startPosition }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기처럼 let
으로 변수를 선언하고 특정 조건일 때 변수는 바꾸는 코드가 여기저기 있는데 무슨 뜻인지 잘 모르겠어요. let
을 사용할 일이 보통 잘 없는데 꼭 이런 흐름을 따라야 하나요?
src/components/QuizVisualization.tsx
Outdated
let newPos = { ...startPosition }; | ||
userAnswer.map((command, index) => { | ||
setTimeout(() => { | ||
if (command === "forward") { | ||
if (command === 'forward') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forward, shoot 상수로 관리하시면 좋을 것 같아요.
@@ -19,8 +19,10 @@ export const Header = () => { | |||
const parsedQuizId = parseInt(quizId || '', 10); | |||
if (isNaN(parsedQuizId) || parsedQuizId < FIRST_QUIZ_ID) { | |||
navigate(`/quizzes/${FIRST_QUIZ_ID}`, { replace: true }); | |||
fetchQuizData(FIRST_QUIZ_ID.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이럴수가.. 데이터의 아이디를 uuid 같은 걸로 바꿔서 아이디 타입 자체를 스트링으로 관리하라는 말이었어요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 .. 넵 확인했습니다 수정하겠습니다!
|
feature: QuizVisualization 컴포넌트 문제생성(grid), 캐릭터 움직임 조작, QuizEditor컴포넌트 return없는 함수 배열에 리스트저장, useQuiz useAnswer상태관리저장.