mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-02-19 07:44:43 +08:00
feat: init 2.0.0 config file edit
This commit is contained in:
@@ -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={
|
||||
|
||||
Reference in New Issue
Block a user