import { Modal, Radio } from 'antd'; import { useState } from 'react'; import { PlusOutlined } from '@ant-design/icons'; import { Layout, usePlugin } from 'flipper-plugin'; import React from 'react'; import { plugin } from '../..'; import { PropertiesModify } from './PropertiesModify'; import { DeserializedRealmObject, SortedObjectSchema } from '../../CommonTypes'; type PropertyType = { schema: SortedObjectSchema; }; const emptyRealmObject: DeserializedRealmObject = { realmObject: {} }; export const ObjectAdd = ({ schema }: PropertyType) => { const { addObject } = usePlugin(plugin); const [values, setValues] = useState(emptyRealmObject); const [visible, setVisible] = useState(false); const showModal = () => { setValues(emptyRealmObject); setVisible(true); }; const hideModal = () => { setValues(emptyRealmObject); setVisible(false); }; const onOk = () => { if (!values) { return; } addObject(values.realmObject); hideModal(); }; if (!schema || !values) { return <>; } return ( {} Create {schema.name} ); };