Update home page with proper landing page and auth redirect
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
94
app/page.tsx
94
app/page.tsx
@@ -1,10 +1,43 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
|
import { doesSessionExist } from "supertokens-web-js/recipe/session";
|
||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
|
const router = useRouter();
|
||||||
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
const [isLoggedIn, setIsLoggedIn] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Check if user is already logged in
|
||||||
|
doesSessionExist().then((exists) => {
|
||||||
|
setIsLoggedIn(exists);
|
||||||
|
setIsLoading(false);
|
||||||
|
|
||||||
|
// If logged in, redirect to projects
|
||||||
|
if (exists) {
|
||||||
|
router.push("/marks-account/projects");
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
setIsLoading(false);
|
||||||
|
});
|
||||||
|
}, [router]);
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return (
|
||||||
|
<div className="flex min-h-screen items-center justify-center bg-background">
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4" />
|
||||||
|
<p className="text-muted-foreground">Loading...</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-h-screen items-center justify-center bg-background p-4">
|
<div className="flex min-h-screen items-center justify-center bg-background p-4">
|
||||||
<div className="w-full max-w-2xl space-y-6">
|
<div className="w-full max-w-2xl space-y-6">
|
||||||
@@ -30,44 +63,48 @@ export default function HomePage() {
|
|||||||
<CardContent className="space-y-6">
|
<CardContent className="space-y-6">
|
||||||
<div className="text-center space-y-4">
|
<div className="text-center space-y-4">
|
||||||
<p className="text-muted-foreground">
|
<p className="text-muted-foreground">
|
||||||
Vib'n is now running on Coolify! 🎉
|
Track, manage, and deploy your AI-coded projects with ease.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="grid gap-4 md:grid-cols-2">
|
<div className="grid gap-4 md:grid-cols-3">
|
||||||
<Card className="bg-muted/50">
|
<Card className="bg-muted/50">
|
||||||
<CardContent className="pt-6">
|
<CardContent className="pt-6">
|
||||||
<h3 className="font-semibold mb-2">✅ API Status</h3>
|
<div className="text-3xl mb-2">🚀</div>
|
||||||
<p className="text-sm text-muted-foreground">
|
<h3 className="font-semibold mb-1">Fast Deployment</h3>
|
||||||
Connected and operational
|
<p className="text-xs text-muted-foreground">
|
||||||
|
Deploy to Coolify with one click
|
||||||
</p>
|
</p>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Card className="bg-muted/50">
|
<Card className="bg-muted/50">
|
||||||
<CardContent className="pt-6">
|
<CardContent className="pt-6">
|
||||||
<h3 className="font-semibold mb-2">✅ Database</h3>
|
<div className="text-3xl mb-2">🤖</div>
|
||||||
<p className="text-sm text-muted-foreground">
|
<h3 className="font-semibold mb-1">AI-Powered</h3>
|
||||||
PostgreSQL running
|
<p className="text-xs text-muted-foreground">
|
||||||
|
Track AI coding sessions
|
||||||
|
</p>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
<Card className="bg-muted/50">
|
||||||
|
<CardContent className="pt-6">
|
||||||
|
<div className="text-3xl mb-2">📊</div>
|
||||||
|
<h3 className="font-semibold mb-1">Analytics</h3>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
Monitor project progress
|
||||||
</p>
|
</p>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="pt-4">
|
<div className="pt-6 flex gap-4 justify-center">
|
||||||
<p className="text-sm text-muted-foreground mb-4">
|
<Button size="lg" asChild>
|
||||||
<strong>Note:</strong> Authentication is being migrated from Firebase to PostgreSQL.
|
<Link href="/auth">
|
||||||
<br />
|
Get Started
|
||||||
This page will be updated with login functionality soon.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex gap-4 justify-center">
|
|
||||||
<Button asChild>
|
|
||||||
<Link href="/marks-account/projects">
|
|
||||||
View Projects (Demo)
|
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="outline" asChild>
|
<Button size="lg" variant="outline" asChild>
|
||||||
<a href={process.env.NEXT_PUBLIC_PROXY_URL || "#"} target="_blank" rel="noopener noreferrer">
|
<a href={process.env.NEXT_PUBLIC_PROXY_URL || "#"} target="_blank" rel="noopener noreferrer">
|
||||||
API Docs
|
API Docs
|
||||||
</a>
|
</a>
|
||||||
@@ -77,17 +114,10 @@ export default function HomePage() {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{/* System Status */}
|
{/* Features */}
|
||||||
<Card className="bg-muted/20">
|
<div className="text-center text-sm text-muted-foreground">
|
||||||
<CardHeader>
|
<p>✅ Self-hosted • ✅ Open source • ✅ Powered by Coolify</p>
|
||||||
<CardTitle className="text-sm">System Information</CardTitle>
|
</div>
|
||||||
</CardHeader>
|
|
||||||
<CardContent className="text-xs space-y-1 font-mono text-muted-foreground">
|
|
||||||
<div>Frontend: {process.env.NEXT_PUBLIC_APP_URL || 'localhost'}</div>
|
|
||||||
<div>API: {process.env.NEXT_PUBLIC_PROXY_URL || 'Not configured'}</div>
|
|
||||||
<div>Environment: {process.env.NODE_ENV}</div>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user