Skip to content

Commit

Permalink
[optimize] simplify i18n imports
Browse files Browse the repository at this point in the history
  • Loading branch information
TechQuery committed Nov 9, 2024
1 parent 602928b commit d1bf40e
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 170 deletions.
4 changes: 1 addition & 3 deletions source/component/SummitCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ import {
import { FC, observer } from 'web-cell';
import { isXDomain } from 'web-utility';

import { i18n } from '../i18n';
import { t } from '../i18n';
import { summits } from '../page/data';
import * as style from './SummitCard.module.less';

const { t } = i18n;

export type SummitCardProps = ReturnType<typeof summits>[0] & CardProps;

export const SummitCard: FC<SummitCardProps> = observer(
Expand Down
6 changes: 2 additions & 4 deletions source/component/TopNavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import { FC, observer } from 'web-cell';
import {
NavLink,
NavLinkProps,
OffcanvasNavbar,
OffcanvasNavbarProps
} from 'boot-cell';
import { FC, observer } from 'web-cell';

import { i18n, LanguageName } from '../i18n';
import { i18n, LanguageName,t } from '../i18n';

export interface TopNavBarProps extends OffcanvasNavbarProps {
menu?: NavLinkProps[];
}

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

const { t } = i18n;

export const TopNavBar: FC<TopNavBarProps> = observer(
({ menu = [], ...rest }) => (
<OffcanvasNavbar
Expand Down
2 changes: 2 additions & 0 deletions source/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const i18n = new TranslationModel({
'en-US': () => import('./en-US')
});

export const { t } = i18n;

export const LanguageName: Record<(typeof i18n)['currentLanguage'], string> = {
'zh-CN': '简体中文',
'zh-TW': '正體中文',
Expand Down
30 changes: 13 additions & 17 deletions source/page/2017/data.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
import { t } from '../../i18n';
import avatars from './image/guests';
import {
QRGJ,
FCC_CDG,
BBD,
HCXY,
_3W,
DevEco,
BBD,
BW,
DevEco,
DKS,
FCC_CDG,
GDG,
GT,
SYL,
QE,
HCXY,
JueJin,
MZ,
OSChina,
QE,
QRGJ,
SF,
ZDK,
MZ,
GDG,
TW,
SYL,
TH,
TW,
WORK,
DKS
} from './image/logos';

import { i18n } from '../../i18n';

const { t } = i18n;
ZDK} from './image/logos';

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

Expand Down
26 changes: 13 additions & 13 deletions source/page/2017/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { Card, CardBody, CardImg, CardTitle, Button, Ratio } from 'boot-cell';
import { Button, Card, CardBody, CardImg, CardTitle, Ratio } from 'boot-cell';
import {
Accordion,
AccordionBody,
AccordionHeader,
AccordionItem
} from 'boot-cell';
import { i18n } from '../../i18n';
import { LogoList } from './LogoList';
import * as style from './index.module.less';
import { guests, flows, logos, title } from './data';
import { banner, qrcode } from './image';
import { observer } from 'web-cell';

const { t } = i18n;
import { t } from '../../i18n';
import { flows, guests, logos, title } from './data';
import { banner, qrcode } from './image';
import * as style from './index.module.less';
import { LogoList } from './LogoList';

export default () => (
<>
export default observer(() => (
<div>
<main className="container">
<header id={style.logo}>
<img className="w-100" src={banner} />
Expand All @@ -32,7 +32,7 @@ export default () => (
</h2>
<div className="row row-cols-1 row-cols-sm-2 row-cols-md-4 g-3">
{guests().map(({ avatar, name, description }) => (
<div className="col" key={name}>
<div key={name} className="col">
<Card id={'guest_' + name}>
<CardImg src={avatar} />
<CardBody>
Expand Down Expand Up @@ -106,7 +106,7 @@ export default () => (
<img className={style.qrcode} src={qrcode} />
<p className="mt-0">
{t('special_thanks')}&nbsp;
<a target="_blank" href="http://918930.lofter.com">
<a target="_blank" href="http://918930.lofter.com" rel="noreferrer">
BBD - {t('wang_bo')}
</a>
&nbsp;
Expand All @@ -119,5 +119,5 @@ export default () => (
/>
</Ratio>
</footer>
</>
);
</div>
));
77 changes: 36 additions & 41 deletions source/page/2018-Code4City/data.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,52 @@
import gallery from './image/gallery';
import { i18n } from '../../i18n';
import { t } from '../../i18n';
import {
BBD,
DevEco,
DKS,
FCC_CDG,
GDG,
GT,
HCXY,
JueJin,
OSChina,
SYL} from '../2017/image/logos';
import {
hushenquan,
fanxiaobin,
shenchangkun,
maoyufeng,
wenqixiang,
hushenquan,
liangtongming,
liwanpeng,
lvyan,
maoyufeng,
qinglinbo,
zhangwei,
liangtongming,
lvyan
} from './image/avatar';
shenchangkun,
wenqixiang,
zhangwei} from './image/avatar';
import gallery from './image/gallery';
import {
cdht,
cdhttv,
cdkfx,
XinYaoHang,
JRsquare,
Monstarlab,
cdtv,
first,
fm940,
github,
Microsoft,
tap4fun,
jhspace,
SegmentFault,
ThoughtWorks,
tedxChengDu,
mikecrm,
first,
jintai,
JRsquare,
kct,
lvs,
yunpian,
Microsoft,
mikecrm,
Monstarlab,
scdaily,
sctv,
cdtv,
cdhttv,
SegmentFault,
sinasc,
scdaily,
fm940,
kct
} from './image/logo';
import {
FCC_CDG,
BBD,
GDG,
DevEco,
GT,
SYL,
HCXY,
JueJin,
OSChina,
DKS
} from '../2017/image/logos';

const { t } = i18n;
tap4fun,
tedxChengDu,
ThoughtWorks,
XinYaoHang,
yunpian} from './image/logo';

export const awards = () => [
{
Expand Down
15 changes: 7 additions & 8 deletions source/page/2018-Code4City/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { Container, Button, Image } from 'boot-cell';
import { Button, Container, Image } from 'boot-cell';
import { Carousel, CarouselCaption, CarouselItem } from 'boot-cell';
import { observer } from 'web-cell';

import { t } from '../../i18n';
import { awards, review, sponsors,vips } from './data';
import { GuestCard } from './GuestCard';
import * as style from './index.module.less';
import BG_mountain from './image/BG-mountain.png';
import BG_points from './image/BG-points.png';
import { review, awards, vips, sponsors } from './data';

import { i18n } from '../../i18n';
const { t } = i18n;
import * as style from './index.module.less';

export default () => (
export default observer(() => (
<main>
<div
className="text-light"
Expand Down Expand Up @@ -187,4 +186,4 @@ export default () => (
</Container>
</div>
</main>
);
));
41 changes: 18 additions & 23 deletions source/page/2018/data.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
import { t } from '../../i18n';
import { BW, JueJin, OSChina, SF,SYL } from '../2017/image/logos';
import { FCC_CDC } from './image';
import { JueJin, BW, SYL, OSChina, SF } from '../2017/image/logos';
import {
Guo_DaFeng,
Guo_LinShuo,
Huang_Yi,
Quincy_Larson,
Si_Yue,
Xiong_Jie,
Yu_Che} from './image/lecturer';
import {
epubit,
fezaoduke,
mikecrm,
turing,
young,
mikecrm
} from './image/logo/partner';
young} from './image/logo/partner';
import { BaiCiZhan, baozun, cocoet, sxl } from './image/logo/sponsor';
import {
Quincy_Larson,
Xiong_Jie,
Huang_Yi,
Si_Yue,
Yu_Che,
Guo_LinShuo,
Guo_DaFeng
} from './image/lecturer';
import {
CD_LUG,
Covariant_Script,
Deepin,
WebCell,
H5DS,
Fun_loading,
UKylin,
Covariant_Script,
H5DS,
KaiYuanShe,
PI6,
React_Admin,
KaiYuanShe,
UKylin,
Vena_Network,
CD_LUG
} from './image/project';
import { i18n } from '../../i18n';

const { t } = i18n;
WebCell} from './image/project';

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

Expand Down
34 changes: 16 additions & 18 deletions source/page/2018/index.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
import { Container, Ratio, Table } from 'boot-cell';
import { Button, Image, Nav, NavLink } from 'boot-cell';
import { Card, CardImg, CardBody, CardTitle } from 'boot-cell';
import { Card, CardBody, CardImg, CardTitle } from 'boot-cell';
import { marked } from 'marked';
import { observer } from 'web-cell';

import { TopNavBar } from '../../component/TopNavBar';
import { LogoList } from './LogoList';
import * as style from './index.module.less';
import { t } from '../../i18n';
import {
title,
sections,
companies,
hosts,
lecturers,
schedule,
partners,
projects,
topics,
review,
hosts,
schedule,
sections,
sponsors,
partners,
companies
} from './data';
title,
topics} from './data';
import { poster, undraw_01, undraw_04 } from './image';
import photos from './image/photos';
import * as style from './index.module.less';
import { LogoList } from './LogoList';

import { i18n } from '../../i18n';
const { t } = i18n;

export default () => (
export default observer(() => (
<main className={style.root}>
<TopNavBar
brand={title()}
Expand Down Expand Up @@ -116,15 +114,15 @@ export default () => (
<div className="row row-cols-1 row-cols-md-3 g-3">
{projects().map(
({ type, URL, title, detail, logo }) => (
<div className="col" key={title}>
<div key={title} className="col">
<Card className="overflow-hidden">
<CardImg src={logo} />
<CardBody>
<CardTitle>
<a
className="stretched-link text-primary"
target="_blank"
href={URL}
href={URL} rel="noreferrer"
>
{title}
</a>
Expand Down Expand Up @@ -293,4 +291,4 @@ export default () => (
</Container>
</footer>
</main>
);
));
Loading

1 comment on commit d1bf40e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for web-conf ready!

✅ Preview
https://web-conf-4px9etvr9-techquerys-projects.vercel.app

Built with commit d1bf40e.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.