11import { useState , useEffect } from 'react' ;
22import { Helmet } from 'react-helmet-async' ;
33
4- import { Navigate } from 'react-router-dom' ;
4+ import { Navigate , Link } from 'react-router-dom' ;
55import { Card , CardContent , CardDescription , CardHeader , CardTitle } from '@/components/ui/card' ;
66import { Button } from '@/components/ui/button' ;
77import { Badge } from '@/components/ui/badge' ;
@@ -16,10 +16,9 @@ const Index = () => {
1616 const { user } = useCurrentUser ( ) ;
1717 const { items, shoppingListItems, lowStockItems } = useInventory ( ) ;
1818
19- // If user is logged in, redirect to inventory
20- if ( user ) {
21- return < Navigate to = "/inventory" replace /> ;
22- }
19+ // if (user) {
20+ // return <Navigate to="/inventory" replace />;
21+ // }
2322
2423 return (
2524 < div className = "min-h-screen bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-100 dark:from-slate-950 dark:via-slate-900 dark:to-indigo-950" >
@@ -85,10 +84,30 @@ const Index = () => {
8584
8685 { /* Most Important Action */ }
8786 < div className = "mb-16" >
88- < LoginArea className = "mx-auto scale-125" />
89- < p className = "text-sm text-slate-500 mt-4" >
90- Login or create account to start managing your household inventory
91- </ p >
87+ { user ? (
88+ < div className = "space-y-4" >
89+ < Button
90+ asChild
91+ size = "lg"
92+ className = "rounded-full px-8 py-6 text-lg font-semibold shadow-xl hover:shadow-2xl transition-all scale-110 hover:scale-115 bg-gradient-to-r from-primary to-indigo-600"
93+ >
94+ < Link to = "/inventory" >
95+ Go to Dashboard
96+ < Package className = "ml-2 h-5 w-5" />
97+ </ Link >
98+ </ Button >
99+ < p className = "text-sm text-slate-500" >
100+ Welcome back! You are logged in.
101+ </ p >
102+ </ div >
103+ ) : (
104+ < >
105+ < LoginArea className = "mx-auto scale-125" />
106+ < p className = "text-sm text-slate-500 mt-4" >
107+ Login or create account to start managing your household inventory
108+ </ p >
109+ </ >
110+ ) }
92111 </ div >
93112 </ div >
94113
0 commit comments