mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-04 22:51:13 +00:00
Refactor plugin store types and update category logic
Simplified PluginStoreItem types by removing unused fields and standardizing the minimum version property. Updated frontend plugin store page to use new categories ('官方', '工具', '娱乐', '其它') instead of download-based sorting, aligning with the revised type definitions.
This commit is contained in:
parent
ab2dfcfd8f
commit
8b676ed693
@ -5,7 +5,8 @@ import { builtinModules } from 'module';
|
||||
import fs from 'fs';
|
||||
|
||||
const nodeModules = [...builtinModules, builtinModules.map((m) => `node:${m}`)].flat();
|
||||
|
||||
// 依赖排除
|
||||
const external = [];
|
||||
// 构建后拷贝插件
|
||||
function copyToShellPlugin () {
|
||||
return {
|
||||
@ -68,7 +69,10 @@ export default defineConfig({
|
||||
entry: 'index.ts',
|
||||
formats: ['es'],
|
||||
fileName: () => 'index.mjs',
|
||||
}
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [...nodeModules, ...external],
|
||||
},
|
||||
},
|
||||
plugins: [nodeResolve(), copyToShellPlugin()],
|
||||
});
|
||||
|
||||
@ -7,17 +7,9 @@ export interface PluginStoreItem {
|
||||
description: string; // 插件描述
|
||||
author: string; // 作者
|
||||
homepage?: string; // 主页链接
|
||||
repository?: string; // 仓库地址
|
||||
downloadUrl: string; // 下载地址
|
||||
tags?: string[]; // 标签
|
||||
icon?: string; // 图标URL
|
||||
screenshots?: string[]; // 截图
|
||||
minNapCatVersion?: string; // 最低NapCat版本要求
|
||||
dependencies?: Record<string, string>; // 依赖
|
||||
downloads?: number; // 下载次数
|
||||
rating?: number; // 评分
|
||||
createdAt?: string; // 创建时间
|
||||
updatedAt?: string; // 更新时间
|
||||
minVersion?: string; // 最低版本要求
|
||||
}
|
||||
|
||||
export interface PluginStoreList {
|
||||
|
||||
@ -64,16 +64,13 @@ export default function PluginStorePage () {
|
||||
);
|
||||
}
|
||||
|
||||
// 按下载量排序
|
||||
filtered.sort((a, b) => (b.downloads || 0) - (a.downloads || 0));
|
||||
|
||||
// 定义主要分类
|
||||
const categories: Record<string, PluginStoreItem[]> = {
|
||||
all: filtered,
|
||||
popular: filtered.filter(p => (p.downloads || 0) > 5000),
|
||||
tools: filtered.filter(p => p.tags?.some(t => ['工具', '管理', '群管理'].includes(t))),
|
||||
entertainment: filtered.filter(p => p.tags?.some(t => ['娱乐', '音乐', '游戏'].includes(t))),
|
||||
message: filtered.filter(p => p.tags?.some(t => ['消息处理', '自动回复', '欢迎'].includes(t))),
|
||||
official: filtered.filter(p => p.tags?.includes('官方')),
|
||||
tools: filtered.filter(p => p.tags?.includes('工具')),
|
||||
entertainment: filtered.filter(p => p.tags?.includes('娱乐')),
|
||||
other: filtered.filter(p => !p.tags?.some(t => ['官方', '工具', '娱乐'].includes(t))),
|
||||
};
|
||||
|
||||
return categories;
|
||||
@ -82,10 +79,10 @@ export default function PluginStorePage () {
|
||||
const tabs = useMemo(() => {
|
||||
return [
|
||||
{ key: 'all', title: '全部', count: categorizedPlugins.all?.length || 0 },
|
||||
{ key: 'popular', title: '热门推荐', count: categorizedPlugins.popular?.length || 0 },
|
||||
{ key: 'tools', title: '工具管理', count: categorizedPlugins.tools?.length || 0 },
|
||||
{ key: 'entertainment', title: '娱乐功能', count: categorizedPlugins.entertainment?.length || 0 },
|
||||
{ key: 'message', title: '消息处理', count: categorizedPlugins.message?.length || 0 },
|
||||
{ key: 'official', title: '官方', count: categorizedPlugins.official?.length || 0 },
|
||||
{ key: 'tools', title: '工具', count: categorizedPlugins.tools?.length || 0 },
|
||||
{ key: 'entertainment', title: '娱乐', count: categorizedPlugins.entertainment?.length || 0 },
|
||||
{ key: 'other', title: '其它', count: categorizedPlugins.other?.length || 0 },
|
||||
];
|
||||
}, [categorizedPlugins]);
|
||||
|
||||
|
||||
@ -7,17 +7,9 @@ export interface PluginStoreItem {
|
||||
description: string; // 插件描述
|
||||
author: string; // 作者
|
||||
homepage?: string; // 主页链接
|
||||
repository?: string; // 仓库地址
|
||||
downloadUrl: string; // 下载地址
|
||||
tags?: string[]; // 标签
|
||||
icon?: string; // 图标URL
|
||||
screenshots?: string[]; // 截图
|
||||
minNapCatVersion?: string; // 最低NapCat版本要求
|
||||
dependencies?: Record<string, string>; // 依赖
|
||||
downloads?: number; // 下载次数
|
||||
rating?: number; // 评分
|
||||
createdAt?: string; // 创建时间
|
||||
updatedAt?: string; // 更新时间
|
||||
minVersion?: string; // 最低版本要求
|
||||
}
|
||||
|
||||
export interface PluginStoreList {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user