Improve guest help routing and loading
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-14 09:00:12 +01:00
parent 3a78c4f2c0
commit 03c7b20cae
8 changed files with 177 additions and 32 deletions

View File

@@ -13,7 +13,6 @@ import {
Clock,
MessageSquare,
Sparkles,
LifeBuoy,
UploadCloud,
AlertCircle,
Check,
@@ -188,13 +187,6 @@ export default function Header({ eventToken, title = '' }: { eventToken?: string
const headerFont = branding.typography?.heading ?? branding.fontFamily ?? undefined;
const bodyFont = branding.typography?.body ?? branding.fontFamily ?? undefined;
const basePath = eventToken ? `/e/${encodeURIComponent(eventToken)}` : '';
const showGalleryHelp = Boolean(
basePath
&& (location.pathname.startsWith(`${basePath}/gallery`) || location.pathname.startsWith(`${basePath}/photo`))
);
const galleryHelpHref = basePath ? `${basePath}/help/gallery-and-sharing` : '/help/gallery-and-sharing';
const headerStyle: React.CSSProperties = {
background: `linear-gradient(135deg, ${branding.primaryColor}, ${branding.secondaryColor})`,
color: headerTextColor,
@@ -259,15 +251,6 @@ export default function Header({ eventToken, title = '' }: { eventToken?: string
t={t}
/>
)}
{showGalleryHelp && (
<Link
to={galleryHelpHref}
className="rounded-full bg-white/15 p-2 text-white transition hover:bg-white/30"
aria-label={t('header.helpGallery')}
>
<LifeBuoy className="h-5 w-5" aria-hidden />
</Link>
)}
<AppearanceToggleDropdown />
<SettingsSheet />
</div>

View File

@@ -1,5 +1,5 @@
import React from "react";
import { Link, useParams } from 'react-router-dom';
import { Link, useLocation, useParams } from 'react-router-dom';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import {
@@ -23,6 +23,7 @@ import { useTranslation } from '../i18n/useTranslation';
import type { LocaleCode } from '../i18n/messages';
import { useHapticsPreference } from '../hooks/useHapticsPreference';
import { triggerHaptic } from '../lib/haptics';
import { getHelpSlugForPathname } from '../lib/helpRouting';
const legalPages = [
{ slug: 'impressum', translationKey: 'settings.legal.section.impressum' },
@@ -53,12 +54,15 @@ export function SettingsSheet() {
const localeContext = useLocale();
const { t } = useTranslation();
const params = useParams<{ token?: string }>();
const location = useLocation();
const [nameDraft, setNameDraft] = React.useState(identity?.name ?? '');
const [nameStatus, setNameStatus] = React.useState<NameStatus>('idle');
const [savingName, setSavingName] = React.useState(false);
const isLegal = view.mode === 'legal';
const legalDocument = useLegalDocument(isLegal ? view.slug : null, localeContext.locale);
const helpHref = params?.token ? `/e/${encodeURIComponent(params.token)}/help` : '/help';
const helpSlug = getHelpSlugForPathname(location.pathname);
const helpBase = params?.token ? `/e/${encodeURIComponent(params.token)}/help` : '/help';
const helpHref = helpSlug ? `${helpBase}/${helpSlug}` : helpBase;
React.useEffect(() => {
if (open && identity?.hydrated) {