import { type Component, For, Show } from "solid-js"; import type { CommanderEntry } from "./types"; import { getResultClass } from "./hooks"; export interface CommanderEntriesProps { entries: () => CommanderEntry[]; onCommandClick?: (command: string) => void; loading?: boolean; error?: string; } export const CommanderEntries: Component = (props) => { let containerRef: HTMLDivElement | undefined; const handleCommandClick = (command: string) => { if (props.onCommandClick) { props.onCommandClick(command); } }; return (
0} fallback={
暂无命令执行记录
} > {(entry) => (
handleCommandClick(entry.command)} title="点击复制到输入框" > {entry.command} {entry.timestamp.toLocaleTimeString()}
{!entry.result.isHtml && entry.result.message}
)}
} >
{props.error}
} >
加载命令模板中...
); };