Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions app/dashboard/company/[slug]/hackathons/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface Hackathon {
excerpt: string
category: string
status: string
approval_status: string
approval_status: 'draft' | 'pending' | 'approved' | 'rejected' | 'changes_requested'
date: string
time: string
duration: string
Expand Down Expand Up @@ -167,8 +167,25 @@ export default function CompanyHackathonsPage() {
}
}

const getStatusBadge = (status: string) => {
switch (status) {
const getStatusBadge = (hackathon: Hackathon) => {
// If not approved, show approval status instead of event status
if (hackathon.approval_status !== 'approved') {
switch (hackathon.approval_status) {
case 'pending':
return <Badge className="bg-yellow-500/10 text-yellow-600 border-yellow-500/20">Pending Review</Badge>
case 'draft':
return <Badge variant="outline">Draft</Badge>
case 'rejected':
return <Badge className="bg-red-500/10 text-red-600 border-red-500/20">Rejected</Badge>
case 'changes_requested':
return <Badge className="bg-orange-500/10 text-orange-600 border-orange-500/20">Changes Requested</Badge>
default:
return <Badge variant="outline">{hackathon.approval_status}</Badge>
}
}

// If approved, show event status
switch (hackathon.status) {
case 'live':
case 'published':
return <Badge className="bg-blue-500/10 text-blue-600 border-blue-500/20">Live</Badge>
Expand All @@ -179,7 +196,7 @@ export default function CompanyHackathonsPage() {
case 'completed':
return <Badge variant="outline" className="text-gray-500">Completed</Badge>
default:
return <Badge variant="outline">{status}</Badge>
return <Badge variant="outline">{hackathon.status}</Badge>
}
}

Expand Down Expand Up @@ -321,7 +338,7 @@ export default function CompanyHackathonsPage() {
<TableCell>
<Badge variant="outline">{hackathon.category || 'General'}</Badge>
</TableCell>
<TableCell>{getStatusBadge(hackathon.status)}</TableCell>
<TableCell>{getStatusBadge(hackathon)}</TableCell>
<TableCell>{getApprovalBadge(hackathon.approval_status)}</TableCell>
<TableCell>
<div className="flex items-center gap-1">
Expand Down
32 changes: 24 additions & 8 deletions components/dashboard/CompanyDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
ArrowDownRight,
Activity,
FileText,
Trophy,
} from 'lucide-react'
import { Company } from '@/types/company'
import { format, formatDistanceToNow } from 'date-fns'
Expand Down Expand Up @@ -229,7 +230,7 @@ export function CompanyDashboard({ company }: CompanyDashboardProps) {
return (
<div className="space-y-6">
{/* Stats Cards */}
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-5">
<StatsCard
title="Total Events"
value={stats.totalEvents}
Expand All @@ -238,6 +239,13 @@ export function CompanyDashboard({ company }: CompanyDashboardProps) {
description="Events hosted"
change={stats.recentChange?.events}
/>
<StatsCard
title="Total Hackathons"
value={stats.totalHackathons}
icon={Trophy}
iconColor="text-orange-400"
description="Hackathons hosted"
/>
<StatsCard
title="Total Views"
value={stats.totalViews}
Expand Down Expand Up @@ -347,14 +355,22 @@ export function CompanyDashboard({ company }: CompanyDashboardProps) {
<CardDescription>Common tasks and shortcuts</CardDescription>
</CardHeader>
<CardContent>
<div className="grid gap-4 md:grid-cols-3">
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
{canManageEvents && (
<QuickActionButton
href={`/dashboard/company/${company.slug}/events/create`}
icon={Plus}
title="Create Event"
description="Host a new event"
/>
<>
<QuickActionButton
href={`/dashboard/company/${company.slug}/events/create`}
icon={Calendar}
title="Create Event"
description="Host a new event"
/>
<QuickActionButton
href={`/dashboard/company/${company.slug}/hackathons/create`}
icon={Trophy}
title="Create Hackathon"
description="Launch a coding challenge"
/>
</>
)}
{canManageTeam && (
<QuickActionButton
Expand Down
Loading