diff --git a/packages/web/components/templates/ExportDataForm.tsx b/packages/web/components/templates/ExportDataForm.tsx new file mode 100644 index 0000000000..46567ec606 --- /dev/null +++ b/packages/web/components/templates/ExportDataForm.tsx @@ -0,0 +1,51 @@ +import { useState } from 'react' +import { showErrorToast, showSuccessToast } from '../../lib/toastHelpers' +import { Button } from '../elements/Button' + +export function ExportDataButton(): JSX.Element { + const [disabledState, setDisabledState] = useState(false) + + const handleExportClick = async () => { + setDisabledState(true) + + try { + // Make a GET request to the /export endpoint + const response = await fetch('/api/export', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + }) + + if (!response.ok) { + throw new Error('Failed to fetch export data') + } + } catch (error) { + console.error('Error exporting data:', error) + showErrorToast('Failed to export data') + + setDisabledState(false) + return + } + + showSuccessToast( + 'Started exporting data. You will receive an email shortly.' + ) + } + + return ( + + ) +} diff --git a/packages/web/pages/account-archived.tsx b/packages/web/pages/account-archived.tsx new file mode 100644 index 0000000000..01508aae75 --- /dev/null +++ b/packages/web/pages/account-archived.tsx @@ -0,0 +1,16 @@ +import { VStack } from '../components/elements/LayoutPrimitives' +import { ExportDataButton } from '../components/templates/ExportDataForm' + +export default function AccountArchivedPage(): JSX.Element { + return ( + +

Your account has been archived

+

+ Your account has been archived. If you would like to reactivate your + account, please contact support. +

+ + +
+ ) +}