import {useContext} from "react"
import {MdLock} from "react-icons/md"
import {Link as RouterLink} from "react-router-dom"
import {useTranslation} from "react-i18next"
import {Button, Grid, Typography, useTheme} from "@mui/material"
import {LockNavigationContext} from "../LockNavigation"
import {AuthContext, EncryptionStatus} from "../AuthContext"
export interface WithEncryptionRequiredProps {
children?: JSX.Element
}
export default function DecryptionPasswordMissingAlert({
children = <>>,
}: WithEncryptionRequiredProps): JSX.Element {
const {t} = useTranslation()
const {handleAnchorClick} = useContext(LockNavigationContext)
const {encryptionStatus} = useContext(AuthContext)
const theme = useTheme()
switch (encryptionStatus) {
case EncryptionStatus.Unavailable: {
return (
{t("components.DecryptionPasswordMissingAlert.unavailable.title")}
{t("components.DecryptionPasswordMissingAlert.unavailable.description")}
}
onClick={handleAnchorClick}
>
{t(
"components.DecryptionPasswordMissingAlert.unavailable.continueAction",
)}
)
}
case EncryptionStatus.PasswordRequired: {
return (
{t("components.DecryptionPasswordMissingAlert.passwordRequired.title")}
{t(
"components.DecryptionPasswordMissingAlert.passwordRequired.description",
)}
}
onClick={handleAnchorClick}
>
{t(
"components.DecryptionPasswordMissingAlert.passwordRequired.continueAction",
)}
)
}
default:
return children
}
}