/** * @file convert.tsx * * @summary Raycast command to convert selected images between various formats. * * Created at : 2023-07-06 14:53:25 * Last modified : 2023-07-06 15:47:53 */ import { Action, ActionPanel, getPreferenceValues, Icon, List, openCommandPreferences } from "@raycast/api"; import convert from "./operations/convertOperation"; import { getSelectedImages } from "./utilities/utils"; import { ConvertPreferences, ExtensionPreferences } from "./utilities/preferences"; import runOperation from "./operations/runOperation"; /** * All supported image formats for conversion. */ const FORMATS = [ "WEBP", "ASTC", "BMP", "DDS", "EXR", "GIF", "HEIC", "HEICS", "ICNS", "ICO", "JPEG", "JP2", "KTX", "PBM", "PDF", "PNG", "PSD", "PVR", "TGA", "TIFF", "SVG", ]; export default function Command() { const preferences = getPreferenceValues(); const enabledFormats = FORMATS.filter((format) => preferences[`show${format}`]); console.log("nik here????"); return ( await openCommandPreferences()} shortcut={{ modifiers: ["cmd", "shift"], key: "," }} /> } /> {enabledFormats.map((format) => { return ( { const selectedImages = await getSelectedImages(); await runOperation({ operation: () => convert(selectedImages, format), selectedImages, inProgressMessage: "Conversion in progress...", successMessage: "Converted", failureMessage: "Failed to convert", }); }} /> } /> ); })} ); }