From 4c20fde974bc943ad7d33166c303235d4576409a Mon Sep 17 00:00:00 2001 From: dethan3 Date: Thu, 27 Aug 2026 08:50:40 +0800 Subject: [PATCH 1/7] fix: generalize site footer content --- components/Footer.tsx | 182 +++++++++++++++++++++++++----------------- pages/_app.tsx | 20 ++++- translation/en-US.ts | 3 + translation/zh-CN.ts | 3 + translation/zh-TW.ts | 3 + 5 files changed, 138 insertions(+), 73 deletions(-) diff --git a/components/Footer.tsx b/components/Footer.tsx index c26ae3f..00d83f4 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -1,88 +1,126 @@ import { observer } from 'mobx-react'; +import Link from 'next/link'; import { useContext } from 'react'; -import { Col, Container, Nav, Row } from 'react-bootstrap'; +import { Col, Container, Image, Nav, Row } from 'react-bootstrap'; import { ContactEmail, GitHubURL, WeChatURL } from '../models/configuration'; import { I18nContext } from '../models/Translation'; -export const Footer = observer(() => { - const { t } = useContext(I18nContext); +export interface FooterLink { + href: string; + icon: string; + label: string; +} - return ( - - ); -}); +
+ + © {copyrightYear} {t('open_source_bazaar')}. {t('all_rights_reserved')} + + {showVercelCredit && ( + + {t('powered_by')} + Vercel + + )} +
+ + + ); + }, +); diff --git a/pages/_app.tsx b/pages/_app.tsx index d3cae06..030bb62 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -74,6 +74,24 @@ export default class CustomApp extends App { const isArticlePage = asPath.startsWith('/article/') || asPath.startsWith('/policy/'), isActivityPage = asPath.startsWith('/hackathon'), isOpenLibraryPath = asPath.startsWith('/open-library'); + const footerProps = isOpenLibraryPath + ? { + description: t('footer_description'), + quickLinks: [ + { href: '/open-library/books', icon: '📖', label: t('catalog_footer') }, + { href: '/open-library/how-to-borrow', icon: 'ℹ️', label: t('how_to_borrow') }, + ], + } + : { + description: t('site_footer_description'), + quickLinks: [ + { href: '/', icon: '🏠', label: t('home_footer') }, + { href: '/article/about', icon: 'ℹ️', label: t('about_us_footer') }, + { href: '/article/join-us', icon: '🤝', label: t('join_us') }, + ], + copyrightStartYear: 2021, + showVercelCredit: true, + }; return ( @@ -90,7 +108,7 @@ export default class CustomApp extends App { ) : ( this.renderSiteFrame(isArticlePage) )} -