Add calendar summary to dashboard; default portal to 1hr inactivity timeout

Dashboard now shows today's and upcoming events (mine or all, toggle) for
users with calendar app access. Also gives the portal shell a 1-hour
inactivity default for devices that have never been configured, instead of
following child apps into an unlimited 30-day session — that's why the
dashboard could sit logged in for days without prompting. An explicit "Off"
choice in Admin Settings still overrides it (now written as mins=0 instead
of clearing the cookie, so it's distinguishable from "never configured").
This commit is contained in:
jtricerolph 2026-07-28 12:45:29 +00:00
parent 709e83b6d5
commit 0b8fed2e96
4 changed files with 193 additions and 5 deletions

View file

@ -861,10 +861,11 @@ function getInactivityMins(): number {
return c ? parseInt(c.split('=')[1]) || 0 : 0
}
// Always writes the cookie, including for "Off" (mins=0) — this makes an
// explicit Off choice distinguishable from a device that was never visited,
// which the portal's own inactivity default relies on.
function setInactivityMins(mins: number) {
document.cookie = mins > 0
? `hnf_inactivity_mins=${mins}; max-age=31536000; path=/; SameSite=Strict`
: 'hnf_inactivity_mins=; max-age=0; path=/; SameSite=Strict'
document.cookie = `hnf_inactivity_mins=${mins}; max-age=31536000; path=/; SameSite=Strict`
}
function DeviceTab() {

View file

@ -2,6 +2,7 @@ import { useNavigate } from 'react-router-dom'
import { Download } from 'lucide-react'
import { PageShell } from '../components/PageShell'
import { AppIcon } from '../components/AppIcon'
import { CalendarSummary } from '../components/CalendarSummary'
import type { User, App } from '../types'
export function Dashboard({ user }: { user: User }) {
@ -30,6 +31,8 @@ export function Dashboard({ user }: { user: User }) {
</p>
)}
<CalendarSummary user={user} />
{/* Uncategorised apps */}
{uncategorised.length > 0 && (
<AppGrid apps={uncategorised} onOpen={slug => navigate(`/app/${slug}`)} />