mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 02:14:05 +00:00
feat(help): in-app help center with per-screen guides and pictures
A help icon on every screen opens a panel with the screen's overview, its sub-screens, task guides with a framed picture per step, search across guides and the wiki, and a switch to any other screen's help. Guides exist for the dashboard, Vacay, Atlas, Collections, Journey (list, journal, studio), Settings (all tabs), Admin (all tabs) and the trip frame; the trip's own screens are in progress. Pictures are produced by Playwright (client/e2e/help), texts in all 23 languages.
This commit is contained in:
@@ -197,8 +197,9 @@ describe('Navbar', () => {
|
||||
const updateSetting = vi.fn().mockResolvedValue(undefined);
|
||||
seedStore(useSettingsStore, { settings: buildSettings({ dark_mode: false }), updateSetting });
|
||||
render(<Navbar />);
|
||||
// Find the dark mode toggle button by title attribute
|
||||
const toggleBtn = document.querySelector('button[title]') as HTMLElement;
|
||||
// Find the dark mode toggle button by title attribute. The help button
|
||||
// before it carries a title too, hence the exclusion.
|
||||
const toggleBtn = document.querySelector('button[title]:not([data-help-button])') as HTMLElement;
|
||||
expect(toggleBtn).toBeTruthy();
|
||||
await user.click(toggleBtn);
|
||||
expect(updateSetting).toHaveBeenCalledWith('dark_mode', 'dark');
|
||||
@@ -278,7 +279,7 @@ describe('Navbar', () => {
|
||||
const updateSetting = vi.fn().mockResolvedValue(undefined);
|
||||
seedStore(useSettingsStore, { settings: buildSettings({ dark_mode: 'dark' }), updateSetting });
|
||||
render(<Navbar />);
|
||||
const toggleBtn = document.querySelector('button[title]') as HTMLElement;
|
||||
const toggleBtn = document.querySelector('button[title]:not([data-help-button])') as HTMLElement;
|
||||
expect(toggleBtn).toBeTruthy();
|
||||
await user.click(toggleBtn);
|
||||
expect(updateSetting).toHaveBeenCalledWith('dark_mode', 'light');
|
||||
@@ -456,7 +457,7 @@ describe('Navbar styling and menu details', () => {
|
||||
fireEvent.mouseLeave(share);
|
||||
expect(share.style.background).toBe('var(--bg-card)');
|
||||
|
||||
const theme = document.querySelector('button[title]') as HTMLElement;
|
||||
const theme = document.querySelector('button[title]:not([data-help-button])') as HTMLElement;
|
||||
fireEvent.mouseEnter(theme);
|
||||
expect(theme.style.background).toBe('var(--bg-hover)');
|
||||
fireEvent.mouseLeave(theme);
|
||||
@@ -467,7 +468,7 @@ describe('Navbar styling and menu details', () => {
|
||||
const updateSetting = vi.fn(async () => {});
|
||||
seedStore(useSettingsStore, { settings: buildSettings({ dark_mode: false }), updateSetting });
|
||||
render(<Navbar />);
|
||||
const theme = document.querySelector('button[title]') as HTMLElement;
|
||||
const theme = document.querySelector('button[title]:not([data-help-button])') as HTMLElement;
|
||||
|
||||
vi.useFakeTimers();
|
||||
try {
|
||||
@@ -490,7 +491,7 @@ describe('Navbar styling and menu details', () => {
|
||||
const updateSetting = vi.fn(async () => {});
|
||||
seedStore(useSettingsStore, { settings: buildSettings({ dark_mode: false }), updateSetting });
|
||||
const { unmount } = render(<Navbar />);
|
||||
const theme = document.querySelector('button[title]') as HTMLElement;
|
||||
const theme = document.querySelector('button[title]:not([data-help-button])') as HTMLElement;
|
||||
|
||||
vi.useFakeTimers();
|
||||
try {
|
||||
@@ -553,7 +554,7 @@ describe('Navbar styling and menu details', () => {
|
||||
seedStore(useSettingsStore, { settings: buildSettings({ dark_mode: false }), updateSetting });
|
||||
render(<Navbar />);
|
||||
|
||||
fireEvent.click(document.querySelector('button[title]') as HTMLElement);
|
||||
fireEvent.click(document.querySelector('button[title]:not([data-help-button])') as HTMLElement);
|
||||
|
||||
await waitFor(() => expect(updateSetting).toHaveBeenCalledWith('dark_mode', 'dark'));
|
||||
document.documentElement.classList.remove('trek-theme-transitioning');
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useTranslation } from '../../i18n'
|
||||
import { Plane, LogOut, Settings, ChevronDown, Shield, ArrowLeft, Users, Moon, Sun, Monitor, CalendarDays, Briefcase, Globe, Compass, BookOpen, Bookmark } from 'lucide-react'
|
||||
import type { LucideIcon } from 'lucide-react'
|
||||
import InAppNotificationBell from './InAppNotificationBell.tsx'
|
||||
import HelpButton from '../Help/HelpButton'
|
||||
import { resolvePluginIcon } from '../shared/PluginIcon'
|
||||
import { visibleManagedNavItems } from '../../managed'
|
||||
|
||||
@@ -234,6 +235,9 @@ export default function Navbar({ tripTitle, tripId, onBack, showBack, onShare }:
|
||||
</span>
|
||||
)}
|
||||
|
||||
{/* Contextual help for the current screen — same footprint as the theme toggle beside it */}
|
||||
{user && <HelpButton />}
|
||||
|
||||
{/* Dark mode toggle (light ↔ dark, overrides auto) — hidden on mobile */}
|
||||
<button type="button" onClick={toggleDarkMode} title={dark ? t('nav.lightMode') : t('nav.darkMode')}
|
||||
className="p-2 rounded-lg transition-colors flex-shrink-0 hidden sm:flex relative w-8 h-8 items-center justify-center text-content-muted"
|
||||
|
||||
Reference in New Issue
Block a user