diff --git a/app/components/Navbar/NavbarUpdate.tsx b/app/components/Navbar/NavbarUpdate.tsx index 4d0927d..a6219c0 100644 --- a/app/components/Navbar/NavbarUpdate.tsx +++ b/app/components/Navbar/NavbarUpdate.tsx @@ -87,8 +87,8 @@ export const Navbar = () => { return ( <>
-
-
+
+
{menuItems.map((item) => { return ( { item.isAuthRequired && !userStore.isAuth ? "hidden" : item.isShownOnMobile ? "flex" : "hidden sm:flex" - } ${[item.href, item.hrefInCategory].includes("/" + pathname.split("/")[1]) ? "font-bold" : "font-medium"}`} + } ${[item.href, item.hrefInCategory].includes("/" + pathname.split("/")[1]) ? "font-bold" : "font-medium"} transition-all`} > { ); })}
-
+
{!userStore.isAuth ? { : <> { width={24} height={24} /> - + {userStore.user.login} + {preferenceStore.flags.showFifthButton ? + + + + {menuItems[preferenceStore.flags.showFifthButton].title} + + + : ""} { width={24} height={24} /> - + {userStore.user.login} @@ -165,7 +184,11 @@ export const Navbar = () => { onClick={() => setIsSettingModalOpen(true)} > - Настройки + + Настройки + {userStore.isAuth && ( diff --git a/app/components/SettingsModal/SettingsModal.tsx b/app/components/SettingsModal/SettingsModal.tsx index d9d4378..3786e80 100644 --- a/app/components/SettingsModal/SettingsModal.tsx +++ b/app/components/SettingsModal/SettingsModal.tsx @@ -1,6 +1,7 @@ "use client"; import { CURRENT_APP_VERSION } from "#/api/config"; +import { useUserStore } from "#/store/auth"; import { usePreferencesStore } from "#/store/preferences"; import { Modal, @@ -35,8 +36,15 @@ const NavbarTitles = { never: "Никогда", }; +const FifthButton = { + 3: "Избранное", + 4: "Коллекции", + 5: "История", +}; + export const SettingsModal = (props: { isOpen: boolean; setIsOpen: any }) => { const preferenceStore = usePreferencesStore(); + const userStore = useUserStore(); const { computedMode, setMode } = useThemeMode(); @@ -190,6 +198,45 @@ export const SettingsModal = (props: { isOpen: boolean; setIsOpen: any }) => { )}
+ {userStore.isAuth ? +
+

+ Пятый пункт в навигации +

+ + + preferenceStore.setFlags({ + showFifthButton: null, + }) + } + > + Не показывать + + {Object.keys(FifthButton).map((key) => { + return ( + + preferenceStore.setFlags({ + showFifthButton: Number(key) as 3 | 4 | 5, + }) + } + > + {FifthButton[key]} + + ); + })} + +
+ : ""}
diff --git a/app/pages/MobileMenuPage.tsx b/app/pages/MobileMenuPage.tsx index 72fa408..f1f73b8 100644 --- a/app/pages/MobileMenuPage.tsx +++ b/app/pages/MobileMenuPage.tsx @@ -6,9 +6,11 @@ import { useRouter } from "next/navigation"; import { SettingsModal } from "#/components/SettingsModal/SettingsModal"; import { useEffect, useState } from "react"; import Image from "next/image"; +import { usePreferencesStore } from "#/store/preferences"; export const MenuPage = () => { const userStore = useUserStore(); + const preferenceStore = usePreferencesStore(); const router = useRouter(); const [isSettingModalOpen, setIsSettingModalOpen] = useState(false); @@ -81,36 +83,42 @@ export const MenuPage = () => {
- - -
- -

Избранное

-
-
- - - -
- -

Коллекции

-
-
- - - -
- -

История

-
-
- + {preferenceStore.flags.showFifthButton != 3 ? + + +
+ +

Избранное

+
+
+ + : ""} + {preferenceStore.flags.showFifthButton != 4 ? + + +
+ +

Коллекции

+
+
+ + : ""} + {preferenceStore.flags.showFifthButton != 5 ? + + +
+ +

История

+
+
+ + : ""} ()( showChangelog: true, enableAnalytics: true, showNavbarTitles: "always", + showFifthButton: null, }, params: { isFirstLaunch: true, @@ -54,8 +56,8 @@ export const usePreferencesStore = create()( bookmarksCategory: "watching", }, experimental: { - newPlayer: false - } + newPlayer: false, + }, }, setHasHydrated: (state) => { set({ @@ -74,9 +76,12 @@ export const usePreferencesStore = create()( onRehydrateStorage: (state) => { return () => state.setHasHydrated(true); }, - merge: (persistedState , currentState) => { - return deepmerge(currentState as preferencesState, persistedState as preferencesState); - } + merge: (persistedState, currentState) => { + return deepmerge( + currentState as preferencesState, + persistedState as preferencesState + ); + }, } ) );