diff --git a/components/Git/Card.tsx b/components/Git/Card.tsx index 9425c3878..53470db6c 100644 --- a/components/Git/Card.tsx +++ b/components/Git/Card.tsx @@ -1,10 +1,10 @@ import { text2color } from 'idea-react'; import { GitRepository } from 'mobx-github'; import { observer } from 'mobx-react'; -import { FC } from 'react'; +import { FC, useContext } from 'react'; import { Badge, Button, Card, CardProps, Col, Row } from 'react-bootstrap'; -import { t } from '../../models/Translation'; +import { I18nContext } from '../../models/Translation'; import { GitLogo } from './Logo'; export interface GitCardProps @@ -24,45 +24,49 @@ export const GitCard: FC = observer( description, homepage, ...props - }) => ( - - - - - {full_name} - - + }) => { + const { t } = useContext(I18nContext); - - - {languages.map(language => ( - - - - ))} - - {description} - - - {homepage && ( - - )} - - - ), + return ( + + + + + {full_name} + + + + + + {languages.map(language => ( + + + + ))} + + {description} + + + {homepage && ( + + )} + + + ); + }, ); diff --git a/components/LarkImage.tsx b/components/LarkImage.tsx index 6f0f91b22..e0cfbac06 100644 --- a/components/LarkImage.tsx +++ b/components/LarkImage.tsx @@ -2,7 +2,8 @@ import { TableCellValue } from 'mobx-lark'; import { FC } from 'react'; import { Image, ImageProps } from 'react-bootstrap'; -import { DefaultImage, fileURLOf } from '../pages/api/Lark/file/[id]'; +import { fileURLOf } from '../models/Base'; +import { DefaultImage } from '../models/configuration'; export interface LarkImageProps extends Omit { src?: TableCellValue; diff --git a/components/Layout/NotFoundCard.tsx b/components/Layout/NotFoundCard.tsx index 5ce190698..41a6a731c 100644 --- a/components/Layout/NotFoundCard.tsx +++ b/components/Layout/NotFoundCard.tsx @@ -1,10 +1,13 @@ +import { observer } from 'mobx-react'; import { ErrorProps } from 'next/error'; -import { FC } from 'react'; +import { FC, useContext } from 'react'; -import { i18n } from '../../models/Translation'; +import { I18nContext } from '../../models/Translation'; -export const NotFoundCard: FC = ({ title }) => - i18n.currentLanguage.startsWith('zh') ? ( +export const NotFoundCard: FC = observer(({ title }) => { + const { currentLanguage } = useContext(I18nContext); + + return currentLanguage.startsWith('zh') ? (