import React from 'react' import { Link } from 'react-router' import { CheckCircle2, Lightbulb, ArrowUpRight, ChevronRight, Maximize2, ListOrdered, Camera, Link2 } from 'lucide-react' import { useTranslation } from '../../i18n' import { useHelpStore, docTitle } from '../../store/helpStore' import { guideKey, guideStepKey, guideTipKey, helpMedia, docsRoute, getHelpGuide, getHelpContext, ctxKey, helpContextTrail } from '../../help/registry' import type { HelpGuide } from '../../help/types' import { helpIcon } from './helpIcons' import HelpBadge from './HelpBadge' import HelpDocLink from './HelpDocLink' import HelpSizeChip from './HelpSizeChip' import { useScreenRoute } from './useScreenRoute' /** * One guide, top to bottom: a header card that says where you are and how big * the task is, the steps as a numbered rail with a picture each, what the * reader ends up with, the things worth knowing, and where to go next. */ export default function HelpGuideView({ guide }: { guide: HelpGuide }): React.ReactElement { const { t } = useTranslation() const openLightbox = useHelpStore(s => s.openLightbox) const closeHelp = useHelpStore(s => s.closeHelp) const docIndex = useHelpStore(s => s.docIndex) const openGuide = useHelpStore(s => s.openGuide) const title = t(guideKey(guide.id, 'title')) const screen = getHelpContext(guide.context) const steps = Array.from({ length: guide.steps }, (_, i) => i + 1) const tips = Array.from({ length: guide.tips }, (_, i) => t(guideTipKey(guide.id, i + 1))) const related = (guide.related ?? []).map(getHelpGuide).filter((g): g is HelpGuide => g !== null) const Icon = helpIcon(guide.icon) const ScreenIcon = screen ? helpIcon(screen.icon) : Icon const screenRoute = useScreenRoute(screen?.route) return (
{/* Where you are, what this is, how big it is */}
{screen && helpContextTrail(screen).map((c, i, all) => ( {i > 0 && } {t(ctxKey(c.id, 'title'))} ))} {t('help.center.howTo')}

{title}

{t(guideKey(guide.id, 'goal'))}

{t('help.center.stepsLabel')} {guide.media.steps && {t('help.center.screenshot')}} {/* One way out of the header: into the screen. The docs link waits at the bottom. */} {screen && screenRoute && ( {t('help.center.goToScreen', { screen: t(ctxKey(screen.id, 'title')) })} )}
{/* Steps, on a rail */}
{t('help.center.stepsLabel')}
    {/* The rail: runs behind the step numbers from the first to the last. */}
{/* Result */}
{t('help.center.result')}

{t(guideKey(guide.id, 'result'))}

{guide.media.result && ( )}
{/* Tips */} {tips.length > 0 && (
{t('help.center.tips')}
)} {/* Go there / docs / related */} {(guide.link || guide.docs || related.length > 0) && (
{(guide.link || guide.docs) && (
{t('help.center.docsSection')} {guide.link && ( {t(guideKey(guide.id, 'link'))} )} {guide.docs && ( )}
)} {related.length > 0 && (
{t('help.center.related')}
    {related.map(g => { const RelIcon = helpIcon(g.icon) return (
  • ) })}
)}
)}
) }