import { useState } from 'react' import { useTranslation } from 'next-i18next' import { Popout } from 'shared/components/popout.mjs' import { WebLink } from 'shared/components/web-link.mjs' import { exportTypes, handleExport } from './export-handler.mjs' export const ExportDraft = ({ gist, design, app }) => { const [link, setLink] = useState(false) const [error, setError] = useState(false) const [format, setFormat] = useState(false) const { t } = useTranslation(['app', 'plugin']) const doExport = (format) => { setLink(false) setError(false) setFormat(format) handleExport( format, gist, design, t, app, (e) => { if (e.data.link) { setLink(e.data.link) } }, (e) => { if (e.data?.error) { setError(true) } } ) } return (
{t('exportPattern-txt')}
{link && (