feat: init 2.0.0 config file edit

This commit is contained in:
shinya
2025-08-13 00:30:31 +08:00
parent 8b9be4bb19
commit f0e171e71f
14 changed files with 671 additions and 3060 deletions

View File

@@ -7,6 +7,8 @@ import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { useEffect, useState } from 'react';
import { getCustomCategories } from '@/lib/config.client';
interface MobileBottomNavProps {
/**
* 主动指定当前激活的路径。当未提供时,自动使用 usePathname() 获取的路径。
@@ -46,17 +48,18 @@ const MobileBottomNav = ({ activePath }: MobileBottomNavProps) => {
]);
useEffect(() => {
const runtimeConfig = (window as any).RUNTIME_CONFIG;
if (runtimeConfig?.CUSTOM_CATEGORIES?.length > 0) {
setNavItems((prevItems) => [
...prevItems,
{
icon: Star,
label: '自定义',
href: '/douban?type=custom',
},
]);
}
getCustomCategories().then((categories) => {
if (categories.length > 0) {
setNavItems((prevItems) => [
...prevItems,
{
icon: Star,
label: '自定义',
href: '/douban?type=custom',
},
]);
}
});
}, []);
const isActive = (href: string) => {
@@ -97,11 +100,10 @@ const MobileBottomNav = ({ activePath }: MobileBottomNavProps) => {
className='flex flex-col items-center justify-center w-full h-14 gap-1 text-xs'
>
<item.icon
className={`h-6 w-6 ${
active
className={`h-6 w-6 ${active
? 'text-green-600 dark:text-green-400'
: 'text-gray-500 dark:text-gray-400'
}`}
}`}
/>
<span
className={