feat: 增强标签云组件支持搜索和展开功能
- 将 TagCloud 改造为客户端组件,添加实时搜索功能 - 新增 getTopTags 函数获取热门标签(按项目数量排序) - 支持展开/收起查看所有标签,提升大量标签场景下的用户体验 - 添加标签相关中英文翻译文本 - 新增 scripts/list-tags.js 辅助脚本用于标签统计分析
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
const { PrismaClient } = require('@prisma/client');
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
const tags = await prisma.tag.findMany({
|
||||
include: {
|
||||
_count: {
|
||||
select: { projects: true }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log('=== Tag Statistics ===\n');
|
||||
console.log('Total tags:', tags.length);
|
||||
|
||||
const sortedTags = tags.sort((a, b) => b._count.projects - a._count.projects);
|
||||
|
||||
console.log('\n=== Tags by Project Count ===');
|
||||
sortedTags.forEach((tag, idx) => {
|
||||
console.log(`${idx + 1}. ${tag.name}: ${tag._count.projects} projects`);
|
||||
});
|
||||
|
||||
const unusedTags = tags.filter(t => t._count.projects === 0);
|
||||
console.log(`\n=== Unused Tags (${unusedTags.length}) ===`);
|
||||
unusedTags.forEach(tag => console.log(`- ${tag.name}`));
|
||||
|
||||
const lowActivityTags = tags.filter(t => t._count.projects > 0 && t._count.projects <= 2);
|
||||
console.log(`\n=== Low Activity Tags (1-2 projects) (${lowActivityTags.length}) ===`);
|
||||
lowActivityTags.forEach(tag => console.log(`- ${tag.name}: ${tag._count.projects} projects`));
|
||||
|
||||
const highActivityTags = tags.filter(t => t._count.projects >= 5);
|
||||
console.log(`\n=== High Activity Tags (5+ projects) (${highActivityTags.length}) ===`);
|
||||
highActivityTags.forEach(tag => console.log(`- ${tag.name}: ${tag._count.projects} projects`));
|
||||
}
|
||||
|
||||
main()
|
||||
.catch(console.error)
|
||||
.finally(() => prisma.$disconnect());
|
||||
Reference in New Issue
Block a user