Newer
Older
import Button from '@material-ui/core/Button'
import Dialog from '@material-ui/core/Dialog'
import chronoMini from 'assets/icons/visu/action/chrono-mini.svg'
import { useClient } from 'cozy-client'
import { useI18n } from 'cozy-ui/transpiled/react/I18n'
import { UserChallengeUpdateFlag } from 'enums'
import ChallengeService from 'services/challenge.service'
import { updateUserChallengeList } from 'store/challenge/challenge.slice'
import { useAppDispatch } from 'store/hooks'
action: Ecogesture
handleCloseClick: () => void
userChallenge: UserChallenge
}
action,
handleCloseClick,
userChallenge,
}: ActionModalProps) => {
const client = useClient()
const launchAction = useCallback(async () => {
const challengeService = new ChallengeService(client)
const updatedChallenge: UserChallenge =
await challengeService.updateUserChallenge(
userChallenge,
UserChallengeUpdateFlag.ACTION_START,
undefined,
undefined,
action
)
<Dialog
open={open}
onClose={handleCloseClick}
aria-labelledby="accessibility-title"
classes={{
root: 'modal-root',
paper: 'modal-paper',
}}
>
<div id="accessibility-title">
{t('action_modal.accessibility.window_title')}
</div>
<div className="action-title text-16-normal">
{t('action.duration', {
smartCount: action.actionDuration,
})}
</div>
<div className="action-text text-16-normal">{action.longName}</div>
<div className="buttons">
<Button
aria-label={t('action_modal.accessibility.button_accept')}
classes={{
root: 'btn-secondary-negative',
label: 'text-16-normal',
}}
onClick={launchAction}
>
aria-label={t('action_modal.accessibility.button_refuse')}
classes={{
root: 'btn-secondary-negative',
label: 'text-16-normal',
}}
onClick={handleCloseClick}
>