-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Feel free to discuss 😄
<GameContainer | ||
scene={{ | ||
id: page, | ||
bg: GameScene[page].bg, | ||
choices: GameScene[page].choices, | ||
message: GameScene[page].message, | ||
goto: GameScene[page].goto, | ||
}} | ||
setPage={setPage} | ||
/>; |
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.
Is it unused? If yes this should be removed
src/pages/game/index.tsx
Outdated
import GameScene from './lib/Scene'; | ||
|
||
const GameLogic = () => { | ||
const [page, setPage] = useState<string>('Game01'); |
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.
"Game01" should be changed into Enum or any const vars instead to prevent typos.
import Image from 'next/image'; | ||
import scene4 from '@/public/images/gameBG/scene4.svg'; | ||
import scene7 from '@/public/images/gameBG/scene17.svg'; | ||
export default function GameBackground(bg: any) { |
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.
export default function GameBackground(bg: any) { | |
export default function GameBackground({ bg }: { bg: string }) { |
Try avoiding any type.
src/pages/game/lib/GameContainer.tsx
Outdated
scene: { | ||
bg: string; | ||
id: string; | ||
message: any; | ||
choices: Question[]; | ||
goto: string; | ||
}; |
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.
scene: { | |
bg: string; | |
id: string; | |
message: any; | |
choices: Question[]; | |
goto: string; | |
}; | |
scene: Scene; |
Import type Scene
import scene4 from '@/public/images/gameBG/scene4.svg'; | ||
import scene7 from '@/public/images/gameBG/scene17.svg'; | ||
export default function GameBackground(bg: any) { | ||
switch (bg.bg) { |
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.
switch (bg.bg) { | |
switch (bg) { |
I am not sure about this but bg is already a type string, isn't?
src/pages/game/lib/Scene.tsx
Outdated
export type Scene = Record< | ||
string, | ||
{ bg: string; message: any; choices: Question[]; goto: string } | ||
>; |
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.
Add type scene
export type Scene = Record< | |
string, | |
{ bg: string; message: any; choices: Question[]; goto: string } | |
>; | |
import React from 'react'; | |
export type Scene = { | |
id?: string; | |
bg: string; | |
message: React.JSX.Element; | |
choices: Question[]; | |
goto: string; | |
}; | |
export type Scenes = Record<string, Scene>; |
src/pages/game/lib/Scene.tsx
Outdated
string, | ||
{ bg: string; message: any; choices: Question[]; goto: string } | ||
>; | ||
const GameScene: Scene = { |
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.
const GameScene: Scene = { | |
const GameScene: Scenes = { |
src/pages/game/lib/Scene.tsx
Outdated
@@ -0,0 +1,127 @@ | |||
import type { NextPage } from 'next'; |
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.
Move this file to /dto
instead as not exporting React Component (e.g. <p>hello</p>
) as default will raise errors.
feat: add planets
Change made
Describe what you have done
New Features
Fix
Others