Skip to content

Commit e606400

Browse files
author
Deepak Pandey
committed
feat: Add Core Team application form with authentication
✨ Features: - New Core Team application form at /join/core-team - Complete admin dashboard for managing applications - Authentication required for all application forms - User ID tracking for all applications 🔧 Technical Changes: - Added core_team_applications table with user_id field - Updated all existing forms to require authentication - Added user_id columns to all application tables - Created admin API routes and dashboard pages - Integrated with existing auth system 🎨 UI/UX: - Beautiful Core Team landing page with benefits - Consistent theming across all forms - Responsive design for all screen sizes - Loading states and error handling 📊 Admin Features: - View, filter, and manage all applications - Export functionality to CSV - Status management (approve/reject) - Complete application details view - Statistics dashboard 🔐 Security: - All forms now require user authentication - User ID tracking for better data management - Proper error handling and validation ✅ Build Status: Clean build with no warnings ✅ Database: All tables updated with user_id fields ✅ Testing: All functionality verified
1 parent d114ae7 commit e606400

File tree

14 files changed

+1973
-0
lines changed

14 files changed

+1973
-0
lines changed

app/admin/forms/core-team/page.tsx

Lines changed: 545 additions & 0 deletions
Large diffs are not rendered by default.

app/admin/layout.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
HandHeart,
2323
ClipboardCheck,
2424
Award,
25+
Crown,
2526
} from "lucide-react"
2627
import { useAuth } from "@/lib/hooks/useAuth"
2728

@@ -119,6 +120,11 @@ const sidebarItems: SidebarGroupType[] = [
119120
url: "/admin/forms/volunteer",
120121
icon: HandHeart,
121122
},
123+
{
124+
title: "Core Team",
125+
url: "/admin/forms/core-team",
126+
icon: Crown,
127+
},
122128
],
123129
},
124130
{

app/api/admin-core-team/route.ts

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import { NextResponse } from 'next/server';
2+
import { createClient } from '@supabase/supabase-js';
3+
4+
function getSupabaseClient() {
5+
return createClient(
6+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
7+
process.env.SUPABASE_SERVICE_ROLE_KEY!
8+
);
9+
}
10+
11+
export async function GET() {
12+
try {
13+
const supabase = getSupabaseClient();
14+
15+
const { data, error } = await supabase
16+
.from('core_team_applications')
17+
.select('*')
18+
.order('created_at', { ascending: false });
19+
20+
if (error) {
21+
console.error('Error fetching core team applications:', error);
22+
return NextResponse.json({ error: error.message }, { status: 500 });
23+
}
24+
25+
return NextResponse.json({ applications: data });
26+
} catch (error) {
27+
console.error('Unexpected error:', error);
28+
return NextResponse.json({ error: 'Internal server error' }, { status: 500 });
29+
}
30+
}
31+
32+
export async function POST(req: Request) {
33+
try {
34+
const body = await req.json();
35+
const { id, status, notes } = body;
36+
37+
if (!id || !status) {
38+
return NextResponse.json({ error: 'Missing required fields' }, { status: 400 });
39+
}
40+
41+
const supabase = getSupabaseClient();
42+
43+
const { data, error } = await supabase
44+
.from('core_team_applications')
45+
.update({
46+
status,
47+
updated_at: new Date().toISOString(),
48+
...(notes && { notes })
49+
})
50+
.eq('id', id)
51+
.select()
52+
.single();
53+
54+
if (error) {
55+
console.error('Error updating core team application:', error);
56+
return NextResponse.json({ error: error.message }, { status: 500 });
57+
}
58+
59+
return NextResponse.json({ application: data });
60+
} catch (error) {
61+
console.error('Unexpected error:', error);
62+
return NextResponse.json({ error: 'Internal server error' }, { status: 500 });
63+
}
64+
}
65+
66+
export async function PATCH(req: Request) {
67+
try {
68+
const body = await req.json();
69+
const { id, ...updates } = body;
70+
71+
if (!id) {
72+
return NextResponse.json({ error: 'Missing application ID' }, { status: 400 });
73+
}
74+
75+
const supabase = getSupabaseClient();
76+
77+
const { data, error } = await supabase
78+
.from('core_team_applications')
79+
.update({
80+
...updates,
81+
updated_at: new Date().toISOString()
82+
})
83+
.eq('id', id)
84+
.select()
85+
.single();
86+
87+
if (error) {
88+
console.error('Error updating core team application:', error);
89+
return NextResponse.json({ error: error.message }, { status: 500 });
90+
}
91+
92+
return NextResponse.json({ application: data });
93+
} catch (error) {
94+
console.error('Unexpected error:', error);
95+
return NextResponse.json({ error: 'Internal server error' }, { status: 500 });
96+
}
97+
}

0 commit comments

Comments
 (0)