add deprecation notice
All checks were successful
Publish / docker (push) Successful in 1m59s

This commit is contained in:
Lee 2023-11-05 23:17:44 +00:00
parent 403c34befd
commit 6b5b8bb54f

@ -12,71 +12,86 @@ import { usePlayerDataStore } from "../store/playerDataStore";
import styles from "../styles/overlay.module.css"; import styles from "../styles/overlay.module.css";
export default function Overlay(props) { export default function Overlay(props) {
const query = JSON.parse(props.query); const query = JSON.parse(props.query);
const [setOverlaySettings, mounted, setMounted] = useSettingsStore( const [setOverlaySettings, mounted, setMounted] = useSettingsStore(
(state) => [state.setOverlaySettings, state.mounted, state.setMounted] (state) => [state.setOverlaySettings, state.mounted, state.setMounted]
); );
const updatePlayerData = usePlayerDataStore( const updatePlayerData = usePlayerDataStore(
(state) => state.updatePlayerData (state) => state.updatePlayerData
); );
useEffect(() => { useEffect(() => {
if (!mounted && props.isValidSteamId) { if (!mounted && props.isValidSteamId) {
setMounted(true); setMounted(true);
async function setup() { async function setup() {
await setOverlaySettings(query); await setOverlaySettings(query);
const showSongInfo = useSettingsStore.getState().showSongInfo; const showSongInfo = useSettingsStore.getState().showSongInfo;
const showScoreInfo = useSettingsStore.getState().showScoreInfo; const showScoreInfo = useSettingsStore.getState().showScoreInfo;
if (showSongInfo || (showScoreInfo && typeof window !== "undefined")) { if (showSongInfo || (showScoreInfo && typeof window !== "undefined")) {
await connectClient(); await connectClient();
} }
const showPlayerStats = useSettingsStore.getState().showPlayerStats; const showPlayerStats = useSettingsStore.getState().showPlayerStats;
if (showPlayerStats) { if (showPlayerStats) {
await updatePlayerData(); await updatePlayerData();
} }
} }
setup(); setup();
} }
}, [ }, [
query, query,
props.isValidSteamId, props.isValidSteamId,
setOverlaySettings, setOverlaySettings,
mounted, mounted,
setMounted, setMounted,
updatePlayerData, updatePlayerData,
]); ]);
if (!props.isValidSteamId) { if (!props.isValidSteamId) {
return ( return (
<div className={styles.invalidPlayer}> <div className={styles.invalidPlayer}>
<h1>Invalid Steam ID</h1> <h1>Invalid Steam ID</h1>
<h3>Please check the id field in the url</h3> <h3>Please check the id field in the url</h3>
</div> </div>
); );
} }
return ( return (
<div className={styles.main}> <div className={styles.main}>
<NextSeo title="Overlay" /> <NextSeo title="Overlay" />
<PlayerStats /> <PlayerStats />
<SongInfo /> <SongInfo />
<ScoreStats /> <ScoreStats />
<CutStats /> <CutStats />
</div>
); <p
style={{
fontSize: 50,
position: "absolute",
top: 0,
right: 0,
paddingRight: "10px",
}}
>
This overlay is deprecated use:{" "}
<a href="https://ssr.fascinated.cc/overlay/builder">
https://ssr.fascinated.cc/overlay/builder
</a>
</p>
</div>
);
} }
export async function getServerSideProps(context) { export async function getServerSideProps(context) {
const steamId = context.query.id; const steamId = context.query.id;
const steamIdResponse = await axios.get( const steamIdResponse = await axios.get(
`${process.env.REACT_APP_SITE_URL}/api/validateid?steamid=${steamId}` `${process.env.REACT_APP_SITE_URL}/api/validateid?steamid=${steamId}`
); );
return { return {
props: { props: {
isValidSteamId: steamIdResponse.data.message === "Valid", isValidSteamId: steamIdResponse.data.message === "Valid",
query: JSON.stringify(context.query), query: JSON.stringify(context.query),
}, },
}; };
} }