import { KEYS } from "./keys"; // We inline font-awesome icons in order to save on js size rather than including the font awesome react library export const SHAPES = [ { icon: ( // fa-mouse-pointer ), value: "selection", key: KEYS.V, }, { icon: ( // fa-square ), value: "rectangle", key: KEYS.R, }, { icon: ( // custom ), value: "diamond", key: KEYS.D, }, { icon: ( // fa-circle ), value: "ellipse", key: KEYS.O, }, { icon: ( // fa-long-arrow-alt-right ), value: "arrow", key: KEYS.A, }, { icon: ( // custom ), value: "line", key: [KEYS.P, KEYS.L], }, { icon: ( // fa-pencil ), value: "freedraw", key: [KEYS.X, KEYS.P.toUpperCase()], }, { icon: ( // fa-font ), value: "text", key: KEYS.T, }, { icon: ( // fa-image ), value: "image", key: null, }, ] as const; export const findShapeByKey = (key: string) => { const shape = SHAPES.find((shape, index) => { return ( key === (index + 1).toString() || (shape.key && (typeof shape.key === "string" ? shape.key === key : (shape.key as readonly string[]).includes(key))) ); }); return shape?.value || null; };