fix: hide my pages menu for logged in users
This commit is contained in:
13
components/Loyalty/Sidebar/MyPagesNavigation/index.tsx
Normal file
13
components/Loyalty/Sidebar/MyPagesNavigation/index.tsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { serverClient } from "@/lib/trpc/server"
|
||||||
|
|
||||||
|
import MyPagesSidebar from "@/components/MyPages/Sidebar"
|
||||||
|
|
||||||
|
export async function MyPagesNavigation() {
|
||||||
|
const user = await serverClient().user.name()
|
||||||
|
|
||||||
|
// Check if we have user, that means we are logged in andt the My Pages menu can show.
|
||||||
|
if (!user) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return <MyPagesSidebar />
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import JsonToHtml from "@/components/JsonToHtml"
|
import JsonToHtml from "@/components/JsonToHtml"
|
||||||
import SidebarMyPages from "@/components/MyPages/Sidebar"
|
|
||||||
|
|
||||||
import JoinLoyaltyContact from "./JoinLoyalty"
|
import JoinLoyaltyContact from "./JoinLoyalty"
|
||||||
|
import { MyPagesNavigation } from "./MyPagesNavigation"
|
||||||
|
|
||||||
import styles from "./sidebar.module.css"
|
import styles from "./sidebar.module.css"
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ export default function SidebarLoyalty({ blocks }: SidebarProps) {
|
|||||||
case SidebarTypenameEnum.LoyaltyPageSidebarDynamicContent:
|
case SidebarTypenameEnum.LoyaltyPageSidebarDynamicContent:
|
||||||
switch (block.dynamic_content.component) {
|
switch (block.dynamic_content.component) {
|
||||||
case LoyaltySidebarDynamicComponentEnum.my_pages_navigation:
|
case LoyaltySidebarDynamicComponentEnum.my_pages_navigation:
|
||||||
return <SidebarMyPages key={`${block.__typename}-${idx}`} />
|
return <MyPagesNavigation key={`${block.__typename}-${idx}`} />
|
||||||
default:
|
default:
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user