From 0c07de0f492aad44084d53462bedc658f7b92234 Mon Sep 17 00:00:00 2001 From: Reza Jelveh Date: Mon, 10 Aug 2026 00:37:31 +0800 Subject: [PATCH 1/2] feat(events): add event index page and back navigation Add /landing index page listing all events, link back to it from event detail pages, and extract i18n helpers into src/utils/i18n. Fixes #652 Signed-off-by: Reza Jelveh --- src/components/EventLanding.js | 20 ++++++---- src/components/EventLanding.module.css | 53 +++++++++++++++++++++++++ src/pages/landing/index.js | 54 ++++++++++++++++++++++++++ src/utils/i18n.js | 7 ++++ 4 files changed, 126 insertions(+), 8 deletions(-) create mode 100644 src/pages/landing/index.js create mode 100644 src/utils/i18n.js diff --git a/src/components/EventLanding.js b/src/components/EventLanding.js index 1af839129..1c520c400 100644 --- a/src/components/EventLanding.js +++ b/src/components/EventLanding.js @@ -1,5 +1,6 @@ import Layout from "@theme/Layout"; import Head from "@docusaurus/Head"; +import Link from "@docusaurus/Link"; import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faDiscord, faGithub } from "@fortawesome/free-brands-svg-icons"; @@ -14,16 +15,9 @@ import { import useBaseUrl from "@docusaurus/useBaseUrl"; import events from "@site/src/data/events"; import { formatDate, formatDateRange } from "@site/src/utils/date"; +import { isChinese, pick } from "@site/src/utils/i18n"; import styles from "./EventLanding.module.css"; -function isChinese(locale) { - return locale.startsWith("zh"); -} - -function pick(locale, obj) { - return isChinese(locale) && obj.zh ? obj.zh : obj.en; -} - function utm(url, slug) { let u; try { @@ -94,6 +88,9 @@ export default function EventLanding({ slug }) {
+ + ← {isZh ? "所有活动" : "All Events"} + {event.banner && ( {pick(locale, )} @@ -245,6 +242,13 @@ export default function EventLanding({ slug }) {
+
+
+ + ← {isZh ? "所有活动" : "All Events"} + +
+
); diff --git a/src/components/EventLanding.module.css b/src/components/EventLanding.module.css index 44b193c03..06a29b689 100644 --- a/src/components/EventLanding.module.css +++ b/src/components/EventLanding.module.css @@ -70,6 +70,59 @@ text-decoration: none; } +/* Backlink */ +.backLink { + display: inline-block; + margin-bottom: var(--hami-space-16); + color: var(--hami-color-muted); + font-size: 0.95rem; + text-decoration: none; +} + +.backLink:hover { + color: var(--hami-color-primary); + text-decoration: none; +} + +.moreEvents { + padding: var(--hami-space-16) 0 var(--hami-space-48); + text-align: center; +} + +/* Event list (landing index) */ +.eventList { + display: flex; + flex-direction: column; + gap: var(--hami-space-16); + margin-top: var(--hami-space-32); +} + +.eventCard { + display: block; + padding: var(--hami-space-24) var(--hami-space-32); + text-decoration: none; + transition: border-color var(--hami-motion-fast); +} + +.eventCard:hover { + border-color: var(--hami-color-primary); + text-decoration: none; +} + +.eventTitle { + font-family: var(--hami-font-display); + font-size: 1.25rem; + font-weight: 700; + color: var(--hami-color-text); + margin-bottom: var(--hami-space-8); +} + +.eventMeta { + color: var(--hami-color-muted); + font-size: 0.95rem; + margin: 0; +} + /* Case study */ .caseStudySection { padding: var(--hami-space-32) 0; diff --git a/src/pages/landing/index.js b/src/pages/landing/index.js new file mode 100644 index 000000000..31b19939e --- /dev/null +++ b/src/pages/landing/index.js @@ -0,0 +1,54 @@ +import Layout from "@theme/Layout"; +import Link from "@docusaurus/Link"; +import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; +import events from "@site/src/data/events"; +import { formatDate, formatDateRange } from "@site/src/utils/date"; +import { isChinese, pick } from "@site/src/utils/i18n"; +import styles from "@site/src/components/EventLanding.module.css"; + +export default function EventLandingList() { + const { i18n } = useDocusaurusContext(); + const isZh = isChinese(i18n.currentLocale); + const locale = i18n.currentLocale; + + return ( + +
+
+
+

{isZh ? "活动" : "Events"}

+

+ {isZh + ? "查看 HAMi 团队参与的活动与演讲,获取演讲幻灯片与社区资料。" + : "See the events and talks the HAMi team is part of, with slides and community resources."} +

+
+ {events.map((e) => ( + +

{pick(locale, e.title)}

+

+ {e.endDate + ? formatDateRange(e.date, e.endDate, locale) + : formatDate(e.date, locale)} + {e.location ? ` - ${pick(locale, e.location)}` : ""} +

+ + ))} +
+
+
+
+
+ ); +} diff --git a/src/utils/i18n.js b/src/utils/i18n.js new file mode 100644 index 000000000..31ff91a7c --- /dev/null +++ b/src/utils/i18n.js @@ -0,0 +1,7 @@ +export function isChinese(locale) { + return locale.startsWith("zh"); +} + +export function pick(locale, obj) { + return isChinese(locale) && obj.zh ? obj.zh : obj.en; +} From fe7483d0c50314c956995f287145672f187a52d8 Mon Sep 17 00:00:00 2001 From: Reza Jelveh Date: Mon, 10 Aug 2026 14:05:16 +0800 Subject: [PATCH 2/2] fix(landing): update labels and navigation for landing pages Signed-off-by: Reza Jelveh --- src/components/EventLanding.js | 6 +++--- src/pages/landing/index.js | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/EventLanding.js b/src/components/EventLanding.js index 1c520c400..82babdc5a 100644 --- a/src/components/EventLanding.js +++ b/src/components/EventLanding.js @@ -89,7 +89,7 @@ export default function EventLanding({ slug }) {
- ← {isZh ? "所有活动" : "All Events"} + ← {isZh ? "落地页" : "Landing Pages"} {event.banner && ( {pick(locale, @@ -244,8 +244,8 @@ export default function EventLanding({ slug }) {
- - ← {isZh ? "所有活动" : "All Events"} + + ← {isZh ? "活动日历" : "Events Calendar"}
diff --git a/src/pages/landing/index.js b/src/pages/landing/index.js index 31b19939e..4004b304b 100644 --- a/src/pages/landing/index.js +++ b/src/pages/landing/index.js @@ -13,20 +13,20 @@ export default function EventLandingList() { return (
-

{isZh ? "活动" : "Events"}

+

{isZh ? "落地页" : "Landing Pages"}

{isZh - ? "查看 HAMi 团队参与的活动与演讲,获取演讲幻灯片与社区资料。" + ? "查看 HAMi 团队的活动落地页,获取演讲详情与社区资料。" : "See the events and talks the HAMi team is part of, with slides and community resources."}