feat(ui): add login page, club picker, and dashboard
Implements Task 21: Login Page + First-Login Club Picker + Dashboard
New pages:
- Login page: Sign in with Keycloak button, clean centered layout
- Select club page: Club selection cards for multi-club users
- Dashboard: Summary with task/shift counts and quick links
Key features:
- Login delegates to Keycloak via NextAuth signIn('keycloak')
- Club picker shows cards with name + sport type
- Clicking club → setActiveClub() → redirects to /dashboard
- Dashboard shows active club name, open tasks count, upcoming shifts count
- Quick action links to /tasks and /shifts pages
- TanStack Query hooks with proper filters (status: 'Open', future shifts only)
TDD:
- 2 login tests (component export, signIn exists)
- 2 select-club tests (component export, useTenant exists)
- 4 dashboard tests (component export, hooks exist)
Task 21 tests: 8/8 pass. Build succeeds (9 routes registered).
Note: 38 pre-existing tests from Tasks 10,18-20 fail due to Bun+vitest
test infrastructure issues (vi.mocked() not supported, localStorage mock).
This is technical debt to be addressed separately.
2026-03-03 20:44:07 +01:00
|
|
|
'use client';
|
|
|
|
|
|
2026-03-06 08:01:09 +01:00
|
|
|
import { useEffect } from 'react';
|
|
|
|
|
import { signIn, useSession } from 'next-auth/react';
|
|
|
|
|
import { useRouter } from 'next/navigation';
|
feat(ui): add login page, club picker, and dashboard
Implements Task 21: Login Page + First-Login Club Picker + Dashboard
New pages:
- Login page: Sign in with Keycloak button, clean centered layout
- Select club page: Club selection cards for multi-club users
- Dashboard: Summary with task/shift counts and quick links
Key features:
- Login delegates to Keycloak via NextAuth signIn('keycloak')
- Club picker shows cards with name + sport type
- Clicking club → setActiveClub() → redirects to /dashboard
- Dashboard shows active club name, open tasks count, upcoming shifts count
- Quick action links to /tasks and /shifts pages
- TanStack Query hooks with proper filters (status: 'Open', future shifts only)
TDD:
- 2 login tests (component export, signIn exists)
- 2 select-club tests (component export, useTenant exists)
- 4 dashboard tests (component export, hooks exist)
Task 21 tests: 8/8 pass. Build succeeds (9 routes registered).
Note: 38 pre-existing tests from Tasks 10,18-20 fail due to Bun+vitest
test infrastructure issues (vi.mocked() not supported, localStorage mock).
This is technical debt to be addressed separately.
2026-03-03 20:44:07 +01:00
|
|
|
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card';
|
|
|
|
|
import { Button } from '@/components/ui/button';
|
|
|
|
|
|
|
|
|
|
export default function LoginPage() {
|
2026-03-06 08:01:09 +01:00
|
|
|
const { status } = useSession();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
// Redirect to dashboard if already authenticated
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (status === 'authenticated') {
|
|
|
|
|
router.push('/dashboard');
|
|
|
|
|
}
|
|
|
|
|
}, [status, router]);
|
|
|
|
|
|
feat(ui): add login page, club picker, and dashboard
Implements Task 21: Login Page + First-Login Club Picker + Dashboard
New pages:
- Login page: Sign in with Keycloak button, clean centered layout
- Select club page: Club selection cards for multi-club users
- Dashboard: Summary with task/shift counts and quick links
Key features:
- Login delegates to Keycloak via NextAuth signIn('keycloak')
- Club picker shows cards with name + sport type
- Clicking club → setActiveClub() → redirects to /dashboard
- Dashboard shows active club name, open tasks count, upcoming shifts count
- Quick action links to /tasks and /shifts pages
- TanStack Query hooks with proper filters (status: 'Open', future shifts only)
TDD:
- 2 login tests (component export, signIn exists)
- 2 select-club tests (component export, useTenant exists)
- 4 dashboard tests (component export, hooks exist)
Task 21 tests: 8/8 pass. Build succeeds (9 routes registered).
Note: 38 pre-existing tests from Tasks 10,18-20 fail due to Bun+vitest
test infrastructure issues (vi.mocked() not supported, localStorage mock).
This is technical debt to be addressed separately.
2026-03-03 20:44:07 +01:00
|
|
|
const handleSignIn = () => {
|
2026-03-06 08:01:09 +01:00
|
|
|
signIn('keycloak', { callbackUrl: '/dashboard' });
|
feat(ui): add login page, club picker, and dashboard
Implements Task 21: Login Page + First-Login Club Picker + Dashboard
New pages:
- Login page: Sign in with Keycloak button, clean centered layout
- Select club page: Club selection cards for multi-club users
- Dashboard: Summary with task/shift counts and quick links
Key features:
- Login delegates to Keycloak via NextAuth signIn('keycloak')
- Club picker shows cards with name + sport type
- Clicking club → setActiveClub() → redirects to /dashboard
- Dashboard shows active club name, open tasks count, upcoming shifts count
- Quick action links to /tasks and /shifts pages
- TanStack Query hooks with proper filters (status: 'Open', future shifts only)
TDD:
- 2 login tests (component export, signIn exists)
- 2 select-club tests (component export, useTenant exists)
- 4 dashboard tests (component export, hooks exist)
Task 21 tests: 8/8 pass. Build succeeds (9 routes registered).
Note: 38 pre-existing tests from Tasks 10,18-20 fail due to Bun+vitest
test infrastructure issues (vi.mocked() not supported, localStorage mock).
This is technical debt to be addressed separately.
2026-03-03 20:44:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex items-center justify-center min-h-screen bg-gray-50">
|
|
|
|
|
<Card className="w-96">
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<CardTitle className="text-2xl text-center">WorkClub Manager</CardTitle>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent>
|
|
|
|
|
<Button onClick={handleSignIn} className="w-full">
|
|
|
|
|
Sign in with Keycloak
|
|
|
|
|
</Button>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|