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,7 @@ import { Suspense } from 'react';
import { useCallback, useEffect, useRef, useState } from 'react';
import { GetBangumiCalendarData } from '@/lib/bangumi.client';
import { getCustomCategories } from '@/lib/config.client';
import {
getDoubanCategories,
getDoubanList,
@@ -80,10 +81,9 @@ function DoubanPageClient() {
// 获取自定义分类数据
useEffect(() => {
const runtimeConfig = (window as any).RUNTIME_CONFIG;
if (runtimeConfig?.CUSTOM_CATEGORIES?.length > 0) {
setCustomCategories(runtimeConfig.CUSTOM_CATEGORIES);
}
getCustomCategories().then((categories) => {
setCustomCategories(categories);
});
}, []);
// 同步最新参数值到 ref
@@ -214,7 +214,7 @@ function DoubanPageClient() {
snapshot1.selectedWeekday === snapshot2.selectedWeekday &&
snapshot1.currentPage === snapshot2.currentPage &&
JSON.stringify(snapshot1.multiLevelSelection) ===
JSON.stringify(snapshot2.multiLevelSelection)
JSON.stringify(snapshot2.multiLevelSelection)
);
},
[]
@@ -686,12 +686,12 @@ function DoubanPageClient() {
return type === 'movie'
? '电影'
: type === 'tv'
? '电视剧'
: type === 'anime'
? '动漫'
: type === 'show'
? '综艺'
: '自定义';
? '电视剧'
: type === 'anime'
? '动漫'
: type === 'show'
? '综艺'
: '自定义';
};
const getPageDescription = () => {
@@ -757,24 +757,24 @@ function DoubanPageClient() {
<div className='justify-start grid grid-cols-3 gap-x-2 gap-y-12 px-0 sm:px-2 sm:grid-cols-[repeat(auto-fill,minmax(160px,1fr))] sm:gap-x-8 sm:gap-y-20'>
{loading || !selectorsReady
? // 显示骨架屏
skeletonData.map((index) => <DoubanCardSkeleton key={index} />)
skeletonData.map((index) => <DoubanCardSkeleton key={index} />)
: // 显示实际数据
doubanData.map((item, index) => (
<div key={`${item.title}-${index}`} className='w-full'>
<VideoCard
from='douban'
title={item.title}
poster={item.poster}
douban_id={Number(item.id)}
rate={item.rate}
year={item.year}
type={type === 'movie' ? 'movie' : ''} // 电影类型严格控制tv 不控
isBangumi={
type === 'anime' && primarySelection === '每日放送'
}
/>
</div>
))}
doubanData.map((item, index) => (
<div key={`${item.title}-${index}`} className='w-full'>
<VideoCard
from='douban'
title={item.title}
poster={item.poster}
douban_id={Number(item.id)}
rate={item.rate}
year={item.year}
type={type === 'movie' ? 'movie' : ''} // 电影类型严格控制tv 不控
isBangumi={
type === 'anime' && primarySelection === '每日放送'
}
/>
</div>
))}
</div>
{/* 加载更多指示器 */}