Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: text error and blog image error #322

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/web/i18n
Submodule i18n updated 1 files
+1 −1 en/analyze.json
Binary file added apps/web/public/images/home/news/8en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/web/public/images/home/news/9en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions apps/web/src/modules/home/LatestNews/NewsData.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@
"type": "Blog",
"title": "Reflections on the Evaluation and Measurement of Open Source Ecosystem (3) - Dynamics and Statics of Contributors",
"title_cn": "开源生态评估与度量的思考(三)——贡献者的动与静",
"img": "/images/home/news/8.png",
"img": "/images/home/news/8en.png",
"img_cn": "/images/home/news/8.png",
"url": "/blog/2023/12/09/open-source-eco3/open-source-eco3"
},
{
"type": "Blog",
"title": "Reflections on the Evaluation and Measurement of Open Source Ecosystem (2) - The Multidimensional Space of Evaluation Systems",
"title_cn": "开源生态评估与度量的思考(二)——评估体系的多维空间",
"img": "/images/home/news/9.png",
"img": "/images/home/news/9en.png",
"img_cn": "/images/home/news/9.png",
"url": "/blog/2023/12/08/open-source-eco2/open-source-eco2"
},
{
"type": "Event",
"title": "OSS Compass Events",
"title_cn": "OSS Compass事件"
"title_cn": "OSS Compass 事件"
}
]
}
10 changes: 6 additions & 4 deletions apps/web/src/modules/home/LatestNews/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from 'react';
import React from 'react';
import classnames from 'classnames';
import { useTranslation } from 'react-i18next';
import jsonData from './NewsData.json';
Expand All @@ -12,6 +12,7 @@ const NewsBox = (props: {
title: string;
titleCn: string;
img?: string;
imgCn?: string;
url?: string;
}) => {
const { t, i18n } = useTranslation();
Expand All @@ -21,7 +22,7 @@ const NewsBox = (props: {
Blog: t('home:blog'),
Event: t('home:event'),
};
const { type, title, titleCn, img, url } = props;
const { type, title, titleCn, img, imgCn, url } = props;
return (
<div>
<div className="h-[430px] rounded border p-6 shadow">
Expand Down Expand Up @@ -54,7 +55,7 @@ const NewsBox = (props: {
<Image
width={336}
height={190}
src={img}
src={i18n.language === 'en' ? img : imgCn}
unoptimized
alt={''}
style={{
Expand Down Expand Up @@ -88,13 +89,14 @@ const LatestNews = () => {
>
<div className="mb-6 text-2xl font-bold">{t('home:the_latest_from')}</div>
<div className="mb-10 grid grid-cols-3 gap-5 lg:w-full lg:grid-cols-1 lg:gap-y-6 lg:px-4">
{data.map(({ type, title, title_cn, img, url }) => {
{data.map(({ type, title, title_cn, img, img_cn, url }) => {
return (
<NewsBox
type={type}
title={title}
titleCn={title_cn}
img={img}
imgCn={img_cn}
url={url}
key={title}
/>
Expand Down
Loading