Skip to content

Commit 486b611

Browse files
CopilotTechQuery
andcommitted
Implement comprehensive i18n, pagination, and code refactoring based on feedback
Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com>
1 parent b76bb38 commit 486b611

File tree

9 files changed

+183
-18656
lines changed

9 files changed

+183
-18656
lines changed

components/Home/UpcomingEvents.tsx

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,48 @@
11
import Link from 'next/link';
2-
import { FC } from 'react';
2+
import { FC, useContext } from 'react';
33
import { Button, Card, Col, Container, Row } from 'react-bootstrap';
44

5+
import { I18nContext } from '../../models/Translation';
56
import { ArticleMeta } from '../../pages/api/core';
67
import { SectionTitle } from './SectionTitle';
78

89
interface UpcomingEventsProps {
910
events: ArticleMeta[];
1011
}
1112

12-
export const UpcomingEvents: FC<UpcomingEventsProps> = ({ events }) => (
13-
<div className="py-5 bg-white w-100 m-0">
14-
<Container>
15-
<SectionTitle>近期活动</SectionTitle>
13+
export const UpcomingEvents: FC<UpcomingEventsProps> = ({ events }) => {
14+
const { t } = useContext(I18nContext);
1615

17-
<Row className="g-4" xs={1} sm={2} md={3}>
18-
{events.map(({ name, meta, path }) => (
19-
<Col key={name}>
20-
<Card body>
21-
<Card.Title className="text-dark">{name}</Card.Title>
22-
<Card.Text className="text-dark">时间: {meta?.start || 'N/A'}</Card.Text>
23-
<Card.Text className="text-dark">地点: {meta?.address || 'N/A'}</Card.Text>
16+
return (
17+
<div className="py-5 bg-white w-100 m-0">
18+
<Container>
19+
<SectionTitle>{t('upcoming_events')}</SectionTitle>
2420

25-
<Link href={path || '#'} className="btn btn-primary">
26-
查看详情
27-
</Link>
28-
</Card>
29-
</Col>
30-
))}
31-
</Row>
32-
<div className="text-center mt-4">
33-
<Button variant="outline-primary" size="lg" href="/activity">
34-
查看全部活动 →
35-
</Button>
36-
</div>
37-
</Container>
38-
</div>
39-
);
21+
<Row className="g-4" xs={1} sm={2} md={3}>
22+
{events.map(({ name, meta, path }) => (
23+
<Col key={name}>
24+
<Card body>
25+
<Card.Title className="text-dark">{name}</Card.Title>
26+
<Card.Text className="text-dark">
27+
{t('activity_time')}: {meta?.start || 'N/A'}
28+
</Card.Text>
29+
<Card.Text className="text-dark">
30+
{t('activity_location')}: {meta?.address || 'N/A'}
31+
</Card.Text>
32+
33+
<Link href={path || '#'} className="btn btn-primary">
34+
{t('view_details')}
35+
</Link>
36+
</Card>
37+
</Col>
38+
))}
39+
</Row>
40+
<div className="text-center mt-4">
41+
<Button variant="outline-primary" size="lg" href="/activity">
42+
{t('view_all_activities')}
43+
</Button>
44+
</div>
45+
</Container>
46+
</div>
47+
);
48+
};

next-env.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
/// <reference path="./.next/types/routes.d.ts" />
43

54
// NOTE: This file should not be edited
65
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

0 commit comments

Comments
 (0)