fix(client): import TFunction from i18next in profile componenets (#49814)

* fix(client): import TFunction from i18next

* Import Tfunction as type

* swap tFuntion with the hook when possilbe
This commit is contained in:
Muhammed Mustafa
2023-03-30 17:28:14 +02:00
committed by GitHub
parent c410a2cae7
commit b67a82ff0a
6 changed files with 12 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
import React, { ReactNode, useEffect } from 'react';
import Helmet from 'react-helmet';
import { TFunction, withTranslation } from 'react-i18next';
import { useTranslation, withTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import { bindActionCreators, Dispatch } from 'redux';
import { createSelector } from 'reselect';
@@ -104,7 +104,6 @@ interface DefaultLayoutProps extends StateProps, DispatchProps {
block?: string;
showCodeAlly: boolean;
superBlock?: string;
t: TFunction;
}
const getSystemTheme = () =>
@@ -127,13 +126,13 @@ function DefaultLayout({
isChallenge = false,
block,
superBlock,
t,
theme = Themes.Default,
showCodeAlly,
user,
fetchUser,
updateAllChallengesInfo
}: DefaultLayoutProps): JSX.Element {
const { t } = useTranslation();
const { challengeEdges, certificateNodes } = useGetAllBlockIds();
useEffect(() => {
// componentDidMount

View File

@@ -6,7 +6,8 @@ import {
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Col, Row } from '@freecodecamp/react-bootstrap';
import React from 'react';
import { TFunction, useTranslation } from 'react-i18next';
import type { TFunction } from 'i18next';
import { useTranslation } from 'react-i18next';
import envData from '../../../../../config/env.json';
import { getLangCode } from '../../../../../config/i18n';

View File

@@ -7,7 +7,8 @@ import addMonths from 'date-fns/addMonths';
import isEqual from 'date-fns/isEqual';
import startOfDay from 'date-fns/startOfDay';
import React, { Component } from 'react';
import { TFunction, useTranslation } from 'react-i18next';
import type { TFunction } from 'i18next';
import { useTranslation } from 'react-i18next';
import ReactTooltip from 'react-tooltip';
import '@freecodecamp/react-calendar-heatmap/dist/styles.css';

View File

@@ -3,7 +3,8 @@ import Loadable from '@loadable/component';
import { graphql, useStaticQuery } from 'gatsby';
import { reverse, sortBy } from 'lodash-es';
import React, { useMemo, useState } from 'react';
import { TFunction, withTranslation } from 'react-i18next';
import type { TFunction } from 'i18next';
import { withTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import envData from '../../../../../config/env.json';

View File

@@ -1,7 +1,8 @@
import { Grid, Row } from '@freecodecamp/react-bootstrap';
import React from 'react';
import Helmet from 'react-helmet';
import { TFunction, useTranslation } from 'react-i18next';
import type { TFunction } from 'i18next';
import { useTranslation } from 'react-i18next';
import { FullWidthRow, Link, Spacer } from '../helpers';
import { User } from './../../redux/prop-types';

View File

@@ -1,7 +1,8 @@
import { isEqual } from 'lodash-es';
import React, { Component } from 'react';
import { HotKeys, ObserveKeys } from 'react-hotkeys';
import { TFunction, withTranslation } from 'react-i18next';
import type { TFunction } from 'i18next';
import { withTranslation } from 'react-i18next';
import { Hit } from 'react-instantsearch-core';
import { SearchBox } from 'react-instantsearch-dom';
import { connect } from 'react-redux';