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:
Patrick Mulligan 2026-04-01 19:01:47 -04:00
commit f2de45bf9c

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue'
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
import { nip19 } from 'nostr-tools'
import { marked } from 'marked'
@ -295,6 +295,27 @@ function isHiddenOnMobile(colIndex: number, totalCols: number): boolean {
function goBack() {
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>
<template>