diff --git a/src/components/Action/ActionBegin.tsx b/src/components/Action/ActionBegin.tsx index bc78aaf494ff2b3861e12de1b09cfca4247c4cf5..2fd6a04a13a17899e3ff1b7316e62196f4d34c66 100644 --- a/src/components/Action/ActionBegin.tsx +++ b/src/components/Action/ActionBegin.tsx @@ -3,7 +3,7 @@ import defaultIcon from 'assets/icons/visu/ecogesture/default.svg' import ActionModal from 'components/Action/ActionModal' import StarsContainer from 'components/Challenge/StarsContainer' import StyledIcon from 'components/CommonKit/Icon/StyledIcon' -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,7 +23,7 @@ const ActionBegin = ({ setShowList, userChallenge, }: ActionBeginProps) => { - const client: Client = useClient() + const client = useClient() const { t } = useI18n() const { global: { fluidTypes }, diff --git a/src/components/Action/ActionList.tsx b/src/components/Action/ActionList.tsx index a5cb263d1d6781a37abeb7df1371af425425d130..88c812afd9e5b94a86acd3fcc0f7acc742cad5e1 100644 --- a/src/components/Action/ActionList.tsx +++ b/src/components/Action/ActionList.tsx @@ -1,5 +1,5 @@ import ActionCard from 'components/Action/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/Analysis/ProfileComparator/ProfileComparator.tsx b/src/components/Analysis/ProfileComparator/ProfileComparator.tsx index c3c0cf07a8c92fe06141197ae46a294e0c893f9d..29ae370e40395e327ba1fa1a89fa5518dbd771fc 100644 --- a/src/components/Analysis/ProfileComparator/ProfileComparator.tsx +++ b/src/components/Analysis/ProfileComparator/ProfileComparator.tsx @@ -10,7 +10,7 @@ import AnalysisIcon from 'assets/icons/visu/analysis/analysis.svg' import PlaceHolderIcon from 'assets/icons/visu/analysis/no-profile-placeholder.svg' import StyledIcon from 'components/CommonKit/Icon/StyledIcon' import Loader from 'components/Loader/Loader' -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' import Icon from 'cozy-ui/transpiled/react/Icon' import { FluidType } from 'enums' @@ -33,8 +33,8 @@ const ProfileComparator = ({ performanceIndicators, }: ProfileComparatorProps) => { const { t } = useI18n() + const client = useClient() const navigate = useNavigate() - const client: Client = useClient() const userPriceConsumption: number = aggregatedPerformanceIndicator.value || 0 const { analysis: { analysisMonth }, diff --git a/src/components/Challenge/ChallengeCardOnGoing.tsx b/src/components/Challenge/ChallengeCardOnGoing.tsx index 828ef893fb7eb13cf4a58b440fd2fc431bbcaa14..44620c2d6cbfd2900479fa15db0e63fae4d32a30 100644 --- a/src/components/Challenge/ChallengeCardOnGoing.tsx +++ b/src/components/Challenge/ChallengeCardOnGoing.tsx @@ -8,7 +8,7 @@ import lockedDuel from 'assets/icons/visu/duel/locked.svg' import classNames from 'classnames' import StyledIcon from 'components/CommonKit/Icon/StyledIcon' import Loader from 'components/Loader/Loader' -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { UserActionState, @@ -33,8 +33,8 @@ const ChallengeCardOnGoing = ({ }: { userChallenge: UserChallenge }) => { - const client: Client = useClient() const { t } = useI18n() + const client = useClient() const navigate = useNavigate() const dispatch = useAppDispatch() const { diff --git a/src/components/Challenge/ChallengeCardUnlocked.tsx b/src/components/Challenge/ChallengeCardUnlocked.tsx index cfbda19fd4fb3832250fa93dfd5304ea55623ac4..c273f169189a70e5b42213de276a5cde4899ff07 100644 --- a/src/components/Challenge/ChallengeCardUnlocked.tsx +++ b/src/components/Challenge/ChallengeCardUnlocked.tsx @@ -1,7 +1,7 @@ import Button from '@material-ui/core/Button' import defaultIcon from 'assets/icons/visu/challenge/challengeLocked.svg' import StyledIcon from 'components/CommonKit/Icon/StyledIcon' -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { FluidState, UsageEventType } from 'enums' import { UserChallenge } from 'models' @@ -20,7 +20,7 @@ const ChallengeCardUnlocked = ({ userChallenge: UserChallenge }) => { const { t } = useI18n() - const client: Client = useClient() + const client = useClient() const { challenge: { currentChallenge }, global: { fluidTypes, fluidStatus }, diff --git a/src/components/Duel/DuelOngoing.tsx b/src/components/Duel/DuelOngoing.tsx index 337e45ce4131340db8eab29669155e3e22c8c90e..b57e15b5443eb55461494eb5f6fefb54e34f8585 100644 --- a/src/components/Duel/DuelOngoing.tsx +++ b/src/components/Duel/DuelOngoing.tsx @@ -6,7 +6,7 @@ import DuelChart from 'components/Duel/DuelChart' import DuelResultModal from 'components/Duel/DuelResultModal' import LastDuelModal from 'components/Duel/lastDuelModal' import { useChartResize } from 'components/Hooks/useChartResize' -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { UsageEventType, @@ -34,8 +34,8 @@ interface DuelOngoingProps { } const DuelOngoing = ({ userChallenge, isFinished }: DuelOngoingProps) => { - const client: Client = useClient() const { t } = useI18n() + const client = useClient() const { currentDataload, userChallengeList } = useAppSelector( state => state.ecolyo.challenge ) diff --git a/src/components/Duel/DuelUnlocked.tsx b/src/components/Duel/DuelUnlocked.tsx index cdbb6b726f6cd058c46f5e79c99dc2bf2c4d3af9..df8091f2e2c13c8b7c3f7b2099372fe8df3639a2 100644 --- a/src/components/Duel/DuelUnlocked.tsx +++ b/src/components/Duel/DuelUnlocked.tsx @@ -2,7 +2,7 @@ import Button from '@material-ui/core/Button' import defaultDuelIcon from 'assets/icons/visu/challenge/CHALLENGE0001.svg' import defaultIcon from 'assets/icons/visu/duel/default.svg' import StyledIcon from 'components/CommonKit/Icon/StyledIcon' -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 { UserChallenge } from 'models' @@ -16,7 +16,7 @@ import './duelUnlocked.scss' const DuelUnlocked = ({ userChallenge }: { userChallenge: UserChallenge }) => { const { t } = useI18n() - const client: Client = useClient() + const client = useClient() const dispatch = useAppDispatch() const [duelIcon, setDuelIcon] = useState(defaultIcon) diff --git a/src/components/Exploration/ExplorationFinished.tsx b/src/components/Exploration/ExplorationFinished.tsx index d17fb5e3cfe8237c058bae6a2dd05e41f1a3ad47..0ffced2e3584d29ddf8eedd977250d5a362c7424 100644 --- a/src/components/Exploration/ExplorationFinished.tsx +++ b/src/components/Exploration/ExplorationFinished.tsx @@ -1,7 +1,7 @@ import Button from '@material-ui/core/Button' import starResult from 'assets/icons/visu/quiz/starResult.svg' import StyledIcon from 'components/CommonKit/Icon/StyledIcon' -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { UsageEventType, @@ -24,7 +24,7 @@ interface ExplorationFinishedProps { const ExplorationFinished = ({ userChallenge }: ExplorationFinishedProps) => { const { t } = useI18n() - const client: Client = useClient() + const client = useClient() const dispatch = useAppDispatch() const navigate = useNavigate() diff --git a/src/components/Exploration/ExplorationOngoing.tsx b/src/components/Exploration/ExplorationOngoing.tsx index 142e4a660c520326aaa329b91983f716007914f8..d67c2a9ce17998696cf9253508811115a54d0944 100644 --- a/src/components/Exploration/ExplorationOngoing.tsx +++ b/src/components/Exploration/ExplorationOngoing.tsx @@ -2,7 +2,7 @@ import Button from '@material-ui/core/Button' import explorationIcon from 'assets/icons/visu/exploration/shield.svg' import StarsContainer from 'components/Challenge/StarsContainer' import StyledIcon from 'components/CommonKit/Icon/StyledIcon' -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { UsageEventType, @@ -25,7 +25,7 @@ interface ExplorationOngoingProps { const ExplorationOngoing = ({ userChallenge }: ExplorationOngoingProps) => { const { t } = useI18n() - const client: Client = useClient() + const client = useClient() const dispatch = useAppDispatch() const navigate = useNavigate() const startExploration = async () => { diff --git a/src/components/Feedback/FeedbackModal.tsx b/src/components/Feedback/FeedbackModal.tsx index 63daf5313be2f521415a9ccfc9741fd5a98ad4e9..cd464ec2521296a7660ca0f09cfd064336c9ce9d 100644 --- a/src/components/Feedback/FeedbackModal.tsx +++ b/src/components/Feedback/FeedbackModal.tsx @@ -5,9 +5,8 @@ import CloseIcon from 'assets/icons/ico/close.svg' import ecolyoIcon from 'assets/icons/ico/ecolyo.svg' import StyledIcon from 'components/CommonKit/Icon/StyledIcon' import useExploration from 'components/Hooks/useExploration' -import { Client, useClient } from 'cozy-client' -// what is the type ? -import { IuseI18n, useI18n } from 'cozy-ui/transpiled/react/I18n' +import { useClient } from 'cozy-client' +import { useI18n } from 'cozy-ui/transpiled/react/I18n' import Icon from 'cozy-ui/transpiled/react/Icon' import { UserExplorationID } from 'enums' import React from 'react' @@ -18,8 +17,8 @@ import './feedbackModal.scss' declare let __SAU_LINK__: string const FeedbackModal = () => { - const { t }: IuseI18n = useI18n() - const client: Client = useClient() + const { t } = useI18n() + const client = useClient() const dispatch = useAppDispatch() const { isFeedbacksOpen } = useAppSelector(state => state.ecolyo.modal) const [, setValidExploration] = useExploration() diff --git a/src/components/HalfHourNoData/HalfHourNoData.tsx b/src/components/HalfHourNoData/HalfHourNoData.tsx index c092103109d91c98ce47d26168de90998a4dd37e..9b88e93c8be5701cc0f803d608d9f5d0fe006258 100644 --- a/src/components/HalfHourNoData/HalfHourNoData.tsx +++ b/src/components/HalfHourNoData/HalfHourNoData.tsx @@ -1,9 +1,9 @@ -import { IuseI18n, useI18n } from 'cozy-ui/transpiled/react/I18n' +import { useI18n } from 'cozy-ui/transpiled/react/I18n' import React from 'react' import './halfHourNoData.scss' const HalfHourNoData = () => { - const { t }: IuseI18n = useI18n() + const { t } = useI18n() return ( <div className="halfHour"> <h2>{t('timestep.half_an_hour.gather_data_title')}</h2> diff --git a/src/components/Hooks/useExploration.tsx b/src/components/Hooks/useExploration.tsx index d661f6fd0e2121b6df392808132a10afef108450..36e9be442f8063e69ed96c2197606b11e3d87ad4 100644 --- a/src/components/Hooks/useExploration.tsx +++ b/src/components/Hooks/useExploration.tsx @@ -1,4 +1,4 @@ -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { UserExplorationState } from 'enums' import { UserExploration } from 'models' import { Dispatch, SetStateAction, useEffect, useState } from 'react' @@ -8,7 +8,7 @@ import { toggleChallengeExplorationNotification } from 'store/global/global.slic import { useAppDispatch, useAppSelector } from 'store/hooks' const useExploration = (): [string, Dispatch<SetStateAction<string>>] => { - const client: Client = useClient() + const client = useClient() const dispatch = useAppDispatch() const { currentChallenge } = useAppSelector(state => state.ecolyo.challenge) const exploration: UserExploration | null = currentChallenge diff --git a/src/components/Hooks/useKonnectorAuth.tsx b/src/components/Hooks/useKonnectorAuth.tsx index 86692e04ba9e1bde0f1c2bb19462aed23e4fb560..6f9bb70340706467392eb050078f7af4f9ae4f8f 100644 --- a/src/components/Hooks/useKonnectorAuth.tsx +++ b/src/components/Hooks/useKonnectorAuth.tsx @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/react' -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { FluidSlugType, UsageEventType } from 'enums' import { @@ -23,7 +23,7 @@ const useKonnectorAuth = ( login?: string, password?: string ): [() => Promise<null | undefined>, () => Promise<void>, string] => { - const client: Client = useClient() + const client = useClient() const { t } = useI18n() const dispatch = useAppDispatch() const konnectorSlug: FluidSlugType = diff --git a/src/components/Options/Version/Version.tsx b/src/components/Options/Version/Version.tsx index 151b8189fb13023d79fa2aff723f78d4e15ae65f..5d74881e09fb6244817a47238d4d02666e9a1425 100644 --- a/src/components/Options/Version/Version.tsx +++ b/src/components/Options/Version/Version.tsx @@ -1,9 +1,9 @@ -import { Client, useClient } from 'cozy-client' +import { useClient } from 'cozy-client' import React from 'react' import './version.scss' const Version = () => { - const client: Client = useClient() + const client = useClient() return ( <div className="version-root text-14-normal"> {`v ${client.appMetadata.version}`} diff --git a/src/components/Quiz/QuizBegin.tsx b/src/components/Quiz/QuizBegin.tsx index bf7e52aa4f47c0f4526d1226eca06bab57cf458f..d4efb4d0ae49dc06c6f6accaf33b56cb54c1436b 100644 --- a/src/components/Quiz/QuizBegin.tsx +++ b/src/components/Quiz/QuizBegin.tsx @@ -2,7 +2,7 @@ import Button from '@material-ui/core/Button' import quizIcon from 'assets/icons/visu/quiz/questionMark.svg' import StarsContainer from 'components/Challenge/StarsContainer' import StyledIcon from 'components/CommonKit/Icon/StyledIcon' -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,7 +13,7 @@ import { useAppDispatch } from 'store/hooks' import './quizBegin.scss' const QuizBegin = ({ userChallenge }: { userChallenge: UserChallenge }) => { - const client: Client = useClient() + const client = useClient() const { t } = useI18n() const dispatch = useAppDispatch() const launchQuiz = async () => { diff --git a/src/components/Quiz/QuizCustomQuestionContent.tsx b/src/components/Quiz/QuizCustomQuestionContent.tsx index 98b8c161c7c648504edee38d8f35a80ee672ea49..004ff688312bb209a7fa6c794a72bd7ce3ba12f5 100644 --- a/src/components/Quiz/QuizCustomQuestionContent.tsx +++ b/src/components/Quiz/QuizCustomQuestionContent.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' -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 QuizCustomQuestionContent = ({ isLoading, }: QuizCustomQuestionContent) => { const { t } = useI18n() - const client: Client = useClient() + const client = useClient() const dispatch = useAppDispatch() const [userChoice, setUserChoice] = useState<string>('') diff --git a/src/components/Quiz/QuizFinish.tsx b/src/components/Quiz/QuizFinish.tsx index 029ee4c52e37fbb2f38c9d0fe2e7de72ab57d89b..7ffc1162e96772ce6c8703f7a46dc47256a8d2ef 100644 --- a/src/components/Quiz/QuizFinish.tsx +++ b/src/components/Quiz/QuizFinish.tsx @@ -1,7 +1,7 @@ import Button from '@material-ui/core/Button' import starResult from 'assets/icons/visu/quiz/starResult.svg' import StyledIcon from 'components/CommonKit/Icon/StyledIcon' -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' @@ -14,7 +14,7 @@ import './quizFinish.scss' const QuizFinish = ({ userChallenge }: { userChallenge: UserChallenge }) => { const { t } = useI18n() - const client: Client = useClient() + const client = useClient() const navigate = useNavigate() const dispatch = useAppDispatch() const challengeService: ChallengeService = useMemo( diff --git a/src/components/Quiz/QuizQuestion.tsx b/src/components/Quiz/QuizQuestion.tsx index fb4704664b68035a58ab7b16ff36a40eb2fefae5..bd2feb8ca0a5798827c7d9209ba069a97ed55cc9 100644 --- a/src/components/Quiz/QuizQuestion.tsx +++ b/src/components/Quiz/QuizQuestion.tsx @@ -1,6 +1,6 @@ import QuizCustomQuestionContent from 'components/Quiz/QuizCustomQuestionContent' import QuizQuestionContent from 'components/Quiz/QuizQuestionContent' -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 { useAppSelector } from 'store/hooks' import './quizQuestion.scss' const QuizQuestion = ({ userChallenge }: { userChallenge: UserChallenge }) => { + const client = useClient() + const navigate = useNavigate() + const { fluidTypes } = useAppSelector(state => state.ecolyo.global) 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/QuizQuestionContent.tsx b/src/components/Quiz/QuizQuestionContent.tsx index 93c0ddf2022383f4ceabe3e2cc46662c2e04da9f..fb45ffb81ba3dff6a5f71d159227df1e0af4b21a 100644 --- a/src/components/Quiz/QuizQuestionContent.tsx +++ b/src/components/Quiz/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' -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