diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..6ad46e3 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,68 @@ +# Marketplace Project Notes + +## Database: PostgreSQL via Docker + +Container name: `marketplace-postgres` +Image: `postgres:17-alpine` +Volume: `marketplace-pgdata` (persistent local data) + +### Start database +```bash +docker start marketplace-postgres +``` + +### Stop database (frees memory) +```bash +docker stop marketplace-postgres +``` + +### Check status +```bash +docker ps -f name=marketplace-postgres +``` + +### Connection string +``` +postgresql://marketplace:marketplace_dev@localhost:5432/marketplace +``` + +### If container was deleted, recreate: +```bash +docker run -d \ + --name marketplace-postgres \ + -e POSTGRES_USER=marketplace \ + -e POSTGRES_PASSWORD=marketplace_dev \ + -e POSTGRES_DB=marketplace \ + -p 5432:5432 \ + -v marketplace-pgdata:/var/lib/postgresql/data \ + --restart unless-stopped \ + postgres:17-alpine +``` + +Data persists in the `marketplace-pgdata` Docker volume even if the container is removed. + +## Running the app + +1. Start database: `docker start marketplace-postgres` +2. Server: `npm run dev:server` (port 3000) +3. Client: `npm run dev:client` (port 5173) +4. Or both: `npm run dev` + +## Seed data + +```bash +cd server && npx tsx prisma/seed.ts +``` + +Test users (all password: `password123`): +- alice.chen@example.com +- bob.smith@example.com +- carol.jones@example.com +- david.wilson@example.com +- eva.martinez@example.com + +## Key env vars (server/.env) + +- `DATABASE_URL` — PostgreSQL connection +- `GOOGLE_MAPS_API_KEY` — Location autocomplete +- `STRIPE_SECRET_KEY` / `STRIPE_PUBLISHABLE_KEY` — Payments (optional for dev) diff --git a/client/src/components/layout/DashboardLayout.tsx b/client/src/components/layout/DashboardLayout.tsx index 2904135..fd205fe 100644 --- a/client/src/components/layout/DashboardLayout.tsx +++ b/client/src/components/layout/DashboardLayout.tsx @@ -1,28 +1,46 @@ -import { NavLink, Outlet } from 'react-router-dom'; -import { MessageSquare, Tag, Bell, ShoppingBag, Settings } from 'lucide-react'; +import { NavLink, Outlet, useNavigate } from 'react-router-dom'; +import { MessageSquare, Tag, ShoppingBag, Settings, List, Heart, LogOut } from 'lucide-react'; +import { useAuth } from '../../context/AuthContext'; const navItems = [ - { to: '/dashboard/messages', icon: MessageSquare, label: 'Messages' }, { to: '/dashboard/offers', icon: Tag, label: 'Offers' }, - { to: '/dashboard/notifications', icon: Bell, label: 'Notifications' }, { to: '/dashboard/sold', icon: ShoppingBag, label: 'Sold Items' }, + { to: '/dashboard/listings', icon: List, label: 'My Listings' }, + { to: '/dashboard/saved', icon: Heart, label: 'Saved Items' }, + { to: '/dashboard/messages', icon: MessageSquare, label: 'My Messages' }, { to: '/dashboard/settings', icon: Settings, label: 'Settings' }, ]; export function DashboardLayout() { + const { logout } = useAuth(); + const navigate = useNavigate(); + + const handleLogout = () => { + logout(); + navigate('/'); + }; + return (