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