-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathindex.tsx
More file actions
213 lines (201 loc) · 7.98 KB
/
index.tsx
File metadata and controls
213 lines (201 loc) · 7.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
import { observer } from 'mobx-react';
import { CSSProperties, FC, useContext, useEffect, useState } from 'react';
import { Card, Col, Row } from 'react-bootstrap';
import { renderToStaticMarkup } from 'react-dom/server';
import ReactTyped from 'react-typed-component';
import { PageHead } from '../components/Layout/PageHead';
import { I18nContext } from '../models/Translation';
import styles from '../styles/Home.module.less';
// Temporarily disable localStorage persistence so the bar returns after refresh.
// const HackathonTopBarStorageKey = 'labor-ai-hackathon-2026-top-bar-dismissed';
const HackathonTopBarLink = '/hackathon/Labor-AI-hackathon-2026';
const HomePage: FC = observer(() => {
const { t } = useContext(I18nContext);
const [isHackathonTopBarVisible, setIsHackathonTopBarVisible] = useState(true);
const [hackathonTopBarStyle, setHackathonTopBarStyle] = useState<CSSProperties>();
// useEffect(() => {
// setIsHackathonTopBarVisible(localStorage.getItem(HackathonTopBarStorageKey) !== 'true');
// }, []);
useEffect(() => {
const navbar = document.querySelector('nav');
const syncTopBarOffset = () => {
const navbarHeight = navbar?.getBoundingClientRect().height || 56;
setHackathonTopBarStyle({
'--hackathon-top-bar-gap': `${Math.max(navbarHeight - 56, 0)}px`,
'--hackathon-top-bar-offset': `${navbarHeight}px`,
} as CSSProperties);
};
const observer =
typeof ResizeObserver === 'undefined' || !navbar
? undefined
: new ResizeObserver(syncTopBarOffset);
syncTopBarOffset();
if (navbar) observer?.observe(navbar);
window.addEventListener('resize', syncTopBarOffset);
return () => {
observer?.disconnect();
window.removeEventListener('resize', syncTopBarOffset);
};
}, []);
const closeHackathonTopBar = () => {
setIsHackathonTopBarVisible(false);
// localStorage.setItem(HackathonTopBarStorageKey, 'true');
};
return (
<>
<PageHead />
{isHackathonTopBarVisible && (
<aside
className={styles.hackathonTopBar}
aria-label={t('home_hackathon_top_bar_aria_label')}
style={hackathonTopBarStyle}
>
<div className={styles.hackathonTopBarInner}>
<a className={styles.hackathonTopBarContent} href={HackathonTopBarLink}>
<span className={styles.hackathonTopBarText}>
<strong>{t('home_hackathon_top_bar_title')}</strong>
<span>{t('home_hackathon_top_bar_description')}</span>
</span>
<span className={styles.hackathonTopBarEventName}>Labor AI Hackathon 2026</span>
<span className={styles.hackathonTopBarAction}>
{t('home_hackathon_top_bar_action')}
</span>
</a>
<button
className={styles.hackathonTopBarClose}
type="button"
aria-label={t('home_hackathon_top_bar_close')}
title={t('home_hackathon_top_bar_close')}
onClick={closeHackathonTopBar}
>
×
</button>
</div>
</aside>
)}
<section
className={`flex-fill d-flex flex-column justify-content-center align-items-center bg-secondary bg-gradient text-dark bg-opacity-10 ${styles.main}`}
>
<h2 className={`m-0 text-center ${styles.title}`}>
<ReactTyped
backDelay={1}
backSpeed={200}
cursorChar="|"
fadeOutDelay={100}
loop
loopCount={0}
showCursor
startDelay={0}
strings={[
renderToStaticMarkup(
<>
欢迎来到
<strong>
<a className="text-primary mx-2" href="https://bazaar.fcc-cd.dev/">
开源市集
</a>
</strong>
</>,
),
renderToStaticMarkup(
<>
{t('welcome_open_collaboration')}
<strong>{t('open_collaboration')}</strong>
</>,
),
renderToStaticMarkup(
<>
欢迎一起评选<strong>开放协作人奖</strong>
</>,
),
]}
typeSpeed={100}
/>
</h2>
</section>
<section
className={`flex-fill d-flex flex-column justify-content-center align-items-center pb-0 bg-warning bg-opacity-10 ${styles.main}`}
>
<h2 className="text-start mb-5 mt-5 fw-bolder">{t('participate')}</h2>
<Row className="flex-fill d-flex justify-content-around align-items-center w-100 px-3">
<Col xs={8} sm={7} md={4} className="pb-5">
<Card body className={`shadow ${styles.activeCard}`}>
<h5 className="fw-bold mb-3">{t('code_work')}</h5>
<ul className="list-unstyled">
<li className="mb-3">
<a
href="https://github.com/Open-Source-Bazaar/Open-Source-Bazaar.github.io"
className="fw-bold"
>
官网开发
</a>
:研发官网,让更多人了解「开源市集」,了解「开放式协作」……
</li>
<li className="mb-3">
<span className="fw-bold">……</span>
</li>
</ul>
</Card>
</Col>
<Col xs={8} sm={7} md={4} className="pb-5">
<Card body className={`shadow overflow-auto ${styles.activeCard}`}>
<h5 className="fw-bold mb-3">{t('non_code_work')}</h5>
<ul className="list-unstyled">
<li className="mb-3">
<a href="/history" className="fw-bold">
开放市集
</a>
:一群来自不同领域的有趣的朋友通过展示、交流,将“开源”和“开放式协作”的乐趣带给更多人……
</li>
<li className="mb-3">
<a href="/open-collaborator-award" className="fw-bold">
开放协作人奖
</a>
:在过去的一年中令你难以忘怀的人,请把 Ta 推荐给更多的人……
</li>
<li className="mb-3">
<span className="fw-bold">……</span>
</li>
</ul>
</Card>
</Col>
<Col xs={8} sm={7} md={4} className="pb-5">
<Card body className={`shadow ${styles.activeCard}`}>
<p>
欢迎
<a href="/join-us" className="fw-bold">
成为共创人/方
</a>
,更多内容/形式等你来共创……
</p>
</Card>
</Col>
</Row>
</section>
<section
className={`flex-fill d-flex flex-column justify-content-center align-items-center pb-0 bg-success bg-opacity-10 ${styles.main}`}
>
<h2 className="text-start mb-5 fw-bolder h1">{t('action')}</h2>
<Row className="d-flex flex-column justify-content-start align-items-center w-100 mb-5">
<Col className="text-center">
<figure className="text-center">
<blockquote className="blockquote mb-4">
<p className="h2">{t('we_are_organizing_bazaar')}</p>
</blockquote>
<figcaption className="h6 text-muted">
即兴三月,开源开放!来都来了,玩就是了!👉
<a
href="https://open-source-bazaar.feishu.cn/docs/doccnGSsshgO4ojuAHVzWJMXWog?from=from_copylink"
className="text-primary"
>
立刻协作
</a>
</figcaption>
</figure>
</Col>
</Row>
</section>
</>
);
});
export default HomePage;