import React from 'react'; import { observer } from 'mobx-react-lite'; import cn from 'classnames'; import { ItemMenu } from 'UI'; import { useStore } from 'App/mstore'; import { useHistory } from 'react-router'; import { toast } from 'react-toastify'; import { fflags, withSiteId } from 'App/routes'; import { Button } from 'antd'; import { useTranslation } from 'react-i18next'; function Header({ current, onCancel, onSave, isNew, siteId }: any) { const { t } = useTranslation(); const { featureFlagsStore } = useStore(); const history = useHistory(); const deleteHandler = () => { featureFlagsStore.deleteFlag(current.featureFlagId).then(() => { toast.success(t('Feature flag deleted.')); history.push(withSiteId(fflags(), siteId)); }); }; const menuItems = [ { icon: 'trash', text: t('Delete'), onClick: deleteHandler }, ]; return ( <>

{!current.flagKey ? t('New Feature Flag') : current.flagKey}

{!isNew ? : null}
); } export default observer(Header);