Skip to content

Commit

Permalink
chore: run yarn format
Browse files Browse the repository at this point in the history
  • Loading branch information
Chisomchima committed Dec 19, 2024
1 parent cc9a5ec commit 17487ae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/layout/FormFields.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import userSettingsKeyMapping from '../userSettingsMapping.js'
import AvatarEditor from './AvatarEditor.component.js'
import AppTheme from './theme.js'
import { VerifyEmail } from './VerifyEmail.component.js'
import VerifyEmailWarning from './VerifyEmailWarning.js'
import { VerifyEmailWarning } from './VerifyEmailWarning.js'

const styles = {
header: {
Expand Down
24 changes: 18 additions & 6 deletions src/layout/VerifyEmailWarning.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { useDataQuery } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import { NoticeBox } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'

const VerifyEmailWarning = ({ config }) => {
const enforceVerifiedEmail = config.system.settings.settings.enforceVerifiedEmail
const emailVerified = config.currentUser.emailVerified
export function VerifyEmailWarning({ config }) {
const enforceVerifiedEmail =
config?.system?.settings?.enforceVerifiedEmail || false
const emailVerified = config?.currentUser?.emailVerified || false

if (enforceVerifiedEmail && !emailVerified) {
return (
<div className='noticebox-wrapper'>
<div className="noticebox-wrapper">
<NoticeBox warning>
{i18n.t(
'Your email is not verified. Please verify your email to continue using the system.'
Expand All @@ -22,4 +23,15 @@ const VerifyEmailWarning = ({ config }) => {
return null
}

export default VerifyEmailWarning
VerifyEmailWarning.propTypes = {
config: PropTypes.shape({
currentUser: PropTypes.shape({
emailVerified: PropTypes.bool,
}),
system: PropTypes.shape({
settings: PropTypes.shape({
enforceVerifiedEmail: PropTypes.bool,
}),
}),
}).isRequired,
}

0 comments on commit 17487ae

Please sign in to comment.