perf(spa): drop backdrop blur on cards, fixed wallpaper layer, auto reduced effects on low-end (#24)
All checks were successful
CI / Check / Test (push) Successful in 1h11m34s

Reviewed-on: #24
This commit was merged in pull request #24.
This commit is contained in:
2026-10-12 18:58:50 +00:00
parent e303ae7f08
commit 9dd9df1f73
3 changed files with 76 additions and 21 deletions

16
spa/src/lib/effects.ts Normal file
View File

@@ -0,0 +1,16 @@
// Low-end devices can't keep up with live `backdrop-filter` while scrolling.
// `deviceMemory` is Chromium-only (bucketed: 0.25 … 8 GB); Safari leaves it
// undefined, so iPhones keep full effects. Flags <html> for aero-theme.css.
type NavigatorWithMemory = Navigator & { deviceMemory?: number }
function isLowEndDevice(): boolean {
const nav = navigator as NavigatorWithMemory
const lowMemory = nav.deviceMemory !== undefined && nav.deviceMemory <= 4
const fewCores = nav.hardwareConcurrency !== undefined && nav.hardwareConcurrency <= 2
return lowMemory || fewCores
}
export function applyEffectsLevel(): void {
if (isLowEndDevice()) document.documentElement.dataset.effects = "reduced"
}