修正獎勵評審資訊、評分資訊
This commit is contained in:
37
app/page.tsx
37
app/page.tsx
@@ -148,7 +148,7 @@ export default function AIShowcasePlatform() {
|
||||
canAccessAdmin,
|
||||
} = useAuth()
|
||||
|
||||
const { competitions, awards, getAwardsByYear, getCompetitionRankings } = useCompetition()
|
||||
const { competitions, awards, getAwardsByYear, getCompetitionRankings, loadingAwards, getAvailableYears } = useCompetition()
|
||||
|
||||
const [showLogin, setShowLogin] = useState(false)
|
||||
const [showRegister, setShowRegister] = useState(false)
|
||||
@@ -193,6 +193,17 @@ export default function AIShowcasePlatform() {
|
||||
showAwardDetail
|
||||
});
|
||||
|
||||
// 動態設定初始年份
|
||||
useEffect(() => {
|
||||
if (awards.length > 0 && selectedYear === 2024) {
|
||||
const availableYears = getAvailableYears();
|
||||
if (availableYears.length > 0) {
|
||||
setSelectedYear(availableYears[0]);
|
||||
console.log('🎯 自動設定年份為:', availableYears[0]);
|
||||
}
|
||||
}
|
||||
}, [awards, selectedYear, getAvailableYears]);
|
||||
|
||||
// 載入應用數據
|
||||
const loadApps = async () => {
|
||||
try {
|
||||
@@ -595,8 +606,11 @@ export default function AIShowcasePlatform() {
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="2024">2024年</SelectItem>
|
||||
<SelectItem value="2023">2023年</SelectItem>
|
||||
{getAvailableYears().map((year) => (
|
||||
<SelectItem key={year} value={year.toString()}>
|
||||
{year}年
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
@@ -720,24 +734,26 @@ export default function AIShowcasePlatform() {
|
||||
{/* Statistics */}
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mt-4">
|
||||
<div className="text-center p-3 bg-blue-50 rounded-lg">
|
||||
<div className="text-lg font-bold text-blue-600">{filteredAwards.length}</div>
|
||||
<div className="text-lg font-bold text-blue-600">
|
||||
{loadingAwards ? '...' : filteredAwards.length}
|
||||
</div>
|
||||
<div className="text-xs text-blue-600">總獎項數</div>
|
||||
</div>
|
||||
<div className="text-center p-3 bg-yellow-50 rounded-lg">
|
||||
<div className="text-lg font-bold text-yellow-600">
|
||||
{filteredAwards.filter((a) => a.rank > 0 && a.rank <= 3).length}
|
||||
{loadingAwards ? '...' : filteredAwards.filter((a) => a.rank > 0 && a.rank <= 3).length}
|
||||
</div>
|
||||
<div className="text-xs text-yellow-600">前三名獎項</div>
|
||||
</div>
|
||||
<div className="text-center p-3 bg-red-50 rounded-lg">
|
||||
<div className="text-lg font-bold text-red-600">
|
||||
{filteredAwards.filter((a) => a.awardType === "popular").length}
|
||||
{loadingAwards ? '...' : filteredAwards.filter((a) => a.awardType === "popular").length}
|
||||
</div>
|
||||
<div className="text-xs text-red-600">人氣獎項</div>
|
||||
</div>
|
||||
<div className="text-center p-3 bg-green-50 rounded-lg">
|
||||
<div className="text-lg font-bold text-green-600">
|
||||
{new Set(filteredAwards.map((a) => `${a.year}-${a.month}`)).size}
|
||||
{loadingAwards ? '...' : new Set(filteredAwards.map((a) => `${a.year}-${a.month}`)).size}
|
||||
</div>
|
||||
<div className="text-xs text-green-600">競賽場次</div>
|
||||
</div>
|
||||
@@ -747,7 +763,12 @@ export default function AIShowcasePlatform() {
|
||||
</Card>
|
||||
|
||||
{/* Awards Grid with Enhanced Display */}
|
||||
{filteredAwards.length > 0 ? (
|
||||
{loadingAwards ? (
|
||||
<div className="text-center py-12">
|
||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"></div>
|
||||
<p className="text-gray-600">載入獎項資料中...</p>
|
||||
</div>
|
||||
) : filteredAwards.length > 0 ? (
|
||||
<div className="space-y-8">
|
||||
{/* Group awards by month */}
|
||||
{Array.from(new Set(filteredAwards.map((award) => award.month)))
|
||||
|
Reference in New Issue
Block a user