import { useState } from 'react'; import { Badge } from '#/components/atoms/badge.jsx'; import { Button } from '#/components/atoms/button.jsx'; import { Heading } from '#/components/atoms/heading.jsx'; import { Panel } from '#/components/atoms/panel.jsx'; import { ErrorNotice } from '#/components/molecules/error-notice.jsx'; import { post } from '#/lib/api.js'; import { queryKeys, useApiMutation } from '#/lib/query.js'; export function AccountStatusCard({ status, readOnly }) { const [active, setActive] = useState(status === 'active'); const action = useApiMutation([queryKeys.identity, queryKeys.overview]); const toggle = () => action.run(async () => { await post('/status', { action: active ? 'deactivate' : 'activate' }); setActive((value) => !value); }); return (
Account status
{active ? 'active' : 'paused'}

{active ? 'Apps can read and write your data. Pausing hides everything from the network without deleting it, and you can turn it back on any time.' : 'Your account is hidden from every app and from the network. Nothing has been deleted.'}

{!readOnly && ( )} ); }