diff --git a/src/components/Action/ActionBegin/ActionBegin.tsx b/src/components/Action/ActionBegin/ActionBegin.tsx index c2a39a4a75c3bbb6cc19f34611bad7e687b4523a..8394e17962bcd1cc02feb4b7ff0cc8baf84fa9f8 100644 --- a/src/components/Action/ActionBegin/ActionBegin.tsx +++ b/src/components/Action/ActionBegin/ActionBegin.tsx @@ -3,7 +3,7 @@ import defaultIcon from 'assets/icons/visu/ecogesture/default.svg' import ActionModal from 'components/Action/ActionModal/ActionModal' import StyledIcon from 'components/CommonKit/Icon/StyledIcon' import StarsContainer from 'components/CommonKit/StarsContainer/StarsContainer' -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { Ecogesture, UserChallenge } from 'models' import React, { useCallback, useEffect, useState } from 'react' @@ -23,8 +23,8 @@ const ActionBegin = ({ setShowList, userChallenge, }: ActionBeginProps) => { - const client: Client = useClient() const { t } = useI18n() + const client = useClient() const { global: { fluidTypes }, profile: { isProfileTypeCompleted }, diff --git a/src/components/Action/ActionList/ActionList.tsx b/src/components/Action/ActionList/ActionList.tsx index a9ff78bb19ceecae75a24f23cd949fcb92aef6f1..b79e28bc2c2ebf569577c2506278007f063d01a9 100644 --- a/src/components/Action/ActionList/ActionList.tsx +++ b/src/components/Action/ActionList/ActionList.tsx @@ -1,5 +1,5 @@ import ActionCard from 'components/Action/ActionCard/ActionCard' -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { Ecogesture } from 'models' import React, { useEffect, useState } from 'react' import ActionService from 'services/action.service' @@ -12,7 +12,7 @@ interface ActionListProps { } const ActionList = ({ setSelectedAction, setShowList }: ActionListProps) => { - const client: Client = useClient() + const client = useClient() const { global: { fluidTypes }, profile: { isProfileTypeCompleted }, diff --git a/src/components/Quiz/QuizBegin/QuizBegin.tsx b/src/components/Quiz/QuizBegin/QuizBegin.tsx index ee0a1bf83a4454f60ea1cee55f830dac1cd50341..55b3b01a24b2c736ebcd493af72ef7512561318e 100644 --- a/src/components/Quiz/QuizBegin/QuizBegin.tsx +++ b/src/components/Quiz/QuizBegin/QuizBegin.tsx @@ -2,7 +2,7 @@ import Button from '@material-ui/core/Button' import quizIcon from 'assets/icons/visu/quiz/questionMark.svg' import StyledIcon from 'components/CommonKit/Icon/StyledIcon' import StarsContainer from 'components/CommonKit/StarsContainer/StarsContainer' -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { UserChallengeUpdateFlag } from 'enums' import { UserChallenge } from 'models' @@ -13,8 +13,8 @@ import { useAppDispatch } from 'store/hooks' import './quizBegin.scss' const QuizBegin = ({ userChallenge }: { userChallenge: UserChallenge }) => { - const client: Client = useClient() const { t } = useI18n() + const client = useClient() const dispatch = useAppDispatch() const launchQuiz = async () => { const challengeService: ChallengeService = new ChallengeService(client) diff --git a/src/components/Quiz/QuizQuestion/QuizQuestion.tsx b/src/components/Quiz/QuizQuestion/QuizQuestion.tsx index f8f13cc7245f9619ecc00e1330021d8edc22e6ae..25ff5662bdd27baa282c522037a2e2178f939c50 100644 --- a/src/components/Quiz/QuizQuestion/QuizQuestion.tsx +++ b/src/components/Quiz/QuizQuestion/QuizQuestion.tsx @@ -1,4 +1,4 @@ -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { QuestionEntity, UserChallenge } from 'models' import React, { useEffect, useState } from 'react' import { useNavigate } from 'react-router-dom' @@ -9,6 +9,9 @@ import QuizQuestionContentCustom from './QuizQuestionContentCustom' import './quizQuestion.scss' const QuizQuestion = ({ userChallenge }: { userChallenge: UserChallenge }) => { + const client = useClient() + const { fluidTypes } = useAppSelector(state => state.ecolyo.global) + const navigate = useNavigate() const questionsIsLocked: boolean = userChallenge.quiz.questions.some( answer => answer.result == 0 ) @@ -18,9 +21,6 @@ const QuizQuestion = ({ userChallenge }: { userChallenge: UserChallenge }) => { ) const [customQuestionLoading, setCustomQuestionLoading] = useState<boolean>(false) - const client: Client = useClient() - const { fluidTypes } = useAppSelector(state => state.ecolyo.global) - const navigate = useNavigate() const goBack = () => { navigate('/challenges') diff --git a/src/components/Quiz/QuizQuestion/QuizQuestionContent.tsx b/src/components/Quiz/QuizQuestion/QuizQuestionContent.tsx index d26f33bdf25806fbd65d662ea7880aefede3d37e..e96369c03653865e3f09eb445e3392c19267b0c3 100644 --- a/src/components/Quiz/QuizQuestion/QuizQuestionContent.tsx +++ b/src/components/Quiz/QuizQuestion/QuizQuestionContent.tsx @@ -2,7 +2,7 @@ import Button from '@material-ui/core/Button' import CloseIcon from 'assets/icons/ico/close.svg' import StyledIconButton from 'components/CommonKit/IconButton/StyledIconButton' import QuizExplanationModal from 'components/Quiz/QuizExplanationModal/QuizExplanationModal' -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { UserChallengeUpdateFlag } from 'enums' import { Answer, UserChallenge, UserQuiz } from 'models' @@ -25,7 +25,7 @@ const QuizQuestionContent = ({ goBack, }: QuizQuestionContent) => { const { t } = useI18n() - const client: Client = useClient() + const client = useClient() const dispatch = useAppDispatch() const questionIndexLocked = userChallenge.quiz.questions.findIndex( answer => answer.result == 0 diff --git a/src/components/Quiz/QuizQuestion/QuizQuestionContentCustom.tsx b/src/components/Quiz/QuizQuestion/QuizQuestionContentCustom.tsx index dc55ae0a7c5bbf1d27d927f5419f4b26e739b256..88a3448503646cf14d0a58a97cf7b6925a5b8e8c 100644 --- a/src/components/Quiz/QuizQuestion/QuizQuestionContentCustom.tsx +++ b/src/components/Quiz/QuizQuestion/QuizQuestionContentCustom.tsx @@ -3,7 +3,7 @@ import CloseIcon from 'assets/icons/ico/close.svg' import StyledIconButton from 'components/CommonKit/IconButton/StyledIconButton' import Loader from 'components/Loader/Loader' import QuizExplanationModal from 'components/Quiz/QuizExplanationModal/QuizExplanationModal' -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { UsageEventType, UserChallengeUpdateFlag } from 'enums' import { Answer, QuestionEntity, UserChallenge, UserQuiz } from 'models' @@ -29,7 +29,7 @@ const QuizQuestionContentCustom = ({ isLoading, }: QuizQuestionContentCustomProps) => { const { t } = useI18n() - const client: Client = useClient() + const client = useClient() const dispatch = useAppDispatch() const [userChoice, setUserChoice] = useState<string>('')