fix(ssr): still show the youtube button even if the beatsaver map doesn't exist anymore
All checks were successful
deploy / deploy (push) Successful in 1m14s

This commit is contained in:
Lee 2023-11-24 20:50:51 +00:00
parent 407bcc866b
commit 4c0775b000

@ -30,6 +30,9 @@ export default function MapButtons({ leaderboard }: MapButtonsProps) {
return; return;
} }
const json = await beatSaberMap.json(); const json = await beatSaberMap.json();
if (json.maps[hash] !== null || json.maps[hash] !== undefined) {
return;
}
setMapId(json.maps[hash].id); setMapId(json.maps[hash].id);
}, [hash]); }, [hash]);
@ -40,7 +43,6 @@ export default function MapButtons({ leaderboard }: MapButtonsProps) {
return ( return (
<div className="hidden flex-col items-center justify-between gap-1 p-1 md:flex md:items-start md:justify-end"> <div className="hidden flex-col items-center justify-between gap-1 p-1 md:flex md:items-start md:justify-end">
{mapId && ( {mapId && (
<>
<div className="flex gap-1"> <div className="flex gap-1">
<Tooltip> <Tooltip>
<TooltipTrigger> <TooltipTrigger>
@ -63,6 +65,7 @@ export default function MapButtons({ leaderboard }: MapButtonsProps) {
<CopyBsrButton mapId={mapId} /> <CopyBsrButton mapId={mapId} />
</div> </div>
)}
<div className="flex gap-1"> <div className="flex gap-1">
<Tooltip> <Tooltip>
<TooltipTrigger> <TooltipTrigger>
@ -87,8 +90,6 @@ export default function MapButtons({ leaderboard }: MapButtonsProps) {
</TooltipContent> </TooltipContent>
</Tooltip> </Tooltip>
</div> </div>
</>
)}
</div> </div>
); );
} }