@@ -27,37 +27,29 @@ import 'react-toastify/dist/ReactToastify.css';
2727import dynamic from "next/dynamic" ;
2828import NextImage from "next/image" ;
2929import OnboardingText from "@/components/onboardingText" ;
30- // import RoundOverScreen from "@/components/roundOverScreen";
3130const RoundOverScreen = dynamic ( ( ) => import ( '@/components/roundOverScreen' ) , { ssr : false } ) ;
3231import msToTime from "@/components/msToTime" ;
3332import SuggestAccountModal from "@/components/suggestAccountModal" ;
34- import FriendsModal from "@/components/friendModal" ;
3533import { toast , ToastContainer } from "react-toastify" ;
36- import InfoModal from "@/components/infoModal" ;
3734import { inIframe , isForbiddenIframe } from "@/components/utils/inIframe" ;
3835import MapsModal from "@/components/maps/mapsModal" ;
39- import { useRouter } from "next/router" ;
40- import { fromLonLat } from "ol/proj" ;
41- import { boundingExtent } from "ol/extent" ;
4236
4337import countries from "@/public/countries.json" ;
4438import officialCountryMaps from "@/public/officialCountryMaps.json" ;
4539
4640import gameStorage from "@/components/utils/localStorage" ;
4741import DiscordModal from "@/components/discordModal" ;
48- import MerchModal from "@/components/merchModal" ;
4942import AlertModal from "@/components/ui/AlertModal" ;
5043import WhatsNewModal from "@/components/ui/WhatsNewModal" ;
51- import MapGuessrModal from "@/components/mapGuessrModal" ;
44+ const MapGuessrModal = dynamic ( ( ) => import ( "@/components/mapGuessrModal" ) , { ssr : false } ) ;
5245import changelog from "@/components/changelog.json" ;
5346import clientConfig from "@/clientConfig" ;
5447import { useGoogleLogin } from "@react-oauth/google" ;
55- import haversineDistance from "./utils/haversineDistance" ;
48+ // import haversineDistance from "./utils/haversineDistance";
5649import StreetView from "./streetview/streetView" ;
5750import Stats from "stats.js" ;
5851// import SvEmbedIframe from "./streetview/svHandler"; // REMOVED: Using direct StreetView instead of double-iframe setup
59- import HomeNotice from "./homeNotice" ;
60- import getTimeString , { getMaintenanceDate } from "./maintenanceTime" ;
52+ // import getTimeString, { getMaintenanceDate } from "./maintenanceTime";
6153// import MaintenanceBanner from "./MaintenanceBanner";
6254import Ad from "./bannerAdNitro" ;
6355import PendingNameChangeModal from "./pendingNameChangeModal" ;
@@ -2153,11 +2145,10 @@ export default function Home({ }) {
21532145 setLatLong ( loc )
21542146 if ( data . name ) {
21552147
2156- // calculate extent (for openlayers)
2157- const mappedLatLongs = data . locations . map ( ( l ) => fromLonLat ( [ l . long , l . lat ] , 'EPSG:4326' ) ) ;
2158- let extent = boundingExtent ( mappedLatLongs ) ;
2159- console . log ( "extent" , extent )
2160- // convert extent from EPSG:4326 to EPSG:3857 (for openlayers)
2148+ // calculate extent - simple bounding box [minLng, minLat, maxLng, maxLat]
2149+ const lngs = data . locations . map ( l => l . long ) ;
2150+ const lats = data . locations . map ( l => l . lat ) ;
2151+ const extent = [ Math . min ( ...lngs ) , Math . min ( ...lats ) , Math . max ( ...lngs ) , Math . max ( ...lats ) ] ;
21612152
21622153 setGameOptions ( ( prev ) => ( {
21632154 ...prev ,
@@ -2304,24 +2295,17 @@ export default function Home({ }) {
23042295 < >
23052296 < HeadContent text = { text } inCoolMathGames = { inCoolMathGames } inCrazyGames = { inCrazyGames } />
23062297
2307- < AccountModal inCrazyGames = { inCrazyGames } shown = { accountModalOpen } session = { session } setSession = { setSession } setAccountModalOpen = { setAccountModalOpen }
2298+ { accountModalOpen && < AccountModal inCrazyGames = { inCrazyGames } shown = { true } session = { session } setSession = { setSession } setAccountModalOpen = { setAccountModalOpen }
23082299 eloData = { eloData } accountModalPage = { accountModalPage } setAccountModalPage = { setAccountModalPage }
23092300 ws = { ws } canSendInvite = {
2310- // send invite if in a private multiplayer game, dont need to be host or in game waiting just need to be in a Party
23112301 multiplayerState ?. inGame && ! multiplayerState ?. gameData ?. public
23122302 } sendInvite = { sendInvite } options = { options }
2313-
2314- />
2315- < SetUsernameModal shown = { session && session ?. token ?. secret && ! session . token . username } session = { session } />
2316- < SuggestAccountModal shown = { showSuggestLoginModal } setOpen = { setShowSuggestLoginModal } />
2317- < DiscordModal shown = { showDiscordModal && ( typeof window !== 'undefined' && window . innerWidth >= 768 ) } setOpen = { setShowDiscordModal } />
2318- { /* <MerchModal shown={merchModal} onClose={() => setMerchModal(false)} session={session} /> */ }
2319- < MapGuessrModal isOpen = { mapGuessrModal } onClose = { ( ) => setMapGuessrModal ( false ) } />
2320- < PendingNameChangeModal
2321- session = { session }
2322- isOpen = { pendingNameChangeModal }
2323- onClose = { ( ) => setPendingNameChangeModal ( false ) }
2324- />
2303+ /> }
2304+ { session ?. token ?. secret && ! session . token . username && < SetUsernameModal shown = { true } session = { session } /> }
2305+ { showSuggestLoginModal && < SuggestAccountModal shown = { true } setOpen = { setShowSuggestLoginModal } /> }
2306+ { showDiscordModal && typeof window !== 'undefined' && window . innerWidth >= 768 && < DiscordModal shown = { true } setOpen = { setShowDiscordModal } /> }
2307+ { mapGuessrModal && < MapGuessrModal isOpen = { true } onClose = { ( ) => setMapGuessrModal ( false ) } /> }
2308+ { pendingNameChangeModal && < PendingNameChangeModal session = { session } isOpen = { true } onClose = { ( ) => setPendingNameChangeModal ( false ) } /> }
23252309 { ChatboxMemo }
23262310 < ToastContainer pauseOnFocusLoss = { false } />
23272311
@@ -2799,8 +2783,7 @@ export default function Home({ }) {
27992783 </ div >
28002784 </ div >
28012785 }
2802- < InfoModal shown = { false } />
2803- < MapsModal shown = { mapModal || gameOptionsModalShown } session = { session } onClose = { ( ) => {
2786+ { ( mapModal || gameOptionsModalShown ) && < MapsModal shown = { true } session = { session } onClose = { ( ) => {
28042787 if ( mapModalClosing ) return ;
28052788 setMapModalClosing ( true ) ;
28062789 setTimeout ( ( ) => {
@@ -2816,12 +2799,12 @@ export default function Home({ }) {
28162799 } : null }
28172800 showAllCountriesOption = { ( gameOptionsModalShown && screen === "singleplayer" ) }
28182801 showOptions = { screen === "singleplayer" }
2819- gameOptions = { gameOptions } setGameOptions = { setGameOptions } />
2802+ gameOptions = { gameOptions } setGameOptions = { setGameOptions } /> }
28202803
2821- < SettingsModal inCrazyGames = { inCrazyGames } options = { options } setOptions = { setOptions } shown = { settingsModal } onClose = { ( ) => setSettingsModal ( false ) } />
2804+ { settingsModal && < SettingsModal inCrazyGames = { inCrazyGames } options = { options } setOptions = { setOptions } shown = { true } onClose = { ( ) => setSettingsModal ( false ) } /> }
28222805
2823- < AlertModal
2824- isOpen = { connectionErrorModalShown }
2806+ { connectionErrorModalShown && < AlertModal
2807+ isOpen = { true }
28252808 onClose = { ( ) => setConnectionErrorModalShown ( false ) }
28262809 title = { multiplayerState . connecting ? text ( "multiplayerConnecting" ) : text ( "multiplayerNotConnected" ) }
28272810 message = { multiplayerState . connecting
@@ -2832,7 +2815,7 @@ export default function Home({ }) {
28322815 : text ( "multiplayerConnectionErrorMessage" )
28332816 }
28342817 type = { multiplayerState . connecting ? "warning" : "error" }
2835- />
2818+ /> }
28362819
28372820
28382821
@@ -2972,11 +2955,6 @@ document.addEventListener(
29722955 }
29732956}, 1000);
29742957
2975- (function(c,l,a,r,i,t,y){
2976- c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
2977- t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
2978- y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
2979- })(window, document, "clarity", "script", "ndud94nvsg");
29802958
29812959 window.aiptag = window.aiptag || {cmd: []};
29822960 aiptag.cmd.display = aiptag.cmd.display || [];
0 commit comments