"use client"; import { ArrowLeft, BookOpen, MessageSquare } from "lucide-react"; import { useTranslations } from "next-intl"; import { useMemo } from "react"; import { BlockNoteEditorContainer } from "../../../../components"; import { Button } from "../../../../shadcnui"; import { SectionHeader } from "../../../../components/typography"; import { HowToInterface } from "../../data/HowToInterface"; import { calculateReadingTime, extractHeadings } from "../../utils/blocknote"; type HowToCommandViewerProps = { howTo: HowToInterface; onBack: () => void; onStartChat?: () => void; }; export default function HowToCommandViewer({ howTo, onBack, onStartChat }: HowToCommandViewerProps) { const t = useTranslations(); const readingTime = useMemo(() => calculateReadingTime(howTo.description), [howTo.description]); const headings = useMemo(() => extractHeadings(howTo.description), [howTo.description]); return (
{/* Header with back button, title, and reading time */}
{howTo.name}
{t("howto.reading_time.label", { minutes: readingTime })}
{/* Two-column body */}
{/* Left sidebar - table of contents */} {headings.length > 0 && (
)} {/* Right content - scrollable */}
{/* Full-width footer */} {onStartChat && (
)}
); }