Skip to content

Commit

Permalink
Add code button at onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
codergautam committed Dec 16, 2024
1 parent 4d8c431 commit e869f8e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
17 changes: 15 additions & 2 deletions components/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,9 @@ setShowCountryButtons(false)
showRoadLabels={gameOptions?.showRoadName}
loading={loading}
setLoading={setLoading}
hidden={(!latLong || !latLong.lat || !latLong.long)|| loading}
hidden={((!latLong || !latLong.lat || !latLong.long)|| loading)||(
screen==="home"||(screen==="multiplayer" && (multiplayerState?.gameData?.state === "waiting"||multiplayerState?.enteringGameCode))
)}
onLoad={() => {
console.log("loaded")
setTimeout(() => {
Expand All @@ -1965,7 +1967,18 @@ setShowCountryButtons(false)



<Navbar inCoolMathGames={inCoolMathGames} maintenance={maintenance} inCrazyGames={inCrazyGames} loading={loading} onFriendsPress={()=>setFriendsModal(true)} loginQueued={loginQueued} setLoginQueued={setLoginQueued} inGame={multiplayerState?.inGame || screen === "singleplayer"} openAccountModal={() => setAccountModalOpen(true)} session={session} reloadBtnPressed={reloadBtnPressed} backBtnPressed={backBtnPressed} setGameOptionsModalShown={setGameOptionsModalShown} onNavbarPress={() => onNavbarLogoPress()} gameOptions={gameOptions} screen={screen} multiplayerState={multiplayerState} shown={!multiplayerState?.gameData?.public && !leagueModal} />
<Navbar
joinCodePress={() => {
setOnboarding(null)
setOnboardingCompleted(true)
gameStorage.setItem("onboarding", 'done')
setScreen("multiplayer")
setMultiplayerState((prev) => ({
...prev,
enteringGameCode: true
}))}}

inCoolMathGames={inCoolMathGames} maintenance={maintenance} inCrazyGames={inCrazyGames} loading={loading} onFriendsPress={()=>setFriendsModal(true)} loginQueued={loginQueued} setLoginQueued={setLoginQueued} inGame={multiplayerState?.inGame || screen === "singleplayer"} openAccountModal={() => setAccountModalOpen(true)} session={session} reloadBtnPressed={reloadBtnPressed} backBtnPressed={backBtnPressed} setGameOptionsModalShown={setGameOptionsModalShown} onNavbarPress={() => onNavbarLogoPress()} gameOptions={gameOptions} screen={screen} multiplayerState={multiplayerState} shown={!multiplayerState?.gameData?.public && !leagueModal} />
{/* ELO/League button */}
{screen === "home" && !mapModal && session && session?.token?.secret && (
<button className="gameBtn leagueBtn" onClick={()=>{setLeagueModal(true)}} style={{backgroundColor: eloData?.league?.color }}>
Expand Down
9 changes: 8 additions & 1 deletion components/ui/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useTranslation } from '@/components/useTranslations'
import WsIcon from "../wsIcon";
import { useState, useEffect } from "react";

export default function Navbar({ maintenance, inCrazyGames, inCoolMathGames, inGame, openAccountModal, shown, backBtnPressed, reloadBtnPressed, setGameOptionsModalShown, onNavbarPress, onFriendsPress, gameOptions, session, screen, multiplayerState, loading }) {
export default function Navbar({ maintenance, joinCodePress, inCrazyGames, inCoolMathGames, inGame, openAccountModal, shown, backBtnPressed, reloadBtnPressed, setGameOptionsModalShown, onNavbarPress, onFriendsPress, gameOptions, session, screen, multiplayerState, loading }) {
const { t: text } = useTranslation("common");

const reloadBtn = (((multiplayerState?.inGame) || (screen === 'singleplayer'))) && (!loading);
Expand Down Expand Up @@ -69,6 +69,13 @@ export default function Navbar({ maintenance, inCrazyGames, inCoolMathGames, inG
<FaPencil size={20}/>
</button>
)}

{screen === "onboarding" && (
<button className="gameBtn navBtn"
style={{backgroundColor: 'blue'}}
onClick={joinCodePress}>{text("joinGame")}</button>
)}

{!inGame && showAccBtn && !inCoolMathGames && (<AccountBtn inCrazyGames={inCrazyGames} session={session} navbarMode={true} openAccountModal={openAccountModal} />)}
</div>
</div>
Expand Down

0 comments on commit e869f8e

Please sign in to comment.