Help guide opens on demand only; add At the door to admin quick actions

- The site-wide help guide no longer auto-opens on first visit to a page
  — it only opens when the help button is clicked. Removed the
  now-pointless "Don't show this again" checkbox and the per-page
  dismissal tracking it drove.
- Admin dashboard quick actions was missing "At the door" (walk-in
  registration, payments, ticket printing), which Supervisor already had.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-06 15:17:12 +02:00
co-authored by Claude Sonnet 5
parent 8e6cb542d9
commit 0f2b5afa74
6 changed files with 19 additions and 48 deletions
+5 -33
View File
@@ -1,42 +1,14 @@
"use client";
import { useEffect, useState } from "react";
import { useState } from "react";
/**
* Open/close state for a help guide, with per-page "don't show again"
* persistence. `storageKey` should be a stable slug identifying the guide's
* content (e.g. "reports", "dashboard-user", "general") — each slug gets an
* independent dismissal flag, so dismissing one page's guide doesn't
* suppress another's.
* Open/close state for a help guide — opens only when the user explicitly
* asks for it (e.g. clicking the help FAB), never automatically.
*/
export function useHelpGuide(storageKey: string) {
export function useHelpGuide() {
const [open, setOpen] = useState(false);
const dismissedKey = `hope_events_help_dismissed_${storageKey}`;
// Show automatically on first visit to this guide, unless dismissed for good.
useEffect(() => {
try {
if (typeof window !== "undefined" && window.localStorage.getItem(dismissedKey) !== "1") {
setOpen(true);
}
} catch {
// localStorage unavailable (private browsing, etc.) — just don't auto-show.
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [dismissedKey]);
const openGuide = () => setOpen(true);
const closeGuide = (dontShowAgain: boolean) => {
setOpen(false);
if (dontShowAgain) {
try {
window.localStorage.setItem(dismissedKey, "1");
} catch {
// ignore
}
}
};
const closeGuide = () => setOpen(false);
return { open, openGuide, closeGuide };
}