import type { ReactNode, RefObject } from "react"; import type { DocKind, DocumentInfo } from "#office/contract.ts"; import type { Strings } from "#ui/i18n.ts"; import { Icon } from "#ui/icons.tsx"; import { baseName } from "#ui/rpc.ts"; import { ErrorState, Skeleton } from "#ui/shell/panes.tsx"; import type { Failure } from "#ui/shell/state.ts"; /** * 内联(对话内嵌)模式的面板:只读预览,点击任意处切到侧栏全屏。 * 从 main.tsx 的 Shell 拆出以控制单文件规模;查看器元素与各 ref 仍由 Shell 持有并传入。 */ export function InlineShell({ appRef, canvasRef, t, path, info, kind, showSkeleton, failure, nothing, onExpand, children, }: { appRef: RefObject; canvasRef: RefObject; t: Strings; path: string | null; info: DocumentInfo | undefined; kind: DocKind | null; showSkeleton: boolean; failure: Failure | null; nothing: boolean; onExpand(): void; children: ReactNode; }) { return (
{path ? baseName(path) : t.title} {info && t.meta[info.kind](info.units) ? ( {t.meta[info.kind](info.units)} ) : null}
{children} {showSkeleton ? : null} {failure ? ( ) : null} {nothing ?
{t.openTitle}
: null}
); }