修正得獎資訊團體賽的名稱

This commit is contained in:
2025-09-27 17:43:01 +08:00
parent 88c3fde372
commit 4a3a0052f0
5 changed files with 134 additions and 48 deletions

View File

@@ -140,7 +140,11 @@ export async function GET(request: NextRequest) {
id: award.id,
competition_name: (award as any).competition_name,
competition_type: (award as any).competition_type,
competition_id: award.competition_id
competition_id: award.competition_id,
team_name_from_teams: (award as any).team_name_from_teams,
team_name: (award as any).team_name,
app_name: (award as any).app_name,
team_id: (award as any).team_id
});
return {
@@ -156,9 +160,9 @@ export async function GET(request: NextRequest) {
awardType: award.award_type,
teamName: (award as any).team_name_from_teams || award.team_name,
appName: award.app_name,
applicationLinks: award.application_links ? JSON.parse(award.application_links) : null,
documents: award.documents ? JSON.parse(award.documents) : [],
photos: award.photos ? JSON.parse(award.photos) : [],
applicationLinks: (award as any).application_links ? JSON.parse((award as any).application_links) : null,
documents: (award as any).documents ? JSON.parse((award as any).documents) : [],
photos: (award as any).photos ? JSON.parse((award as any).photos) : [],
};
});

View File

@@ -398,7 +398,7 @@ export default function CompetitionPage() {
{monthAwards.map((award) => (
<Card
key={award.id}
className="relative overflow-hidden border-0 shadow-lg bg-gradient-to-br from-white to-gray-50 hover:shadow-xl transition-shadow cursor-pointer"
className="relative overflow-hidden border-0 shadow-lg bg-gradient-to-br from-white to-gray-50 hover:shadow-xl transition-shadow cursor-pointer h-[320px] flex flex-col"
onClick={() => handleShowAwardDetail(award)}
>
{/* Rank Badge */}
@@ -422,7 +422,7 @@ export default function CompetitionPage() {
<div className="absolute top-4 right-4 text-3xl">{award.icon}</div>
<CardHeader className="pb-3 pt-12">
<CardHeader className="pb-3 pt-12 flex-shrink-0">
<div className="space-y-2">
<div className="flex flex-wrap gap-2">
<Badge
@@ -450,11 +450,33 @@ export default function CompetitionPage() {
</Badge>
</div>
<CardTitle className="text-lg line-clamp-2">
{award.competitionType === "team"
? (award.teamName || "團隊名稱")
: (award.appName || award.proposalTitle || "應用名稱")
}
<CardTitle className="text-lg line-clamp-2 min-h-[2.5rem]">
{(() => {
console.log('🔍 獎項資料:', {
id: award.id,
competitionType: award.competitionType,
teamName: award.teamName,
appName: award.appName,
proposalTitle: award.proposalTitle,
team_name: (award as any).team_name,
team_name_from_teams: (award as any).team_name_from_teams
});
// 團體賽優先顯示團隊名稱
if (award.competitionType === "team") {
// 優先使用從teams表查詢的團隊名稱其次使用獎項表中的團隊名稱
const teamName = (award as any).team_name_from_teams || award.teamName || (award as any).team_name;
return teamName || "團隊名稱";
}
// 提案賽顯示提案標題
if (award.competitionType === "proposal") {
return award.proposalTitle || "提案標題";
}
// 個人賽顯示應用名稱
return award.appName || "應用名稱";
})()}
</CardTitle>
<p className="text-sm text-gray-500">by {award.creator}</p>
<div className="text-xs text-gray-400">
@@ -463,8 +485,8 @@ export default function CompetitionPage() {
</div>
</CardHeader>
<CardContent className="pt-0">
<div className="space-y-4">
<CardContent className="pt-0 flex-grow flex flex-col justify-between">
<div className="space-y-4 flex-grow">
<div className="flex items-center justify-between">
<span className="text-sm text-gray-600">
{award.competitionType === "proposal"
@@ -483,17 +505,17 @@ export default function CompetitionPage() {
: award.score}
</span>
</div>
<Button
className="w-full bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700"
onClick={(e) => {
e.stopPropagation()
handleShowAwardDetail(award)
}}
>
</Button>
</div>
<Button
className="w-full bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 mt-4"
onClick={(e) => {
e.stopPropagation()
handleShowAwardDetail(award)
}}
>
</Button>
</CardContent>
</Card>
))}

View File

@@ -798,7 +798,7 @@ export default function AIShowcasePlatform() {
{monthAwards.map((award) => (
<Card
key={award.id}
className="relative overflow-hidden border-0 shadow-lg bg-gradient-to-br from-white to-gray-50 hover:shadow-xl transition-shadow cursor-pointer"
className="relative overflow-hidden border-0 shadow-lg bg-gradient-to-br from-white to-gray-50 hover:shadow-xl transition-shadow cursor-pointer h-[320px] flex flex-col"
onClick={() => handleShowAwardDetail(award)}
>
{/* Rank Badge */}
@@ -822,7 +822,7 @@ export default function AIShowcasePlatform() {
<div className="absolute top-4 right-4 text-3xl">{award.icon}</div>
<CardHeader className="pb-3 pt-12">
<CardHeader className="pb-3 pt-12 flex-shrink-0">
<div className="space-y-2">
<div className="flex flex-wrap gap-2">
<Badge
@@ -850,8 +850,22 @@ export default function AIShowcasePlatform() {
</Badge>
</div>
<CardTitle className="text-lg line-clamp-2">
{award.appName || award.awardName}
<CardTitle className="text-lg line-clamp-2 min-h-[2.5rem]">
{(() => {
// 團體賽優先顯示團隊名稱
if (award.competitionType === "team") {
const teamName = (award as any).team_name_from_teams || award.teamName || (award as any).team_name;
return teamName || "團隊名稱";
}
// 提案賽顯示提案標題
if (award.competitionType === "proposal") {
return award.proposalTitle || "提案標題";
}
// 個人賽顯示應用名稱
return award.appName || award.awardName || "應用名稱";
})()}
</CardTitle>
<p className="text-sm text-gray-500">by {award.creator}</p>
<div className="text-xs text-gray-400">
@@ -860,8 +874,8 @@ export default function AIShowcasePlatform() {
</div>
</CardHeader>
<CardContent className="pt-0">
<div className="space-y-4">
<CardContent className="pt-0 flex-grow flex flex-col justify-between">
<div className="space-y-4 flex-grow">
<div className="flex items-center justify-between">
<span className="text-sm text-gray-600">
{award.awardType === "popular"
@@ -878,17 +892,17 @@ export default function AIShowcasePlatform() {
: award.score}
</span>
</div>
<Button
className="w-full bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700"
onClick={(e) => {
e.stopPropagation()
handleShowAwardDetail(award)
}}
>
</Button>
</div>
<Button
className="w-full bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 mt-4"
onClick={(e) => {
e.stopPropagation()
handleShowAwardDetail(award)
}}
>
</Button>
</CardContent>
</Card>
))}