diff --git a/app/App.jsx b/app/App.jsx index 6fabfb3..d122cc3 100644 --- a/app/App.jsx +++ b/app/App.jsx @@ -6,10 +6,10 @@ import { useEffect } from "react"; const inter = Inter({ subsets: ["latin"] }); export const App = (props) => { - const userStore = useUserStore(); + const userStore = useUserStore((state) => state); useEffect(() => { userStore.checkAuth(); - }, []) + }, []); return (
@@ -17,4 +17,4 @@ export const App = (props) => { {props.children} ); -} +}; diff --git a/app/components/Navbar/Navbar.jsx b/app/components/Navbar/Navbar.jsx index b883423..8cb1e83 100644 --- a/app/components/Navbar/Navbar.jsx +++ b/app/components/Navbar/Navbar.jsx @@ -5,7 +5,7 @@ import { useUserStore } from "@/app/store/auth"; export const Navbar = () => { const pathname = usePathname(); - const userStore = useUserStore(); + const userStore = useUserStore((state) => state); const isNotAuthorizedStyle = "text-gray-700"; const navLinks = [ @@ -85,7 +85,7 @@ export const Navbar = () => { ); })} - {userStore.user ? ( + {userStore.isAuth ? ({userStore.user.login}
diff --git a/app/components/ReleaseLink/ReleaseLink.jsx b/app/components/ReleaseLink/ReleaseLink.jsx index c26975d..8f6c7f6 100644 --- a/app/components/ReleaseLink/ReleaseLink.jsx +++ b/app/components/ReleaseLink/ReleaseLink.jsx @@ -2,6 +2,20 @@ import Link from "next/link"; export const ReleaseLink = (props) => { const grade = props.grade.toFixed(1); + const profile_lists = { + // 0: "Не смотрю", + 1: { name: "Смотрю", bg_color: "bg-green-500" }, + 2: { name: "В планах", bg_color: "bg-purple-500" }, + 3: { name: "Просмотрено", bg_color: "bg-blue-500" }, + 4: { name: "Отложено", bg_color: "bg-yellow-500" }, + 5: { name: "Брошено", bg_color: "bg-red-500" }, + }; + + const profile_list_status = props.profile_list_status; + let user_list = null; + if (profile_list_status != null || profile_list_status != 0) { + user_list = profile_lists[profile_list_status]; + } return (- {grade} -
++ {grade} +
++ {user_list.name} +
+