@@ -13,6 +13,7 @@ import { endBetRoom, refund } from "./model/api";
1313import { useLayoutShift } from "@/shared/hooks/useLayoutShift" ;
1414import { bettingRoomSchema } from "../betting-page/model/schema" ;
1515import { DuckCoinIcon } from "@/shared/icons" ;
16+ import BettingDetails from "./ui/BettingDetails" ;
1617
1718function BettingPageAdmin ( ) {
1819 useLayoutShift ( ) ;
@@ -36,11 +37,12 @@ function BettingPageAdmin() {
3637 > ( null ) ;
3738
3839 // Room Information
39- const roomId = channel . id ;
40- const option1 = channel . options . option1 ;
41- const option2 = channel . options . option2 ;
42- const defaultBetAmount = channel . settings . defaultBetAmount ;
43- const timer = channel . settings . duration ;
40+ const {
41+ id : roomId ,
42+ title,
43+ options : { option1, option2 } ,
44+ settings : { defaultBetAmount, duration : timer } ,
45+ } = channel ;
4446
4547 const socket = useSocketIO ( {
4648 url : "/api/betting" ,
@@ -202,10 +204,6 @@ function BettingPageAdmin() {
202204 }
203205 } ;
204206
205- const getTotalParticipants = ( ) => {
206- return bettingInfo . option1 . participants + bettingInfo . option2 . participants ;
207- } ;
208-
209207 const getTotalBetAmount = ( ) => {
210208 return bettingInfo . option1 . currentBets + bettingInfo . option2 . currentBets ;
211209 } ;
@@ -270,35 +268,12 @@ function BettingPageAdmin() {
270268 < div className = "flex flex-col gap-5" >
271269 < BettingTimer socket = { socket } bettingRoomInfo = { roomInfo } />
272270 < div className = "flex flex-col gap-6 p-5" >
273- < div className = "bg-secondary mb-4 rounded-lg p-3 text-center shadow-inner" >
274- < h1 className = "text-default-disabled text-md mb-1 font-bold" >
275- 베팅 주제
276- </ h1 >
277- < h1 className = "text-primary mb-1 pt-2 text-4xl font-extrabold" >
278- { channel . title }
279- </ h1 >
280- < p >
281- { status === "active"
282- ? "투표가 진행 중입니다. 투표를 취소할 수 있습니다."
283- : "투표가 종료되었습니다. 승부를 결정하세요!" }
284- </ p >
285- < h1 className = "text-default-disabled text-md mb-1 font-bold" >
286- 베팅 정보
287- </ h1 >
288- < p >
289- ∙ 최소 베팅 금액:{ " " }
290- < span className = "font-extrabold" > { defaultBetAmount } </ span >
291- </ p >
292- < p >
293- ∙ 설정한 시간:{ " " }
294- < span className = "font-extrabold" > { timer / 60 } 분</ span >
295- </ p >
296- < p >
297- ∙ 전체 베팅 참여자:{ " " }
298- < span className = "font-extrabold" > { getTotalParticipants ( ) } </ span >
299- </ p >
300- </ div >
301-
271+ < BettingDetails
272+ title = { title }
273+ defaultBetAmount = { defaultBetAmount }
274+ timer = { timer }
275+ status = { status }
276+ />
302277 { status === "timeover" ? (
303278 < div className = "flex w-full overflow-hidden rounded-xl border" >
304279 < div className = "relative flex w-1/2" >
0 commit comments