From b880e5dce52d0be7cb37bac739f283e237c56b95 Mon Sep 17 00:00:00 2001 From: shinya Date: Tue, 1 Jul 2025 12:35:26 +0800 Subject: [PATCH] feat: add github link --- src/components/MobileBottomNav.tsx | 12 ++++++++++++ src/components/Sidebar.tsx | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/components/MobileBottomNav.tsx b/src/components/MobileBottomNav.tsx index 00817da..588883f 100644 --- a/src/components/MobileBottomNav.tsx +++ b/src/components/MobileBottomNav.tsx @@ -3,6 +3,7 @@ import { Clover, Film, + Github, Home, MessageCircleHeart, MountainSnow, @@ -15,6 +16,8 @@ import { import Link from 'next/link'; import { usePathname } from 'next/navigation'; +import { useSite } from './SiteProvider'; + interface MobileBottomNavProps { /** * 主动指定当前激活的路径。当未提供时,自动使用 usePathname() 获取的路径。 @@ -61,6 +64,15 @@ const MobileBottomNav = ({ activePath }: MobileBottomNavProps) => { { icon: VenetianMask, label: '日漫', href: '/douban?type=tv&tag=日本动画' }, ]; + const { siteName } = useSite(); + if (siteName !== 'MoonTV') { + navItems.push({ + icon: Github, + label: 'MoonTV', + href: 'https://github.com/senshinya/MoonTV', + }); + } + const isActive = (href: string) => { const typeMatch = href.match(/type=([^&]+)/)?.[1]; const tagMatch = href.match(/tag=([^&]+)/)?.[1]; diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 3679ea5..52552a9 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -3,6 +3,7 @@ import { Clover, Film, + Github, Home, Menu, MessageCircleHeart, @@ -165,6 +166,15 @@ const Sidebar = ({ onToggle, activePath = '/' }: SidebarProps) => { { icon: VenetianMask, label: '日漫', href: '/douban?type=tv&tag=日本动画' }, ]; + const { siteName } = useSite(); + if (siteName !== 'MoonTV') { + menuItems.push({ + icon: Github, + label: 'MoonTV', + href: 'https://github.com/senshinya/MoonTV', + }); + } + return ( {/* 在移动端隐藏侧边栏 */}