import { Action, ActionPanel, Icon, List, closeMainWindow, showHUD } from "@raycast/api"; import { Command, Device, Platform } from "./types"; import { getDeviceIcon } from "./utils"; import { executeCommand, launchDevice } from "./actions"; interface Props { name: string; platform: Platform; commands: Command[]; devices?: Device[]; } const DeviceList = ({ commands, devices, name, platform }: Props) => { return ( {devices?.map(({ name, ID, booted, displayName }) => ( { launchDevice(name); closeMainWindow(); }} /> {commands.map((command) => { if (command.needBootedDevice && !booted) return null; if (command?.bootsDevice && booted) return null; return ( { executeCommand(command, name, ID ?? ""); showHUD(`${command.name} ✅`); closeMainWindow(); }} /> ); })} } /> ))} ); }; export default DeviceList;