// Dependencies import { linkClasses } from '@freesewing/utils' // Context import { LoadingStatusContext } from '@freesewing/react/context/LoadingStatus' import { ModalContext } from '@freesewing/react/context/Modal' // Hooks import React, { useContext } from 'react' import { useAccount } from '@freesewing/react/hooks/useAccount' import { useBackend } from '@freesewing/react/hooks/useBackend' // Components import { Link as WebLink } from '@freesewing/react/components/Link' import { BackIcon, NoIcon } from '@freesewing/react/components/Icon' import { IconButton } from '@freesewing/react/components/Button' import { ModalWrapper } from '@freesewing/react/components/Modal' /** * A component to manage the user's options to restrict processing of their data * * @component * @param {object} props - All component props * @param {React.Component} props.Link - A framework specific Link component for client-side routing * @returns {JSX.Element} */ export const Restrict = ({ Link = false }) => { if (!Link) Link = WebLink // Hooks const backend = useBackend() const { signOut, account } = useAccount() // Context const { setLoadingStatus } = useContext(LoadingStatusContext) const { setModal, clearModal } = useContext(ModalContext) // Helper method to restrict the account const restrictAccount = async () => { setLoadingStatus([true, 'Talking to the backend']) const [status] = await backend.restrictAccount() if (status === 200) { setLoadingStatus([true, 'Done. Consider yourself restrcited.', true, true]) signOut() } else setLoadingStatus([true, 'An error occured. Please report this', true, false]) } if (account.control === 5) return ( <>

This button is red for a reason.

Remove your FreeSewing account ) return (

The GDPR guarantees{' '} your right to restrict processing {' '} of your personal data.

This will disable your account, but not remove any data.

setModal(

Proceed with caution

While no data will be removed, this will disable your account. Furthermore, you can not undo this on your own, but will have to contact support when you want to restore access to your account.

Restrict processing of your FreeSewing data Back to safety
) } > Restrict processing of your FreeSewing data
) }