feat: simplify error handling in login and registration pages, add install prompt component, and update favicon and icons

This commit is contained in:
2025-09-07 18:43:56 +02:00
parent c6f5bab1eb
commit 5f8cf49ec9
20 changed files with 160 additions and 23 deletions

View File

@@ -42,7 +42,7 @@ export default function LoginPage() {
const { token } = await loginUser(values);
setToken(token);
router.push("/"); // Redirect to homepage on successful login
} catch (err) {
} catch {
setError("Invalid username or password.");
}
}

View File

@@ -40,7 +40,7 @@ export default function RegisterPage() {
await registerUser(values);
// You can automatically log the user in here or just redirect them
router.push("/login");
} catch (err) {
} catch {
setError("Username or email may already be taken.");
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -4,6 +4,7 @@ import { AuthProvider } from "@/hooks/use-auth";
import { Toaster } from "@/components/ui/sonner";
import { Header } from "@/components/header";
import localFont from "next/font/local";
import InstallPrompt from "@/components/install-prompt";
export const metadata: Metadata = {
title: "Thoughts",
@@ -37,6 +38,7 @@ export default function RootLayout({
<AuthProvider>
<Header />
<main className="flex-1">{children}</main>
<InstallPrompt />
<Toaster />
</AuthProvider>
</body>

View File

@@ -0,0 +1,25 @@
import type { MetadataRoute } from 'next'
export default function manifest(): MetadataRoute.Manifest {
return {
name: 'Thoughts',
short_name: 'Thoughts',
description: 'A social network for sharing thoughts',
start_url: '/',
display: 'standalone',
background_color: '#ffffff',
theme_color: '#000000',
icons: [
{
src: '/icon-192x192.webp',
sizes: '192x192',
type: 'image/webp',
},
{
src: '/icon.avif',
sizes: '512x512',
type: 'image/avif',
},
],
}
}

View File

@@ -14,6 +14,7 @@ import { PopularTags } from "@/components/popular-tags";
import { ThoughtThread } from "@/components/thought-thread";
import { buildThoughtThreads } from "@/lib/utils";
import { TopFriends } from "@/components/top-friends";
import InstallPrompt from "@/components/install-prompt";
export default async function Home() {
const token = (await cookies()).get("auth_token")?.value ?? null;
@@ -101,26 +102,28 @@ async function FeedPage({ token }: { token: string }) {
function LandingPage() {
return (
<div className="font-sans min-h-screen text-gray-800 flex items-center justify-center">
<div className="container mx-auto max-w-2xl p-4 sm:p-6 text-center glass-effect glossy-effect bottom rounded-md shadow-fa-lg">
<h1
className="text-5xl font-bold"
style={{ textShadow: "2px 2px 4px rgba(0,0,0,0.1)" }}
>
Welcome to Thoughts
</h1>
<p className="text-muted-foreground mt-2">
Throwback to the golden age of microblogging.
</p>
<div className="mt-8 flex justify-center gap-4">
<Button asChild>
<Link href="/login">Login</Link>
</Button>
<Button variant="secondary" asChild>
<Link href="/register">Register</Link>
</Button>
<>
<div className="font-sans min-h-screen text-gray-800 flex items-center justify-center">
<div className="container mx-auto max-w-2xl p-4 sm:p-6 text-center glass-effect glossy-effect bottom rounded-md shadow-fa-lg">
<h1
className="text-5xl font-bold"
style={{ textShadow: "2px 2px 4px rgba(0,0,0,0.1)" }}
>
Welcome to Thoughts
</h1>
<p className="text-muted-foreground mt-2">
Throwback to the golden age of microblogging.
</p>
<div className="mt-8 flex justify-center gap-4">
<Button asChild>
<Link href="/login">Login</Link>
</Button>
<Button variant="secondary" asChild>
<Link href="/register">Register</Link>
</Button>
</div>
</div>
</div>
</div>
</>
);
}