mirror of
https://github.com/soconnor0919/beenvoice.git
synced 2025-12-13 01:24:44 -05:00
- Add comprehensive CSV import system with drag-and-drop upload and validation - Create UniversalTable component with advanced filtering, searching, and batch actions - Implement invoice management (view, edit, delete) with professional PDF export - Add client management with full CRUD operations - Set up authentication with NextAuth.js and email/password login - Configure database schema with users, clients, invoices, and invoice_items tables - Build responsive UI with shadcn/ui components and emerald branding - Add type-safe API layer with tRPC and Zod validation - Include proper error handling and user feedback with toast notifications - Set up development environment with Bun, TypeScript, and Tailwind CSS
124 lines
4.3 KiB
TypeScript
124 lines
4.3 KiB
TypeScript
"use client";
|
|
|
|
import Link from "next/link";
|
|
import { useState } from "react";
|
|
import { useRouter } from "next/navigation";
|
|
import { signIn } from "next-auth/react";
|
|
import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card";
|
|
import { Input } from "~/components/ui/input";
|
|
import { Button } from "~/components/ui/button";
|
|
import { Label } from "~/components/ui/label";
|
|
import { toast } from "sonner";
|
|
import { Logo } from "~/components/logo";
|
|
import { Mail, Lock, ArrowRight } from "lucide-react";
|
|
|
|
export default function SignInPage() {
|
|
const router = useRouter();
|
|
const [email, setEmail] = useState("");
|
|
const [password, setPassword] = useState("");
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
async function handleSignIn(e: React.FormEvent) {
|
|
e.preventDefault();
|
|
setLoading(true);
|
|
|
|
const result = await signIn("credentials", {
|
|
email,
|
|
password,
|
|
redirect: false,
|
|
});
|
|
|
|
setLoading(false);
|
|
|
|
if (result?.error) {
|
|
toast.error("Invalid email or password");
|
|
} else {
|
|
toast.success("Signed in successfully!");
|
|
router.push("/dashboard");
|
|
router.refresh();
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-screen bg-gradient-to-br from-green-50 to-emerald-100 flex items-center justify-center p-4">
|
|
<div className="w-full max-w-md space-y-8">
|
|
{/* Logo and Welcome */}
|
|
<div className="text-center space-y-4">
|
|
<Logo size="lg" className="mx-auto" />
|
|
<div>
|
|
<h1 className="text-2xl font-bold text-gray-900">Welcome back</h1>
|
|
<p className="text-gray-600 mt-2">Sign in to your beenvoice account</p>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Sign In Form */}
|
|
<Card className="shadow-xl border-0">
|
|
<CardHeader className="space-y-1">
|
|
<CardTitle className="text-xl text-center">Sign In</CardTitle>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<form onSubmit={handleSignIn} className="space-y-4">
|
|
<div className="space-y-2">
|
|
<Label htmlFor="email">Email</Label>
|
|
<div className="relative">
|
|
<Mail className="absolute left-3 top-3 h-4 w-4 text-gray-400" />
|
|
<Input
|
|
id="email"
|
|
type="email"
|
|
value={email}
|
|
onChange={e => setEmail(e.target.value)}
|
|
required
|
|
autoFocus
|
|
className="pl-10"
|
|
placeholder="Enter your email"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div className="space-y-2">
|
|
<Label htmlFor="password">Password</Label>
|
|
<div className="relative">
|
|
<Lock className="absolute left-3 top-3 h-4 w-4 text-gray-400" />
|
|
<Input
|
|
id="password"
|
|
type="password"
|
|
value={password}
|
|
onChange={e => setPassword(e.target.value)}
|
|
required
|
|
className="pl-10"
|
|
placeholder="Enter your password"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<Button type="submit" className="w-full" disabled={loading}>
|
|
{loading ? (
|
|
"Signing in..."
|
|
) : (
|
|
<>
|
|
Sign In
|
|
<ArrowRight className="ml-2 h-4 w-4" />
|
|
</>
|
|
)}
|
|
</Button>
|
|
</form>
|
|
<div className="mt-6 text-center text-sm">
|
|
<span className="text-gray-600">Don't have an account? </span>
|
|
<Link href="/auth/register" className="text-green-600 hover:text-green-700 font-medium">
|
|
Create one now
|
|
</Link>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
|
|
{/* Features */}
|
|
<div className="text-center space-y-4">
|
|
<p className="text-sm text-gray-500">Simple invoicing for freelancers and small businesses</p>
|
|
<div className="flex justify-center space-x-6 text-xs text-gray-400">
|
|
<span>✓ Easy client management</span>
|
|
<span>✓ Professional invoices</span>
|
|
<span>✓ Payment tracking</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|