import { Component, For, Show } from "solid-js" import { FileIcon } from "@opencode-ai/ui/file-icon" import { IconButton } from "@opencode-ai/ui/icon-button" import { Tooltip } from "@opencode-ai/ui/tooltip" import { getDirectory, getFilename, getFilenameTruncated } from "@opencode-ai/util/path" import type { ContextItem } from "@/context/prompt" type PromptContextItem = ContextItem & { key: string } type ContextItemsProps = { items: PromptContextItem[] active: (item: PromptContextItem) => boolean openComment: (item: PromptContextItem) => void remove: (item: PromptContextItem) => void t: (key: string) => string } export const PromptContextItems: Component = (props) => { return ( 0}>
{(item) => ( {getDirectory(item.path)} {getFilename(item.path)} } placement="top" openDelay={2000} >
props.openComment(item)} >
{getFilenameTruncated(item.path, 14)} {(sel) => ( {sel().startLine === sel().endLine ? `:${sel().startLine}` : `:${sel().startLine}-${sel().endLine}`} )}
{ e.stopPropagation() props.remove(item) }} aria-label={props.t("prompt.context.removeFile")} />
{(comment) =>
{comment()}
}
)}
) }