Skip to content

Commit

Permalink
Merge pull request #97 from 5wonju/feat/#75-game-board-interval
Browse files Browse the repository at this point in the history
Feat/#75 game board interval
  • Loading branch information
3o14 authored May 14, 2024
2 parents ddf2e5c + bd7c558 commit cfa85f3
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,79 @@
import { PiPersonArmsSpreadFill } from 'react-icons/pi'
import RoomInfo from './RoomInfo'
import { useEffect, useState } from 'react'

const TeamSelectContent = () => {
return (
<fieldset className="flex flex-col gap-4 pt-2 items-center justify-around text-black transition-colors">
{/* TODO: ๋ฌธ๊ตฌ ์˜๋…ผํ•ด์„œ ์ •ํ•˜๊ธฐ */}
<h2 className="text-3xl font-medium">ํŒ€์„ ์„ ํƒํ•˜์„ธ์š”</h2>
<div className="text-md flex flex-col items-center gap-1">
<p className="*:font-bold">
<span className="text-red-500">RED</span> ํ˜น์€
<span className="text-blue-500"> BLUE</span> ํ•„๋“œ๋กœ ์ด๋™ํ•ด ํŒ€์„ ์„ ํƒํ•˜์„ธ์š”
</p>
<p className="text-md text-center">
์šฐ์ธก ํ•˜๋‹จ์˜
<button className="bg-indigo-600 text-white font-semibold bg-gradient-to-bl from-indigo-400 to-indigo-600 border-4 border-lightGray4 rounded-full py-1.5 px-1.5 shadow-md mx-1">
<PiPersonArmsSpreadFill className="size-4 m-auto text-center" />
</button>
๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์บ๋ฆญํ„ฐ๋ฅผ ๋ณ€๊ฒฝํ•ด ๋ณด์„ธ์š”
</p>
</div>
</fieldset>
)
}

const GameRuleContent = () => {
return (
<fieldset className="flex flex-col gap-4 pt-2 items-center justify-around text-black transition-colors">
<h2 className="text-3xl font-medium">๋งค ๋ผ์šด๋“œ ํ€ด์ฆˆ๊ฐ€ ์ถœ์ œ๋ฉ๋‹ˆ๋‹ค</h2>
<div className="text-md flex flex-col items-center gap-1">
<p className="flex">
{['A', 'B', 'C', 'D'].map((answer, index) => (
<>
<span
key={answer}
className="font-medium bg-indigo-600 text-white rounded-full size-6 flex items-center justify-center"
>
{answer}
</span>
<span className="last:invisible pr-1">,</span>
</>
))}
์ค‘ ์ •๋‹ต์ด๋ผ๊ณ  ์ƒ๊ฐ๋˜๋Š” ๊ตฌ์—ญ์œผ๋กœ ์ด๋™ํ•ด์„œ ์ •๋‹ต์„ ์„ ํƒํ•˜์„ธ์š”
</p>
<p className="flex text-md items-center justify-center">
์ •๋‹ต์„ ๊ฐ€์žฅ ๋จผ์ € ๋งž์ถ˜ 3์ธ์—๊ฒŒ ์ ์ˆ˜๊ฐ€ ๋ถ€์—ฌ๋ฉ๋‹ˆ๋‹ค
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Hand%20gestures/Clapping%20Hands%20Light%20Skin%20Tone.png"
alt="Clapping Hands Light Skin Tone"
width="25"
height="25"
/>
</p>
</div>
</fieldset>
)
}

const IntroductionContent = () => {
// TeamSelectContent, GameRuleContent๊ฐ€ ๊ฐ๊ฐ ๋ฒˆ๊ฐˆ์•„๊ฐ€๋ฉด์„œ ๋ณด์—ฌ์ง
const [currentContent, setCurrentContent] = useState(0)
const contents = [TeamSelectContent, GameRuleContent]

useEffect(() => {
const interval = setInterval(() => {
setCurrentContent((prev) => (prev + 1) % contents.length)
}, 5000)
return () => clearInterval(interval)
}, [contents.length])

return (
<div className="select-none flex flex-col justify-around h-full">
<RoomInfo />
<fieldset className="flex flex-col gap-4 pt-2 items-center justify-around text-black">
{/* TODO: ๋ฌธ๊ตฌ ์˜๋…ผํ•ด์„œ ์ •ํ•˜๊ธฐ */}
<h2 className="text-4xl font-medium">์›ํ•˜๋Š” ํŒ€์„ ๊ณ ๋ฅด์„ธ์š”</h2>
<div className="text-md flex flex-col items-center gap-1">
<p>
<span className="text-red-500">RED</span> ํ˜น์€
<span className="text-blue-500"> BLUE</span> ํ•„๋“œ๋กœ ์ด๋™ํ•ด ํŒ€์„ ์„ ํƒํ•˜์„ธ์š”
</p>
<p className="text-md text-center">
์šฐ์ธก ํ•˜๋‹จ์˜
<span className="bg-indigo-600 rounded-full px-2 py-1 mx-2 text-white">
์บ๋ฆญํ„ฐ ๋ณ€๊ฒฝ
</span>
๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์บ๋ฆญํ„ฐ๋ฅผ ๋ณ€๊ฒฝํ•ด ๋ณด์„ธ์š”
</p>
</div>
</fieldset>
{contents[currentContent]()}
</div>
)
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/hooks/useSetupSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ const useSetUpRoom = (socket: WebSocket | null) => {
successGetRoomList(responseData.data.roomList)
break
case SOCKET_RES_CODE.CREATE_ROOM:
console.log('๋ฐฉ ์ƒ์„ฑ ์„ฑ๊ณต ์‘๋‹ต')
successCreateRoom(responseData.data.roomId)
console.log('๋ฐฉ ์ƒ์„ฑ ์„ฑ๊ณต ์‘๋‹ต', responseData.data)
successCreateRoom(responseData.data)
break
case SOCKET_RES_CODE.ENTER_ROOM_OWNER:
console.log('๋ฐฉ ์ž…์žฅ ์„ฑ๊ณต ์‘๋‹ต')
Expand Down

0 comments on commit cfa85f3

Please sign in to comment.