From d99f441bb9f0969ffcf0803ec9eb2477f6b7b19b Mon Sep 17 00:00:00 2001 From: Emile Bui <33470772+emilebui@users.noreply.github.com> Date: Wed, 28 Jun 2023 13:59:43 +0700 Subject: [PATCH] Adding more ban format (#18) (#19) * Adding more formats (50%) * Adding more formats (55%) * Adding more ban pick formats (99%) --- src/components/App/App.module.css | 12 ++ src/components/App/App.tsx | 46 +++++--- src/components/Menu/GameSettingPopup.tsx | 40 +++---- src/data/turn_info.ts | 134 +++++++++++++++++++---- src/game/game_logic.tsx | 25 ++++- src/game/game_state.tsx | 4 +- 6 files changed, 190 insertions(+), 71 deletions(-) diff --git a/src/components/App/App.module.css b/src/components/App/App.module.css index 76f3b2c..b2d382c 100644 --- a/src/components/App/App.module.css +++ b/src/components/App/App.module.css @@ -65,6 +65,18 @@ grid-template-columns: repeat(4, var(--size-card-min-width)); } +.grid.team1 { + grid-template-columns: repeat(1, var(--size-card-min-width)); +} + +.grid.team2 { + grid-template-columns: repeat(2, var(--size-card-min-width)); +} + +.grid.team3 { + grid-template-columns: repeat(3, var(--size-card-min-width)); +} + @media (min-width: 768px) { .grid { grid-template-columns: repeat(auto-fill, min(var(--size-card-min-width))); diff --git a/src/components/App/App.tsx b/src/components/App/App.tsx index 556f24b..5807673 100644 --- a/src/components/App/App.tsx +++ b/src/components/App/App.tsx @@ -70,7 +70,7 @@ const App: Component = (props) => { } let ws_uri = `${import.meta.env.VITE_WS_URI}/play?gid=${gid}&cid=${cid}&nickname=${nickname}&avatar=${ava}&casual=${casual}&numban=${numBan}` - + console.log(ws_uri) if (watch) { ws_uri = `${import.meta.env.VITE_WS_URI}/watch?gid=${gid}&cid=${cid}&nickname=${nickname}` } @@ -220,18 +220,38 @@ const App: Component = (props) => { } -

Ban List

-
-
- {(id, i) => id2Card(id, i())} -
-
-

Time Remaining

-
-
- {(id, i) => id2Card(id, i(), 4)} -
-
+ { + gameSetting.ban_number != 0 && + <> +

Ban List

+
+
+ {(id, i) => id2Card(id, i())} +
+
+

Time Remaining

+
+
+ {(id, i) => id2Card(id, i(), 4)} +
+
+ + } +

Pick List

diff --git a/src/components/Menu/GameSettingPopup.tsx b/src/components/Menu/GameSettingPopup.tsx index 371df2c..ec5a937 100644 --- a/src/components/Menu/GameSettingPopup.tsx +++ b/src/components/Menu/GameSettingPopup.tsx @@ -21,40 +21,26 @@ const GSForm: Component = props => { ) const update_setting = () => { - setGameSetting("casual", casual()) - setGameSetting("ban_number", banNumber()) + let temp_bn = banNumber() + let temp_c = casual() + setGameSetting("casual", temp_c) + setGameSetting("ban_number", temp_bn) props.close() } - const update_ban = (value: any) => { - if (value === "No Ban") { - setBanNumber(0) - } else { - setBanNumber(value) - } - } - - const get_ban_select = (bn: number) => { - if (bn === 0) { - return "No Ban" - } else { - return bn - } - } - // @ts-ignore return (
- {/*
*/} - {/*

Number of Ban

*/} - {/* setBanNumber(e)}*/} - {/* />*/} - {/*
*/} +
+

Number of Ban

+