import React from "react" import { Edit, Trash2 } from "lucide-react" import type { Command } from "@roo-code/types" import { useAppTranslation } from "@/i18n/TranslationContext" import { Button, StandardTooltip } from "@/components/ui" import { vscode } from "@/utils/vscode" interface SlashCommandItemProps { command: Command onDelete: (command: Command) => void onClick?: (command: Command) => void } export const SlashCommandItem: React.FC = ({ command, onDelete, onClick }) => { const { t } = useAppTranslation() // Built-in commands cannot be edited or deleted const isBuiltIn = command.source === "built-in" const handleEdit = () => { if (command.filePath) { vscode.postMessage({ type: "openFile", text: command.filePath, }) } else { // Fallback: request to open command file by name and source vscode.postMessage({ type: "openCommandFile", text: command.name, values: { source: command.source }, }) } } const handleDelete = () => { onDelete(command) } return (
{/* Command name - clickable */}
onClick?.(command)}>
{command.name} {command.description && (
{command.description}
)}
{/* Action buttons - only show for non-built-in commands */} {!isBuiltIn && (
)}
) }