"use client"; import Link from "next/link"; import type { RefObject } from "react"; import { BookMarked, ClipboardCheck, FileText, Maximize2, MessagesSquare, Minimize2, Square, } from "lucide-react"; import { ThinkingIndicator } from "@/components/ThinkingIndicator"; import { Button } from "@/components/ui/Button"; import type { useAutosave } from "@/lib/autosave/useAutosave"; import { friendlyError } from "@/lib/errors/messages"; import { buttonClass } from "@/lib/ui/variants"; import { CONTEXT_DRAWER_ENABLED } from "./ContextDrawer"; import { AI_CONVERSATION_ENABLED } from "./AiConversationDrawer"; // 写章失败提示:友好文案(不暴露 raw code)+ 可选「去设置」动作(F4)。 function StreamErrorNote({ streamError, }: { streamError: { code: string; message: string }; }) { const friendly = friendlyError(streamError.code, streamError.message); return (
{friendly.text} {friendly.actionHref ? ( <> {" "} {friendly.actionLabel} > ) : null}
); } // 专注写作开关(P3-4):图标按钮,进入=隐藏左侧图标导航 + 目录 TOC 加宽正文,退出还原。 // aria-pressed 表状态、aria-label 表动作,键盘可达(复用共享 Button 焦点环)。 function FocusToggle({ focus, onToggle, }: { focus: boolean; onToggle: () => void; }) { return ( ); } // 底栏(P1-1 瘦身 + P3-6 分区):按「信息 | 操作 | 状态」三区排布。 // 信息=字数/生成中;操作=速查/对话记录/审稿/专注(+流式时的「停」);状态=保存态(右侧)。 interface ToolbarProps { projectId: string; chapterNo: number; wordCount: number; savedLabel: string | null; saveStatus: ReturnType