This commit is contained in:
2025-02-14 11:59:11 +02:00
parent e6b898ef09
commit 9ddf068049
73 changed files with 5767 additions and 126 deletions

24
hooks/use-lazy-load.ts Normal file
View File

@@ -0,0 +1,24 @@
import { useState, useEffect } from 'react';
let gameImages: { [id: string]: string } = {};
export function useGameThumbnailLazyLoad(img: string) {
const [status, setStatus] = useState<string | undefined>(undefined);
useEffect(() => {
const interval = setInterval(() => {
if (gameImages[img]) {
setStatus(gameImages[img]);
clearInterval(interval);
}
}, 100);
return () => clearInterval(interval);
}, []);
return status;
}
export function addGameThumbnail(id: string, url: string) {
gameImages[id] = url;
}