fix: add my pages nav sidebar for logged in users
This commit is contained in:
@@ -82,7 +82,7 @@ function LevelCard({ formatMessage, lang, level }: LevelCardProps) {
|
||||
}
|
||||
return (
|
||||
<article className={styles.card}>
|
||||
<section>
|
||||
<header>
|
||||
<BiroScript
|
||||
type="two"
|
||||
color="primaryLightOnSurfaceAccent"
|
||||
@@ -91,7 +91,7 @@ function LevelCard({ formatMessage, lang, level }: LevelCardProps) {
|
||||
{formatMessage({ id: "Level" })} {level.level}
|
||||
</BiroScript>
|
||||
<Level color="red" />
|
||||
</section>
|
||||
</header>
|
||||
<Title textAlign="center" level="h5">
|
||||
{qualifications}
|
||||
</Title>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { login } from "@/constants/routes/handleAuth"
|
||||
|
||||
import { auth } from "@/auth"
|
||||
import ArrowRight from "@/components/Icons/ArrowRight"
|
||||
import { ScandicFriends } from "@/components/Levels"
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
@@ -20,6 +21,11 @@ export default async function JoinLoyaltyContact({
|
||||
lang,
|
||||
}: JoinLoyaltyContactProps & LangParams) {
|
||||
const { formatMessage } = await getIntl()
|
||||
const session = await auth()
|
||||
|
||||
if (session) {
|
||||
return null
|
||||
}
|
||||
return (
|
||||
<section>
|
||||
<article className={styles.wrapper}>
|
||||
@@ -35,23 +41,21 @@ export default async function JoinLoyaltyContact({
|
||||
</Button>
|
||||
<section className={styles.loginContainer}>
|
||||
<Body>{formatMessage({ id: "Already a friend?" })}</Body>
|
||||
<span className={styles.linkWrapper}>
|
||||
<Link
|
||||
className={styles.link}
|
||||
color="burgundy"
|
||||
href={`/${lang}/login`}
|
||||
variant="icon"
|
||||
size="small"
|
||||
>
|
||||
<ArrowRight
|
||||
color="burgundy"
|
||||
className={styles.icon}
|
||||
height="20"
|
||||
width="20"
|
||||
/>
|
||||
<Link
|
||||
className={styles.link}
|
||||
color="burgundy"
|
||||
href={`/${lang}/login`}
|
||||
variant="icon"
|
||||
size="small"
|
||||
>
|
||||
{formatMessage({ id: "Log in here" })}
|
||||
</Link>
|
||||
</span>
|
||||
{formatMessage({ id: "Log in here" })}
|
||||
</Link>
|
||||
</section>
|
||||
</article>
|
||||
{block.contact ? <Contact contactBlock={block.contact} /> : null}
|
||||
|
||||
@@ -14,12 +14,6 @@
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.linkWrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--Spacing-x-half);
|
||||
}
|
||||
|
||||
.link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
14
components/Loyalty/Sidebar/MyPagesNavigation/index.tsx
Normal file
14
components/Loyalty/Sidebar/MyPagesNavigation/index.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { auth } from "@/auth"
|
||||
import MyPagesSidebar from "@/components/MyPages/Sidebar"
|
||||
|
||||
import { LangParams } from "@/types/params"
|
||||
|
||||
export default async function MyPagesNavigation({ lang }: LangParams) {
|
||||
const session = await auth()
|
||||
|
||||
if (!session) {
|
||||
return null
|
||||
}
|
||||
|
||||
return <MyPagesSidebar lang={lang} />
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
import JsonToHtml from "@/components/JsonToHtml"
|
||||
|
||||
import JoinLoyaltyContact from "./JoinLoyalty"
|
||||
import MyPagesNavigation from "./MyPagesNavigation"
|
||||
|
||||
import styles from "./sidebar.module.css"
|
||||
|
||||
import { SidebarTypenameEnum } from "@/types/components/loyalty/enums"
|
||||
import {
|
||||
LoyaltySidebarDynamicComponentEnum,
|
||||
SidebarTypenameEnum,
|
||||
} from "@/types/components/loyalty/enums"
|
||||
import { SidebarProps } from "@/types/components/loyalty/sidebar"
|
||||
import { LangParams } from "@/types/params"
|
||||
|
||||
@@ -36,6 +40,19 @@ export default function SidebarLoyalty({
|
||||
lang={lang}
|
||||
/>
|
||||
)
|
||||
case SidebarTypenameEnum.LoyaltyPageSidebarDynamicContent:
|
||||
switch (block.dynamic_content.component) {
|
||||
case LoyaltySidebarDynamicComponentEnum.my_pages_navigation:
|
||||
return (
|
||||
<MyPagesNavigation
|
||||
key={`${block.__typename}-${idx}`}
|
||||
lang={lang}
|
||||
/>
|
||||
)
|
||||
default:
|
||||
return null
|
||||
}
|
||||
|
||||
default:
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user