security: shopping + recipe creation require login
- BottomNav: hide Shopping + Neu when not authenticated - ShoppingPage: login prompt when not authenticated - Prevents unauthenticated access to shared shopping data
This commit is contained in:
@@ -1,7 +1,14 @@
|
|||||||
import { NavLink } from 'react-router'
|
import { NavLink } from 'react-router'
|
||||||
import { Home, Search, PlusCircle, ShoppingCart, User } from 'lucide-react'
|
import { Home, Search, PlusCircle, ShoppingCart, User } from 'lucide-react'
|
||||||
|
import { useAuth } from '../../context/AuthContext'
|
||||||
|
|
||||||
const navItems = [
|
const publicItems = [
|
||||||
|
{ to: '/', icon: Home, label: 'Home' },
|
||||||
|
{ to: '/search', icon: Search, label: 'Suche' },
|
||||||
|
{ to: '/profile', icon: User, label: 'Profil' },
|
||||||
|
]
|
||||||
|
|
||||||
|
const authItems = [
|
||||||
{ to: '/', icon: Home, label: 'Home' },
|
{ to: '/', icon: Home, label: 'Home' },
|
||||||
{ to: '/search', icon: Search, label: 'Suche' },
|
{ to: '/search', icon: Search, label: 'Suche' },
|
||||||
{ to: '/new', icon: PlusCircle, label: 'Neu' },
|
{ to: '/new', icon: PlusCircle, label: 'Neu' },
|
||||||
@@ -10,6 +17,9 @@ const navItems = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
export function BottomNav() {
|
export function BottomNav() {
|
||||||
|
const { isAuthenticated } = useAuth()
|
||||||
|
const navItems = isAuthenticated ? authItems : publicItems
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav className="fixed bottom-0 left-0 right-0 bg-surface border-t border-sand z-50">
|
<nav className="fixed bottom-0 left-0 right-0 bg-surface border-t border-sand z-50">
|
||||||
<div className="max-w-lg mx-auto flex justify-around items-center h-16 sm:h-18">
|
<div className="max-w-lg mx-auto flex justify-around items-center h-16 sm:h-18">
|
||||||
|
|||||||
Reference in New Issue
Block a user