Skip to content

Commit a33f3e8

Browse files
committed
feat: show dashboard button instead of redirecting on home page
1 parent e7d7a22 commit a33f3e8

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

src/pages/Index.tsx

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useState, useEffect } from 'react';
22
import { Helmet } from 'react-helmet-async';
33

4-
import { Navigate } from 'react-router-dom';
4+
import { Navigate, Link } from 'react-router-dom';
55
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
66
import { Button } from '@/components/ui/button';
77
import { 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

Comments
 (0)