mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-02 16:23:48 +03:00
feat: adding cooldown to randomize button
This commit is contained in:
parent
9ef6329799
commit
a615ff35cb
@ -150,6 +150,12 @@ export const randomizerButton = style({
|
|||||||
":active": {
|
":active": {
|
||||||
transform: "scale(0.98)",
|
transform: "scale(0.98)",
|
||||||
},
|
},
|
||||||
|
":disabled": {
|
||||||
|
boxShadow: "none",
|
||||||
|
transform: "none",
|
||||||
|
opacity: "0.8",
|
||||||
|
backgroundColor: vars.color.background,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const heroPanelSkeleton = style({
|
export const heroPanelSkeleton = style({
|
||||||
|
@ -27,6 +27,7 @@ import { Downloader } from "@shared";
|
|||||||
|
|
||||||
export function GameDetails() {
|
export function GameDetails() {
|
||||||
const [randomGame, setRandomGame] = useState<Steam250Game | null>(null);
|
const [randomGame, setRandomGame] = useState<Steam250Game | null>(null);
|
||||||
|
const [randomizerLocked, setRandomizerLocked] = useState(false);
|
||||||
|
|
||||||
const { objectID } = useParams();
|
const { objectID } = useParams();
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
@ -54,6 +55,18 @@ export function GameDetails() {
|
|||||||
{ fromRandomizer: "1" }
|
{ fromRandomizer: "1" }
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
setRandomizerLocked(true);
|
||||||
|
|
||||||
|
const zero = performance.now();
|
||||||
|
|
||||||
|
requestAnimationFrame(function animateLock(time) {
|
||||||
|
if (time - zero <= 1000) {
|
||||||
|
requestAnimationFrame(animateLock);
|
||||||
|
} else {
|
||||||
|
setRandomizerLocked(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -118,7 +131,7 @@ export function GameDetails() {
|
|||||||
className={styles.randomizerButton}
|
className={styles.randomizerButton}
|
||||||
onClick={handleRandomizerClick}
|
onClick={handleRandomizerClick}
|
||||||
theme="outline"
|
theme="outline"
|
||||||
disabled={!randomGame}
|
disabled={!randomGame || randomizerLocked}
|
||||||
>
|
>
|
||||||
<div style={{ width: 16, height: 16, position: "relative" }}>
|
<div style={{ width: 16, height: 16, position: "relative" }}>
|
||||||
<Lottie
|
<Lottie
|
||||||
|
Loading…
Reference in New Issue
Block a user