Add documentation, clean repository templating

This commit is contained in:
2025-07-18 01:38:43 -04:00
parent 1a503d818b
commit 4f8402c5e6
33 changed files with 8178 additions and 152 deletions

View File

@@ -0,0 +1,131 @@
"use client";
import { useState } from "react";
import Link from "next/link";
import { signIn } from "next-auth/react";
import { useRouter } from "next/navigation";
import { Button } from "~/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "~/components/ui/card";
import { Input } from "~/components/ui/input";
import { Label } from "~/components/ui/label";
export default function SignInPage() {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState("");
const router = useRouter();
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
setIsLoading(true);
setError("");
try {
const result = await signIn("credentials", {
email,
password,
redirect: false,
});
if (result?.error) {
setError("Invalid email or password");
} else {
router.push("/");
router.refresh();
}
} catch (error) {
setError("An error occurred. Please try again.");
} finally {
setIsLoading(false);
}
};
return (
<div className="flex min-h-screen items-center justify-center bg-gradient-to-br from-slate-50 to-slate-100 px-4">
<div className="w-full max-w-md">
{/* Header */}
<div className="mb-8 text-center">
<Link href="/" className="inline-block">
<h1 className="text-3xl font-bold text-slate-900">HRIStudio</h1>
</Link>
<p className="mt-2 text-slate-600">
Sign in to your research account
</p>
</div>
{/* Sign In Card */}
<Card>
<CardHeader>
<CardTitle>Welcome back</CardTitle>
<CardDescription>
Enter your credentials to access your account
</CardDescription>
</CardHeader>
<CardContent>
<form onSubmit={handleSubmit} className="space-y-4">
{error && (
<div className="rounded-md bg-red-50 p-3 text-sm text-red-700">
{error}
</div>
)}
<div className="space-y-2">
<Label htmlFor="email">Email</Label>
<Input
id="email"
type="email"
placeholder="your.email@example.com"
value={email}
onChange={(e) => setEmail(e.target.value)}
required
disabled={isLoading}
/>
</div>
<div className="space-y-2">
<Label htmlFor="password">Password</Label>
<Input
id="password"
type="password"
placeholder="Enter your password"
value={password}
onChange={(e) => setPassword(e.target.value)}
required
disabled={isLoading}
/>
</div>
<Button type="submit" className="w-full" disabled={isLoading}>
{isLoading ? "Signing in..." : "Sign In"}
</Button>
</form>
<div className="mt-6 text-center text-sm text-slate-600">
Don't have an account?{" "}
<Link
href="/auth/signup"
className="font-medium text-blue-600 hover:text-blue-500"
>
Sign up here
</Link>
</div>
</CardContent>
</Card>
{/* Footer */}
<div className="mt-8 text-center text-xs text-slate-500">
<p>
© 2024 HRIStudio. A platform for Human-Robot Interaction research.
</p>
</div>
</div>
</div>
);
}