From 3869fc803a31d1c0ff258d7082e2506a9121189c Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 13 Oct 2024 15:02:30 +0800 Subject: perf(performance.tsx): added new performance module to dynamiclly change blur, adapting user device perf(styles): removed transition to reduce lag, as it showed unintended side effects --- components/performance.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 components/performance.tsx (limited to 'components') diff --git a/components/performance.tsx b/components/performance.tsx new file mode 100644 index 0000000..5bc62eb --- /dev/null +++ b/components/performance.tsx @@ -0,0 +1,15 @@ +"use client"; + +import { useEffect } from "react"; +import { getGPUTier } from "detect-gpu"; + +export default function Performance() { + useEffect(() => { + getGPUTier().then((gpuTier) => { + const blurSize = gpuTier.tier < 3 || gpuTier.type === "FALLBACK" ? "0" : "1024"; + document.documentElement.style.setProperty("--blur-size", blurSize + "px"); + }); + }, []); + + return null; +}; -- cgit v1.2.3