Skip to content

Commit d1bf40e

Browse files
committed
[optimize] simplify i18n imports
1 parent 602928b commit d1bf40e

File tree

15 files changed

+144
-170
lines changed

15 files changed

+144
-170
lines changed

source/component/SummitCard.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ import {
99
import { FC, observer } from 'web-cell';
1010
import { isXDomain } from 'web-utility';
1111

12-
import { i18n } from '../i18n';
12+
import { t } from '../i18n';
1313
import { summits } from '../page/data';
1414
import * as style from './SummitCard.module.less';
1515

16-
const { t } = i18n;
17-
1816
export type SummitCardProps = ReturnType<typeof summits>[0] & CardProps;
1917

2018
export const SummitCard: FC<SummitCardProps> = observer(

source/component/TopNavBar.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
import { FC, observer } from 'web-cell';
21
import {
32
NavLink,
43
NavLinkProps,
54
OffcanvasNavbar,
65
OffcanvasNavbarProps
76
} from 'boot-cell';
7+
import { FC, observer } from 'web-cell';
88

9-
import { i18n, LanguageName } from '../i18n';
9+
import { i18n, LanguageName,t } from '../i18n';
1010

1111
export interface TopNavBarProps extends OffcanvasNavbarProps {
1212
menu?: NavLinkProps[];
1313
}
1414

1515
const OriginalURLPattern = /^(https?|#)/;
1616

17-
const { t } = i18n;
18-
1917
export const TopNavBar: FC<TopNavBarProps> = observer(
2018
({ menu = [], ...rest }) => (
2119
<OffcanvasNavbar

source/i18n/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export const i18n = new TranslationModel({
99
'en-US': () => import('./en-US')
1010
});
1111

12+
export const { t } = i18n;
13+
1214
export const LanguageName: Record<(typeof i18n)['currentLanguage'], string> = {
1315
'zh-CN': '简体中文',
1416
'zh-TW': '正體中文',

source/page/2017/data.ts

+13-17
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
1+
import { t } from '../../i18n';
12
import avatars from './image/guests';
23
import {
3-
QRGJ,
4-
FCC_CDG,
5-
BBD,
6-
HCXY,
74
_3W,
8-
DevEco,
5+
BBD,
96
BW,
7+
DevEco,
8+
DKS,
9+
FCC_CDG,
10+
GDG,
1011
GT,
11-
SYL,
12-
QE,
12+
HCXY,
1313
JueJin,
14+
MZ,
1415
OSChina,
16+
QE,
17+
QRGJ,
1518
SF,
16-
ZDK,
17-
MZ,
18-
GDG,
19-
TW,
19+
SYL,
2020
TH,
21+
TW,
2122
WORK,
22-
DKS
23-
} from './image/logos';
24-
25-
import { i18n } from '../../i18n';
26-
27-
const { t } = i18n;
23+
ZDK} from './image/logos';
2824

2925
export const title = () => t('chengdu_web_frontend_conference_2017');
3026

source/page/2017/index.tsx

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import { Card, CardBody, CardImg, CardTitle, Button, Ratio } from 'boot-cell';
1+
import { Button, Card, CardBody, CardImg, CardTitle, Ratio } from 'boot-cell';
22
import {
33
Accordion,
44
AccordionBody,
55
AccordionHeader,
66
AccordionItem
77
} from 'boot-cell';
8-
import { i18n } from '../../i18n';
9-
import { LogoList } from './LogoList';
10-
import * as style from './index.module.less';
11-
import { guests, flows, logos, title } from './data';
12-
import { banner, qrcode } from './image';
8+
import { observer } from 'web-cell';
139

14-
const { t } = i18n;
10+
import { t } from '../../i18n';
11+
import { flows, guests, logos, title } from './data';
12+
import { banner, qrcode } from './image';
13+
import * as style from './index.module.less';
14+
import { LogoList } from './LogoList';
1515

16-
export default () => (
17-
<>
16+
export default observer(() => (
17+
<div>
1818
<main className="container">
1919
<header id={style.logo}>
2020
<img className="w-100" src={banner} />
@@ -32,7 +32,7 @@ export default () => (
3232
</h2>
3333
<div className="row row-cols-1 row-cols-sm-2 row-cols-md-4 g-3">
3434
{guests().map(({ avatar, name, description }) => (
35-
<div className="col" key={name}>
35+
<div key={name} className="col">
3636
<Card id={'guest_' + name}>
3737
<CardImg src={avatar} />
3838
<CardBody>
@@ -106,7 +106,7 @@ export default () => (
106106
<img className={style.qrcode} src={qrcode} />
107107
<p className="mt-0">
108108
{t('special_thanks')}&nbsp;
109-
<a target="_blank" href="http://918930.lofter.com">
109+
<a target="_blank" href="http://918930.lofter.com" rel="noreferrer">
110110
BBD - {t('wang_bo')}
111111
</a>
112112
&nbsp;
@@ -119,5 +119,5 @@ export default () => (
119119
/>
120120
</Ratio>
121121
</footer>
122-
</>
123-
);
122+
</div>
123+
));

source/page/2018-Code4City/data.ts

+36-41
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,52 @@
1-
import gallery from './image/gallery';
2-
import { i18n } from '../../i18n';
1+
import { t } from '../../i18n';
2+
import {
3+
BBD,
4+
DevEco,
5+
DKS,
6+
FCC_CDG,
7+
GDG,
8+
GT,
9+
HCXY,
10+
JueJin,
11+
OSChina,
12+
SYL} from '../2017/image/logos';
313
import {
4-
hushenquan,
514
fanxiaobin,
6-
shenchangkun,
7-
maoyufeng,
8-
wenqixiang,
15+
hushenquan,
16+
liangtongming,
917
liwanpeng,
18+
lvyan,
19+
maoyufeng,
1020
qinglinbo,
11-
zhangwei,
12-
liangtongming,
13-
lvyan
14-
} from './image/avatar';
21+
shenchangkun,
22+
wenqixiang,
23+
zhangwei} from './image/avatar';
24+
import gallery from './image/gallery';
1525
import {
1626
cdht,
27+
cdhttv,
1728
cdkfx,
18-
XinYaoHang,
19-
JRsquare,
20-
Monstarlab,
29+
cdtv,
30+
first,
31+
fm940,
2132
github,
22-
Microsoft,
23-
tap4fun,
2433
jhspace,
25-
SegmentFault,
26-
ThoughtWorks,
27-
tedxChengDu,
28-
mikecrm,
29-
first,
3034
jintai,
35+
JRsquare,
36+
kct,
3137
lvs,
32-
yunpian,
38+
Microsoft,
39+
mikecrm,
40+
Monstarlab,
41+
scdaily,
3342
sctv,
34-
cdtv,
35-
cdhttv,
43+
SegmentFault,
3644
sinasc,
37-
scdaily,
38-
fm940,
39-
kct
40-
} from './image/logo';
41-
import {
42-
FCC_CDG,
43-
BBD,
44-
GDG,
45-
DevEco,
46-
GT,
47-
SYL,
48-
HCXY,
49-
JueJin,
50-
OSChina,
51-
DKS
52-
} from '../2017/image/logos';
53-
54-
const { t } = i18n;
45+
tap4fun,
46+
tedxChengDu,
47+
ThoughtWorks,
48+
XinYaoHang,
49+
yunpian} from './image/logo';
5550

5651
export const awards = () => [
5752
{

source/page/2018-Code4City/index.tsx

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import { Container, Button, Image } from 'boot-cell';
1+
import { Button, Container, Image } from 'boot-cell';
22
import { Carousel, CarouselCaption, CarouselItem } from 'boot-cell';
3+
import { observer } from 'web-cell';
34

5+
import { t } from '../../i18n';
6+
import { awards, review, sponsors,vips } from './data';
47
import { GuestCard } from './GuestCard';
5-
import * as style from './index.module.less';
68
import BG_mountain from './image/BG-mountain.png';
79
import BG_points from './image/BG-points.png';
8-
import { review, awards, vips, sponsors } from './data';
9-
10-
import { i18n } from '../../i18n';
11-
const { t } = i18n;
10+
import * as style from './index.module.less';
1211

13-
export default () => (
12+
export default observer(() => (
1413
<main>
1514
<div
1615
className="text-light"
@@ -187,4 +186,4 @@ export default () => (
187186
</Container>
188187
</div>
189188
</main>
190-
);
189+
));

source/page/2018/data.ts

+18-23
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,33 @@
1+
import { t } from '../../i18n';
2+
import { BW, JueJin, OSChina, SF,SYL } from '../2017/image/logos';
13
import { FCC_CDC } from './image';
2-
import { JueJin, BW, SYL, OSChina, SF } from '../2017/image/logos';
4+
import {
5+
Guo_DaFeng,
6+
Guo_LinShuo,
7+
Huang_Yi,
8+
Quincy_Larson,
9+
Si_Yue,
10+
Xiong_Jie,
11+
Yu_Che} from './image/lecturer';
312
import {
413
epubit,
514
fezaoduke,
15+
mikecrm,
616
turing,
7-
young,
8-
mikecrm
9-
} from './image/logo/partner';
17+
young} from './image/logo/partner';
1018
import { BaiCiZhan, baozun, cocoet, sxl } from './image/logo/sponsor';
1119
import {
12-
Quincy_Larson,
13-
Xiong_Jie,
14-
Huang_Yi,
15-
Si_Yue,
16-
Yu_Che,
17-
Guo_LinShuo,
18-
Guo_DaFeng
19-
} from './image/lecturer';
20-
import {
20+
CD_LUG,
21+
Covariant_Script,
2122
Deepin,
22-
WebCell,
23-
H5DS,
2423
Fun_loading,
25-
UKylin,
26-
Covariant_Script,
24+
H5DS,
25+
KaiYuanShe,
2726
PI6,
2827
React_Admin,
29-
KaiYuanShe,
28+
UKylin,
3029
Vena_Network,
31-
CD_LUG
32-
} from './image/project';
33-
import { i18n } from '../../i18n';
34-
35-
const { t } = i18n;
30+
WebCell} from './image/project';
3631

3732
export const title = () => t('chengdu_web_frontend_conference_2018');
3833

source/page/2018/index.tsx

+16-18
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
import { Container, Ratio, Table } from 'boot-cell';
22
import { Button, Image, Nav, NavLink } from 'boot-cell';
3-
import { Card, CardImg, CardBody, CardTitle } from 'boot-cell';
3+
import { Card, CardBody, CardImg, CardTitle } from 'boot-cell';
44
import { marked } from 'marked';
5+
import { observer } from 'web-cell';
56

67
import { TopNavBar } from '../../component/TopNavBar';
7-
import { LogoList } from './LogoList';
8-
import * as style from './index.module.less';
8+
import { t } from '../../i18n';
99
import {
10-
title,
11-
sections,
10+
companies,
11+
hosts,
1212
lecturers,
13-
schedule,
13+
partners,
1414
projects,
15-
topics,
1615
review,
17-
hosts,
16+
schedule,
17+
sections,
1818
sponsors,
19-
partners,
20-
companies
21-
} from './data';
19+
title,
20+
topics} from './data';
2221
import { poster, undraw_01, undraw_04 } from './image';
2322
import photos from './image/photos';
23+
import * as style from './index.module.less';
24+
import { LogoList } from './LogoList';
2425

25-
import { i18n } from '../../i18n';
26-
const { t } = i18n;
27-
28-
export default () => (
26+
export default observer(() => (
2927
<main className={style.root}>
3028
<TopNavBar
3129
brand={title()}
@@ -116,15 +114,15 @@ export default () => (
116114
<div className="row row-cols-1 row-cols-md-3 g-3">
117115
{projects().map(
118116
({ type, URL, title, detail, logo }) => (
119-
<div className="col" key={title}>
117+
<div key={title} className="col">
120118
<Card className="overflow-hidden">
121119
<CardImg src={logo} />
122120
<CardBody>
123121
<CardTitle>
124122
<a
125123
className="stretched-link text-primary"
126124
target="_blank"
127-
href={URL}
125+
href={URL} rel="noreferrer"
128126
>
129127
{title}
130128
</a>
@@ -293,4 +291,4 @@ export default () => (
293291
</Container>
294292
</footer>
295293
</main>
296-
);
294+
));

0 commit comments

Comments
 (0)