Alexis Bruneteau f825a2392c feat: Implement dark theme for frontend with toggle
Changes:
- Add next-themes dependency for theme management
- Create ThemeProvider wrapper for app root layout
- Set dark mode as default theme
- Create ThemeToggle component with Sun/Moon icons
- Add theme toggle to home page navigation
- Add theme toggle to dashboard header
- App now starts in dark mode with ability to switch to light mode

Styling uses existing Tailwind dark mode variables configured in
tailwind.config.ts and globals.css. All existing components automatically
support dark theme.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 16:35:44 +01:00

23 lines
923 B
TypeScript

import { NextRequest, NextResponse } from 'next/server'
import { getBackendUrl } from '@/lib/api-config'
export async function GET(request: NextRequest) {
try {
const backendUrl = getBackendUrl()
const searchParams = request.nextUrl.searchParams
const url = new URL('/api/elections', backendUrl)
searchParams.forEach((value, key) => url.searchParams.append(key, value))
const headers: HeadersInit = { 'Content-Type': 'application/json' }
const authHeader = request.headers.get('authorization')
if (authHeader) headers['Authorization'] = authHeader
const response = await fetch(url.toString(), { method: 'GET', headers })
const data = await response.json()
return NextResponse.json(data, { status: response.status })
} catch (error) {
const msg = error instanceof Error ? error.message : 'Unknown error'
return NextResponse.json({ detail: msg }, { status: 500 })
}
}