From e6d9bb0a48718e4e9fb0b131cae682876c91aa22 Mon Sep 17 00:00:00 2001 From: Bastien DUMONT <bdumont@grandlyon.com> Date: Tue, 22 Aug 2023 08:05:06 +0000 Subject: [PATCH] chore: remove explicit types --- src/components/Action/ActionBegin.tsx | 4 ++-- src/components/Action/ActionList.tsx | 4 ++-- .../Analysis/ProfileComparator/ProfileComparator.tsx | 4 ++-- src/components/Challenge/ChallengeCardOnGoing.tsx | 4 ++-- src/components/Challenge/ChallengeCardUnlocked.tsx | 4 ++-- src/components/Duel/DuelOngoing.tsx | 4 ++-- src/components/Duel/DuelUnlocked.tsx | 4 ++-- src/components/Exploration/ExplorationFinished.tsx | 4 ++-- src/components/Exploration/ExplorationOngoing.tsx | 4 ++-- src/components/Feedback/FeedbackModal.tsx | 9 ++++----- src/components/HalfHourNoData/HalfHourNoData.tsx | 4 ++-- src/components/Hooks/useExploration.tsx | 4 ++-- src/components/Hooks/useKonnectorAuth.tsx | 4 ++-- src/components/Options/Version/Version.tsx | 4 ++-- src/components/Quiz/QuizBegin.tsx | 4 ++-- src/components/Quiz/QuizCustomQuestionContent.tsx | 4 ++-- src/components/Quiz/QuizFinish.tsx | 4 ++-- src/components/Quiz/QuizQuestion.tsx | 8 ++++---- src/components/Quiz/QuizQuestionContent.tsx | 4 ++-- 19 files changed, 42 insertions(+), 43 deletions(-) diff --git a/src/components/Action/ActionBegin.tsx b/src/components/Action/ActionBegin.tsx index bc78aaf49..2fd6a04a1 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 a5cb263d1..88c812afd 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 c3c0cf07a..29ae370e4 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 828ef893f..44620c2d6 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 cfbda19fd..c273f1691 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 337e45ce4..b57e15b54 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 cdbb6b726..df8091f2e 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 d17fb5e3c..0ffced2e3 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 142e4a660..d67c2a9ce 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 63daf5313..cd464ec25 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 c09210310..9b88e93c8 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 d661f6fd0..36e9be442 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 86692e04b..6f9bb7034 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 151b8189f..5d74881e0 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 bf7e52aa4..d4efb4d0a 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 98b8c161c..004ff6883 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 029ee4c52..7ffc1162e 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 fb4704664..bd2feb8ca 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 93c0ddf20..fb45ffb81 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 -- GitLab