import { useContext } from "react";
import { EditorType } from "types/editor";
import { SHAPES } from "components/svg/shapes";
import classNames from "classnames";
import { Empty } from "@/components/empty";
import { useUser } from "@/utils/auth";
import { ShapeSelected } from "./shape-selected";
import { PremiumContext } from "@/components/premium/premium";
import { FormattedMessage, useIntl } from "react-intl";
export const Shapes = ({
editor,
onChange,
}: {
editor: EditorType;
onChange: (s: any) => void;
}) => {
const { user } = useUser();
const intl = useIntl();
const { setOpen } = useContext(PremiumContext);
return (
<>
{SHAPES.map((shape, k) => (
{
// if (!user && shape?.isPremium) {
// return setOpen(true);
// }
onChange({ ...editor.shape, component: shape?.name });
}}
>
{/* {shape?.isPremium && (
)} */}
<_ShapeComponent
component={shape.component}
width={28}
height={28}
shape={shape}
/>
))}
{editor.shape?.component ? (
onChange({ ...editor.shape, ...shape })}
onDelete={() => onChange({ ...editor.shape, component: null })}
/>
) : (
onStep(0)}>Add my first Icon}
/>
)}
>
);
};
const _ShapeComponent = ({ component, shape, onClick, ...props }: any) => {
const ShapeComponent = component as any;
const newShape = {
...shape,
component: `${shape.name}-small`,
};
return ;
};