feat(auth): redesign auth pages with glass UI and motion animations
- error page: replace Card with glass-strong panel, add AlertTriangle icon - signin page: add framer-motion entrance animation, CalendarDays branding, Loader2 spinner while loading, merge isPending/session checks - signout page: replace Card with glass-strong panel, add LogOut icon, tighten user identity display
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { AlertTriangle } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { Suspense } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
|
||||
function Search() {
|
||||
function ErrorMessage() {
|
||||
const searchParams = useSearchParams();
|
||||
const errorMessage = searchParams.get("error");
|
||||
|
||||
@@ -16,7 +16,7 @@ function Search() {
|
||||
: "An authentication error occurred";
|
||||
|
||||
return (
|
||||
<div className="text-center p-3 bg-background rounded-lg">
|
||||
<div className="rounded-lg bg-destructive/10 border border-destructive/20 px-4 py-3 text-sm text-destructive">
|
||||
{sanitizedError}
|
||||
</div>
|
||||
);
|
||||
@@ -24,22 +24,24 @@ function Search() {
|
||||
|
||||
export default function AuthErrorPage() {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-background p-4">
|
||||
<Card className="w-full max-w-md bg-red-400 dark:bg-red-600">
|
||||
<CardHeader className="text-center">
|
||||
<CardTitle className="text-2xl font-bold">Error</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="flex items-center justify-center py-20">
|
||||
<div className="glass-strong rounded-2xl p-8 w-full max-w-sm space-y-6">
|
||||
<div className="text-center">
|
||||
<AlertTriangle className="h-8 w-8 text-destructive mx-auto mb-3" />
|
||||
<h1 className="text-lg font-semibold">Authentication Error</h1>
|
||||
<p className="text-sm text-muted-foreground mt-1">
|
||||
Something went wrong during sign in
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Suspense>
|
||||
<Search />
|
||||
<ErrorMessage />
|
||||
</Suspense>
|
||||
<div className="flex flex-row">
|
||||
<Button variant="secondary" asChild>
|
||||
|
||||
<Button variant="outline" asChild className="w-full">
|
||||
<Link href="/">Go back to Homepage</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
import { CalendarDays, Loader2 } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { signIn, useSession } from "@/lib/auth-client";
|
||||
|
||||
export default function SignInPage() {
|
||||
@@ -39,43 +34,46 @@ export default function SignInPage() {
|
||||
}
|
||||
};
|
||||
|
||||
if (isPending) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (session?.user) {
|
||||
if (isPending || session?.user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-background p-4">
|
||||
<Card className="w-full max-w-md">
|
||||
<CardHeader className="text-center">
|
||||
<CardTitle className="text-2xl font-bold">Welcome</CardTitle>
|
||||
<CardDescription>
|
||||
Sign in to access AI-powered calendar features
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="min-h-screen flex items-center justify-center p-4">
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 16 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.3 }}
|
||||
className="glass-strong p-8 max-w-sm w-full text-center"
|
||||
>
|
||||
<div className="flex items-center justify-center gap-2 mb-6">
|
||||
<CalendarDays className="h-6 w-6 text-primary" />
|
||||
<h1 className="text-xl font-semibold tracking-tight">Local iCal</h1>
|
||||
</div>
|
||||
|
||||
<p className="text-sm text-muted-foreground mb-6">
|
||||
Sign in to unlock AI-powered event creation
|
||||
</p>
|
||||
|
||||
<Button
|
||||
onClick={handleSignIn}
|
||||
className="w-full"
|
||||
size="lg"
|
||||
size="default"
|
||||
disabled={isLoading}
|
||||
>
|
||||
{isLoading ? <Loader2 className="h-4 w-4 animate-spin mr-2" /> : null}
|
||||
{isLoading ? "Signing in..." : "Continue with Authentik"}
|
||||
</Button>
|
||||
|
||||
<div className="text-center">
|
||||
<div className="mt-4">
|
||||
<Link
|
||||
href="/"
|
||||
className="text-sm text-muted-foreground hover:underline"
|
||||
className="text-xs text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
Continue without signing in
|
||||
</Link>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</motion.div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { LogOut } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { signOut, useSession } from "@/lib/auth-client";
|
||||
|
||||
export default function SignOutPage() {
|
||||
@@ -33,18 +27,21 @@ export default function SignOutPage() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-background p-4">
|
||||
<Card className="w-full max-w-md">
|
||||
<CardHeader className="text-center">
|
||||
<CardTitle className="text-2xl font-bold">Sign Out</CardTitle>
|
||||
<CardDescription>Are you sure you want to sign out?</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="text-center p-3 bg-muted rounded-lg">
|
||||
<div className="text-sm text-muted-foreground">
|
||||
Currently signed in as
|
||||
<div className="flex items-center justify-center py-20">
|
||||
<div className="glass-strong rounded-2xl p-8 w-full max-w-sm space-y-6">
|
||||
<div className="text-center">
|
||||
<LogOut className="h-8 w-8 text-muted-foreground mx-auto mb-3" />
|
||||
<h1 className="text-lg font-semibold">Sign Out</h1>
|
||||
<p className="text-sm text-muted-foreground mt-1">
|
||||
Are you sure you want to sign out?
|
||||
</p>
|
||||
</div>
|
||||
<div className="font-medium">
|
||||
|
||||
<div className="rounded-lg bg-muted/40 px-4 py-3 text-center">
|
||||
<div className="text-xs text-muted-foreground mb-0.5">
|
||||
Signed in as
|
||||
</div>
|
||||
<div className="text-sm font-medium">
|
||||
{session.user?.name || session.user?.email}
|
||||
</div>
|
||||
</div>
|
||||
@@ -57,13 +54,11 @@ export default function SignOutPage() {
|
||||
>
|
||||
Sign Out
|
||||
</Button>
|
||||
|
||||
<Button variant="outline" asChild>
|
||||
<Link href="/">Cancel</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user