实现用户反馈功能,支持 Bug 反馈和意见建议提交: - 添加 feedbacks 数据库表和 Repository 层 - 用户端 API: POST /api/feedback - 管理端 API: GET/PATCH 反馈列表和状态管理 - 用户端反馈表单页面 (/game/settings/feedback) - 管理端反馈列表页面 (/admin/feedback) - 首页快捷入口添加"意见反馈"链接 同时包含代码格式化(linter 自动修复) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
58 lines
1.5 KiB
TypeScript
58 lines
1.5 KiB
TypeScript
'use client';
|
|
|
|
import {
|
|
screenshotCategories,
|
|
screenshots as screenshotGroups,
|
|
type Screenshot,
|
|
} from '@/data/screenshot';
|
|
import { useMemo, useState } from 'react';
|
|
import { CategoryTabs } from './CategoryTabs';
|
|
import { ScreenshotGrid } from './ScreenshotGrid';
|
|
|
|
export function ScreenshotGallery() {
|
|
const [activeCategory, setActiveCategory] = useState('all');
|
|
|
|
// Flatten all screenshots with explicit type
|
|
const allScreenshots: Screenshot[] = useMemo(() => {
|
|
return screenshotGroups.flatMap((group) => group.screenshots);
|
|
}, []);
|
|
|
|
// Filter screenshots by category
|
|
const filteredScreenshots = useMemo(() => {
|
|
if (activeCategory === 'all') {
|
|
return allScreenshots;
|
|
}
|
|
return allScreenshots.filter((s) => s.category === activeCategory);
|
|
}, [activeCategory, allScreenshots]);
|
|
|
|
// Calculate counts for each category
|
|
const categoryCounts = useMemo(() => {
|
|
const counts: Record<string, number> = {
|
|
all: allScreenshots.length,
|
|
};
|
|
|
|
screenshotCategories.forEach((cat) => {
|
|
if (cat.id !== 'all') {
|
|
counts[cat.id] = allScreenshots.filter(
|
|
(s) => s.category === cat.id,
|
|
).length;
|
|
}
|
|
});
|
|
|
|
return counts;
|
|
}, [allScreenshots]);
|
|
|
|
return (
|
|
<div className="screenshot-gallery">
|
|
<CategoryTabs
|
|
categories={screenshotCategories}
|
|
activeCategory={activeCategory}
|
|
counts={categoryCounts}
|
|
onCategoryChange={setActiveCategory}
|
|
/>
|
|
|
|
<ScreenshotGrid screenshots={filteredScreenshots} />
|
|
</div>
|
|
);
|
|
}
|