feat: hide Finance nav for non-owner users (Savings visible to all)
All checks were successful
CI / ci (push) Successful in 46s
All checks were successful
CI / ci (push) Successful in 46s
This commit is contained in:
@@ -1,15 +1,21 @@
|
||||
import { NavLink } from "react-router-dom"
|
||||
import { Home, BarChart3, Wallet, PiggyBank, Settings } from "lucide-react"
|
||||
import { useAuthStore } from "../store/auth"
|
||||
import clsx from "clsx"
|
||||
|
||||
const OWNER_ID = 1
|
||||
|
||||
export default function Navigation() {
|
||||
const user = useAuthStore((s) => s.user)
|
||||
const isOwner = user?.id === OWNER_ID
|
||||
|
||||
const navItems = [
|
||||
{ to: "/", icon: Home, label: "Главная" },
|
||||
{ to: "/tracker", icon: BarChart3, label: "Трекер" },
|
||||
{ to: "/finance", icon: Wallet, label: "Финансы" },
|
||||
isOwner && { to: "/finance", icon: Wallet, label: "Финансы" },
|
||||
{ to: "/savings", icon: PiggyBank, label: "Накопления" },
|
||||
{ to: "/settings", icon: Settings, label: "Настройки" },
|
||||
]
|
||||
].filter(Boolean)
|
||||
|
||||
return (
|
||||
<nav className="fixed bottom-0 left-0 right-0 bg-white/80 dark:bg-gray-900/80 backdrop-blur-xl border-t border-gray-100 dark:border-gray-800 z-50 transition-colors duration-300">
|
||||
|
||||
Reference in New Issue
Block a user