feat(ui): add 5-minute inactivity timeout to support page
Returns to idle screen after 5 minutes of no touch/scroll activity. Timer resets on any pointer or scroll interaction. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
919254e160
commit
f2de45bf9c
1 changed files with 22 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { nip19 } from 'nostr-tools'
|
import { nip19 } from 'nostr-tools'
|
||||||
import { marked } from 'marked'
|
import { marked } from 'marked'
|
||||||
|
|
@ -295,6 +295,27 @@ function isHiddenOnMobile(colIndex: number, totalCols: number): boolean {
|
||||||
function goBack() {
|
function goBack() {
|
||||||
router.push('/')
|
router.push('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inactivity timeout — return to idle after 5 minutes
|
||||||
|
const SUPPORT_TIMEOUT = 5 * 60 * 1000
|
||||||
|
let inactivityTimer: ReturnType<typeof setTimeout> | null = null
|
||||||
|
|
||||||
|
function resetInactivityTimer() {
|
||||||
|
if (inactivityTimer) clearTimeout(inactivityTimer)
|
||||||
|
inactivityTimer = setTimeout(() => router.push('/'), SUPPORT_TIMEOUT)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
resetInactivityTimer()
|
||||||
|
document.addEventListener('pointerdown', resetInactivityTimer)
|
||||||
|
document.addEventListener('scroll', resetInactivityTimer, true)
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (inactivityTimer) clearTimeout(inactivityTimer)
|
||||||
|
document.removeEventListener('pointerdown', resetInactivityTimer)
|
||||||
|
document.removeEventListener('scroll', resetInactivityTimer, true)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue