diff --git a/src/pages/overlay.js b/src/pages/overlay.js index e2fa7bc..d35455a 100644 --- a/src/pages/overlay.js +++ b/src/pages/overlay.js @@ -12,71 +12,86 @@ import { usePlayerDataStore } from "../store/playerDataStore"; import styles from "../styles/overlay.module.css"; export default function Overlay(props) { - const query = JSON.parse(props.query); - const [setOverlaySettings, mounted, setMounted] = useSettingsStore( - (state) => [state.setOverlaySettings, state.mounted, state.setMounted] - ); - const updatePlayerData = usePlayerDataStore( - (state) => state.updatePlayerData - ); + const query = JSON.parse(props.query); + const [setOverlaySettings, mounted, setMounted] = useSettingsStore( + (state) => [state.setOverlaySettings, state.mounted, state.setMounted] + ); + const updatePlayerData = usePlayerDataStore( + (state) => state.updatePlayerData + ); - useEffect(() => { - if (!mounted && props.isValidSteamId) { - setMounted(true); + useEffect(() => { + if (!mounted && props.isValidSteamId) { + setMounted(true); - async function setup() { - await setOverlaySettings(query); - const showSongInfo = useSettingsStore.getState().showSongInfo; - const showScoreInfo = useSettingsStore.getState().showScoreInfo; - if (showSongInfo || (showScoreInfo && typeof window !== "undefined")) { - await connectClient(); - } - const showPlayerStats = useSettingsStore.getState().showPlayerStats; - if (showPlayerStats) { - await updatePlayerData(); - } - } - setup(); - } - }, [ - query, - props.isValidSteamId, - setOverlaySettings, - mounted, - setMounted, - updatePlayerData, - ]); + async function setup() { + await setOverlaySettings(query); + const showSongInfo = useSettingsStore.getState().showSongInfo; + const showScoreInfo = useSettingsStore.getState().showScoreInfo; + if (showSongInfo || (showScoreInfo && typeof window !== "undefined")) { + await connectClient(); + } + const showPlayerStats = useSettingsStore.getState().showPlayerStats; + if (showPlayerStats) { + await updatePlayerData(); + } + } + setup(); + } + }, [ + query, + props.isValidSteamId, + setOverlaySettings, + mounted, + setMounted, + updatePlayerData, + ]); - if (!props.isValidSteamId) { - return ( -
-

Invalid Steam ID

-

Please check the id field in the url

-
- ); - } + if (!props.isValidSteamId) { + return ( +
+

Invalid Steam ID

+

Please check the id field in the url

+
+ ); + } - return ( -
- - - - - -
- ); + return ( +
+ + + + + + +

+ This overlay is deprecated use:{" "} + + https://ssr.fascinated.cc/overlay/builder + +

+
+ ); } export async function getServerSideProps(context) { - const steamId = context.query.id; - const steamIdResponse = await axios.get( - `${process.env.REACT_APP_SITE_URL}/api/validateid?steamid=${steamId}` - ); + const steamId = context.query.id; + const steamIdResponse = await axios.get( + `${process.env.REACT_APP_SITE_URL}/api/validateid?steamid=${steamId}` + ); - return { - props: { - isValidSteamId: steamIdResponse.data.message === "Valid", - query: JSON.stringify(context.query), - }, - }; + return { + props: { + isValidSteamId: steamIdResponse.data.message === "Valid", + query: JSON.stringify(context.query), + }, + }; }