archy/neode-ui/src/stores/screensaver.ts
Dorian 316dfee2fc Update UI components and enhance controller navigation for improved user experience
- Updated styles in various components to change color themes from cyan to yellow for better visual consistency.
- Enhanced focus management in controller navigation to improve accessibility and user interaction.
- Added new data attributes for controller navigation in multiple views to streamline user interactions with app containers.
- Improved audio handling by removing unused functions in useLoginSounds.ts, optimizing the codebase.
2026-02-17 21:10:16 +00:00

43 lines
889 B
TypeScript

import { defineStore } from 'pinia'
import { ref } from 'vue'
const INACTIVITY_MS = 3 * 60 * 1000 // 3 minutes
export const useScreensaverStore = defineStore('screensaver', () => {
const isActive = ref(false)
let inactivityTimer: ReturnType<typeof setTimeout> | null = null
function activate() {
isActive.value = true
clearInactivityTimer()
}
function deactivate() {
isActive.value = false
resetInactivityTimer()
}
function resetInactivityTimer() {
clearInactivityTimer()
inactivityTimer = setTimeout(() => {
inactivityTimer = null
isActive.value = true
}, INACTIVITY_MS)
}
function clearInactivityTimer() {
if (inactivityTimer) {
clearTimeout(inactivityTimer)
inactivityTimer = null
}
}
return {
isActive,
activate,
deactivate,
resetInactivityTimer,
clearInactivityTimer,
}
})