summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-10-13 15:02:30 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-10-13 15:02:30 +0800
commit3869fc803a31d1c0ff258d7082e2506a9121189c (patch)
tree21a3ebc941b9a76655137bf03b47590d1e3594af /components
parentd1efa64b5a64b770c1ab58ac805eb8b53bcab3a0 (diff)
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
Diffstat (limited to 'components')
-rw-r--r--components/performance.tsx15
1 files changed, 15 insertions, 0 deletions
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;
+};