Seed: saas template (34 files)

This commit is contained in:
2026-07-23 22:08:28 +00:00
parent cf7f68eb93
commit cf59c252e2
+132
View File
@@ -0,0 +1,132 @@
import { useState } from "react";
import { toast } from "sonner";
import { Link } from "react-router-dom";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Checkbox } from "@/components/ui/checkbox";
import { Separator } from "@/components/ui/separator";
import { Layers, CheckCircle2 } from "lucide-react";
import { useAuth } from "@/hooks/use-tygarun";
export default function SignupPage() {
const { signup, loading } = useAuth();
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [confirmPassword, setConfirmPassword] = useState("");
const [terms, setTerms] = useState(false);
const [success, setSuccess] = useState(false);
return (
<div className="min-h-screen bg-gradient-to-br from-slate-950 via-indigo-950 to-slate-900 flex items-center justify-center p-6">
<div className="w-full max-w-md">
{/* Logo */}
<Link to="/" className="flex items-center justify-center gap-2 mb-8">
<div className="h-10 w-10 rounded-xl bg-gradient-to-br from-indigo-500 to-cyan-500 flex items-center justify-center">
<Layers className="h-5 w-5 text-white" />
</div>
<span className="text-2xl font-bold text-white tracking-tight">Nexus</span>
</Link>
<Card className="border-slate-800 bg-slate-900/50 backdrop-blur-xl shadow-2xl">
<CardContent className="p-8">
<div className="text-center mb-8">
<h1 className="text-2xl font-bold text-white">Create your account</h1>
<p className="text-slate-400 mt-1 text-sm">Start your 14-day free trial</p>
</div>
{success && (
<div className="mb-6 flex items-center gap-2 rounded-lg bg-green-500/10 border border-green-500/20 px-4 py-3 text-sm text-green-400">
<CheckCircle2 className="h-4 w-4 flex-shrink-0" /> Account created! Redirecting to dashboard...
</div>
)}
<form onSubmit={async (e) => { e.preventDefault(); try { await signup({ name, email, password }); setSuccess(true); toast.success("Account created! Check your email."); } catch (err) { toast.error("Sign up failed. Please try again."); } }} className="space-y-4">
<div>
<Label htmlFor="name" className="text-slate-300 text-sm">Full name</Label>
<Input
id="name"
required
placeholder="John Doe"
value={name}
onChange={(e) => setName(e.target.value)}
className="mt-1.5 bg-slate-800/50 border-slate-700 text-white placeholder:text-slate-500 focus:border-indigo-500 focus:ring-indigo-500/20"
/>
</div>
<div>
<Label htmlFor="signup-email" className="text-slate-300 text-sm">Email</Label>
<Input
id="signup-email"
type="email"
required
placeholder="you@company.com"
value={email}
onChange={(e) => setEmail(e.target.value)}
className="mt-1.5 bg-slate-800/50 border-slate-700 text-white placeholder:text-slate-500 focus:border-indigo-500 focus:ring-indigo-500/20"
/>
</div>
<div>
<Label htmlFor="signup-password" className="text-slate-300 text-sm">Password</Label>
<Input
id="signup-password"
type="password"
required
placeholder="Create a password"
value={password}
onChange={(e) => setPassword(e.target.value)}
className="mt-1.5 bg-slate-800/50 border-slate-700 text-white placeholder:text-slate-500 focus:border-indigo-500 focus:ring-indigo-500/20"
/>
</div>
<div>
<Label htmlFor="confirm-password" className="text-slate-300 text-sm">Confirm password</Label>
<Input
id="confirm-password"
type="password"
required
placeholder="Confirm your password"
value={confirmPassword}
onChange={(e) => setConfirmPassword(e.target.value)}
className="mt-1.5 bg-slate-800/50 border-slate-700 text-white placeholder:text-slate-500 focus:border-indigo-500 focus:ring-indigo-500/20"
/>
</div>
<div className="flex items-start gap-2 pt-1">
<Checkbox
id="terms"
required
checked={terms}
onCheckedChange={(checked) => setTerms(checked === true)}
className="border-slate-600 data-[state=checked]:bg-indigo-600 data-[state=checked]:border-indigo-600 mt-0.5"
/>
<Label htmlFor="terms" className="text-xs text-slate-400 leading-relaxed">
I agree to the <a href="#" className="text-indigo-400 hover:text-indigo-300">Terms of Service</a> and <a href="#" className="text-indigo-400 hover:text-indigo-300">Privacy Policy</a>
</Label>
</div>
<Button type="submit" disabled={loading} className="active:scale-[0.98] w-full bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg mt-2 font-semibold">
{loading ? "Creating Account..." : "Create Account"}
</Button>
</form>
<div className="relative my-6">
<Separator className="bg-slate-700" />
<span className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-slate-900 px-3 text-xs text-slate-500">or</span>
</div>
<Button variant="outline" className="active:scale-[0.98] w-full border-slate-700 text-slate-300 hover:bg-slate-800 hover:text-white rounded-lg">
<svg className="mr-2 h-4 w-4" viewBox="0 0 24 24"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/></svg>
Sign up with Google
</Button>
<p className="mt-6 text-center text-sm text-slate-400">
Already have an account?{" "}
<Link to="/login" className="text-indigo-400 hover:text-indigo-300 font-medium">Sign in</Link>
</p>
</CardContent>
</Card>
</div>
</div>
);
}