fix: add heading and subtitle to overview table
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { serverClient } from "@/lib/trpc/server"
|
import { serverClient } from "@/lib/trpc/server"
|
||||||
|
|
||||||
import Content from "@/components/MyPages/AccountPage/Content"
|
import Content from "@/components/MyPages/AccountPage/Content"
|
||||||
|
import Title from "@/components/TempDesignSystem/Text/Title"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
|
|
||||||
import styles from "./page.module.css"
|
import styles from "./page.module.css"
|
||||||
@@ -19,6 +20,7 @@ export default async function MyPages({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<main className={styles.blocks}>
|
<main className={styles.blocks}>
|
||||||
|
<Title>{accountPage.heading}</Title>
|
||||||
{accountPage.content.length ? (
|
{accountPage.content.length ? (
|
||||||
<Content lang={params.lang} content={accountPage.content} />
|
<Content lang={params.lang} content={accountPage.content} />
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import { Blocks } from "@/components/Loyalty/Blocks"
|
|||||||
import Sidebar from "@/components/Loyalty/Sidebar"
|
import Sidebar from "@/components/Loyalty/Sidebar"
|
||||||
import MaxWidth from "@/components/MaxWidth"
|
import MaxWidth from "@/components/MaxWidth"
|
||||||
|
|
||||||
|
import Title from "../TempDesignSystem/Text/Title"
|
||||||
|
|
||||||
import styles from "./loyaltyPage.module.css"
|
import styles from "./loyaltyPage.module.css"
|
||||||
|
|
||||||
import type { LangParams } from "@/types/params"
|
import type { LangParams } from "@/types/params"
|
||||||
@@ -20,6 +22,7 @@ export default async function LoyaltyPage({ lang }: LangParams) {
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<MaxWidth className={styles.blocks} tag="main">
|
<MaxWidth className={styles.blocks} tag="main">
|
||||||
|
<Title>{loyaltyPage.heading}</Title>
|
||||||
{loyaltyPage.blocks ? <Blocks blocks={loyaltyPage.blocks} /> : null}
|
{loyaltyPage.blocks ? <Blocks blocks={loyaltyPage.blocks} /> : null}
|
||||||
</MaxWidth>
|
</MaxWidth>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { serverClient } from "@/lib/trpc/server"
|
|||||||
import { Blocks } from "@/components/Loyalty/Blocks/WebView"
|
import { Blocks } from "@/components/Loyalty/Blocks/WebView"
|
||||||
import Sidebar from "@/components/Loyalty/Sidebar"
|
import Sidebar from "@/components/Loyalty/Sidebar"
|
||||||
import MaxWidth from "@/components/MaxWidth"
|
import MaxWidth from "@/components/MaxWidth"
|
||||||
|
import Title from "@/components/TempDesignSystem/Text/Title"
|
||||||
import LinkToOverview from "@/components/Webviews/LinkToOverview"
|
import LinkToOverview from "@/components/Webviews/LinkToOverview"
|
||||||
|
|
||||||
import styles from "./loyaltyPage.module.css"
|
import styles from "./loyaltyPage.module.css"
|
||||||
@@ -25,6 +26,7 @@ export default async function AboutScandicFriends({ lang }: LangParams) {
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<MaxWidth tag="main">
|
<MaxWidth tag="main">
|
||||||
|
<Title>{loyaltyPage.heading}</Title>
|
||||||
<Blocks blocks={loyaltyPage.blocks} lang={lang} />
|
<Blocks blocks={loyaltyPage.blocks} lang={lang} />
|
||||||
</MaxWidth>
|
</MaxWidth>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import SV from "./data/SV.json"
|
|||||||
import BenefitList from "./BenefitList"
|
import BenefitList from "./BenefitList"
|
||||||
import LargeTable from "./LargeTable"
|
import LargeTable from "./LargeTable"
|
||||||
import LevelSummary from "./LevelSummary"
|
import LevelSummary from "./LevelSummary"
|
||||||
import OverviewTableTitle from "./Title"
|
|
||||||
|
|
||||||
import styles from "./overviewTable.module.css"
|
import styles from "./overviewTable.module.css"
|
||||||
|
|
||||||
@@ -34,6 +33,7 @@ import {
|
|||||||
import { LangParams } from "@/types/params"
|
import { LangParams } from "@/types/params"
|
||||||
import { User } from "@/types/user"
|
import { User } from "@/types/user"
|
||||||
|
|
||||||
|
|
||||||
const levelsTranslations = {
|
const levelsTranslations = {
|
||||||
[Lang.en]: EN,
|
[Lang.en]: EN,
|
||||||
[Lang.sv]: SV,
|
[Lang.sv]: SV,
|
||||||
@@ -42,36 +42,7 @@ const levelsTranslations = {
|
|||||||
[Lang.fi]: FI,
|
[Lang.fi]: FI,
|
||||||
[Lang.de]: DE,
|
[Lang.de]: DE,
|
||||||
}
|
}
|
||||||
|
|
||||||
// These should ultimately be fetched from Contentstack
|
|
||||||
const titleTranslations = {
|
|
||||||
[Lang.en]: [
|
|
||||||
{ text: "7 delightful levels", highlight: true },
|
|
||||||
{ text: "of friendship", highlight: false },
|
|
||||||
],
|
|
||||||
// TODO: Add translations for the following languages
|
|
||||||
[Lang.da]: [
|
|
||||||
{ text: "7 delightful levels", highlight: true },
|
|
||||||
{ text: "of friendship", highlight: false },
|
|
||||||
],
|
|
||||||
[Lang.no]: [
|
|
||||||
{ text: "7 delightful levels", highlight: true },
|
|
||||||
{ text: "of friendship", highlight: false },
|
|
||||||
],
|
|
||||||
[Lang.sv]: [
|
|
||||||
{ text: "7 delightful levels", highlight: true },
|
|
||||||
{ text: "of friendship", highlight: false },
|
|
||||||
],
|
|
||||||
[Lang.fi]: [
|
|
||||||
{ text: "7 delightful levels", highlight: true },
|
|
||||||
{ text: "of friendship", highlight: false },
|
|
||||||
],
|
|
||||||
[Lang.de]: [
|
|
||||||
{ text: "7 delightful levels", highlight: true },
|
|
||||||
{ text: "of friendship", highlight: false },
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTranslatedLevelByTier(tier: membershipLevels, lang: Lang) {
|
function getTranslatedLevelByTier(tier: membershipLevels, lang: Lang) {
|
||||||
return levelsTranslations[lang].levels.find(
|
return levelsTranslations[lang].levels.find(
|
||||||
(level) => level.tier === tier
|
(level) => level.tier === tier
|
||||||
@@ -179,17 +150,7 @@ export default function OverviewTable({ user }: OverviewTableProps) {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div>
|
||||||
<div className={styles.intro}>
|
|
||||||
<OverviewTableTitle texts={titleTranslations[Lang.en]} />
|
|
||||||
<p className={styles.preamble}>
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
||||||
eiusmod tempor incididunt ut labore et dolore magna aliqua. Arcu risus
|
|
||||||
quis varius quam quisque id diam vel. Rhoncus urna neque viverra
|
|
||||||
justo. Mattis aliquam faucibus purus in massa. Id cursus metus aliquam
|
|
||||||
eleifend mi in nulla posuere.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className={styles.mobileColumns}>
|
<div className={styles.mobileColumns}>
|
||||||
<div className={styles.columnHeaderContainer}>
|
<div className={styles.columnHeaderContainer}>
|
||||||
<div className={styles.columnHeader}>
|
<div className={styles.columnHeader}>
|
||||||
|
|||||||
@@ -1,29 +1,8 @@
|
|||||||
.container {
|
|
||||||
margin-top: calc(var(--Spacing-x2) * -1);
|
|
||||||
margin-left: calc(var(--Spacing-x2) * -1);
|
|
||||||
margin-right: calc(var(--Spacing-x2) * -1);
|
|
||||||
margin-bottom: calc(
|
|
||||||
(var(--Spacing-x2) + 7.7rem) * -1
|
|
||||||
); /* Based on the MaxWidth's 1.6rem + the LoyaltyPage's 7.7rem bottom margins */
|
|
||||||
position: relative;
|
|
||||||
width: 100dvw;
|
|
||||||
padding: var(--Spacing-x2);
|
|
||||||
display: grid;
|
|
||||||
gap: var(--Spacing-x6);
|
|
||||||
}
|
|
||||||
|
|
||||||
.intro {
|
.intro {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--Spacing-x3);
|
gap: var(--Spacing-x3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.preamble {
|
|
||||||
color: var(--Base-Text-Primary-High-contrast);
|
|
||||||
font-size: var(--typography-Body-Regular-fontSize);
|
|
||||||
line-height: var(--typography-Body-Regular-lineHeight);
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.largeTableContainer {
|
.largeTableContainer {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -80,12 +59,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 950px) {
|
@media screen and (min-width: 950px) {
|
||||||
.container {
|
|
||||||
margin-top: calc((var(--Spacing-x2) + 5.8rem) * -1);
|
|
||||||
margin-left: calc(var(--Spacing-x3) * -1);
|
|
||||||
margin-right: calc(var(--Spacing-x3) * -1);
|
|
||||||
margin-bottom: calc((17.5rem + var(--Spacing-x2)) * -1);
|
|
||||||
}
|
|
||||||
.mobileColumns {
|
.mobileColumns {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -111,12 +84,10 @@
|
|||||||
|
|
||||||
.intro {
|
.intro {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
max-width: 1512px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.largeTableContainer {
|
.largeTableContainer {
|
||||||
display: block;
|
display: block;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
max-width: 1512px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,22 +8,13 @@
|
|||||||
.header {
|
.header {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--Spacing-x1);
|
gap: var(--Spacing-x1);
|
||||||
grid-template-columns: 1fr auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.preamble {
|
||||||
grid-column: 1/2;
|
color: var(--Base-Text-Primary-High-contrast);
|
||||||
grid-row: 1/2;
|
font-size: var(--typography-Body-Regular-fontSize);
|
||||||
}
|
line-height: var(--typography-Body-Regular-lineHeight);
|
||||||
|
margin: 0;
|
||||||
.link {
|
|
||||||
grid-column: 2/-1;
|
|
||||||
grid-row: 1/2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.subtitle {
|
|
||||||
grid-column: 1/-1;
|
|
||||||
grid-row: 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 950px) {
|
@media screen and (min-width: 950px) {
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
|
import { Lang } from "@/constants/languages"
|
||||||
import { serverClient } from "@/lib/trpc/server"
|
import { serverClient } from "@/lib/trpc/server"
|
||||||
|
|
||||||
import { auth } from "@/auth"
|
import { auth } from "@/auth"
|
||||||
import SectionContainer from "@/components/Section/Container"
|
import SectionContainer from "@/components/Section/Container"
|
||||||
import Header from "@/components/Section/Header"
|
import Header from "@/components/Section/Header"
|
||||||
|
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||||
|
|
||||||
|
import OverviewTableTitle from "./OverviewTable/Title"
|
||||||
import HowItWorks from "./HowItWorks"
|
import HowItWorks from "./HowItWorks"
|
||||||
import LoyaltyLevels from "./LoyaltyLevels"
|
import LoyaltyLevels from "./LoyaltyLevels"
|
||||||
import OverviewTable from "./OverviewTable"
|
import OverviewTable from "./OverviewTable"
|
||||||
@@ -33,6 +36,35 @@ async function DynamicComponentBlock({ component }: DynamicComponentProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These should ultimately be fetched from Contentstack
|
||||||
|
const titleTranslations = {
|
||||||
|
[Lang.en]: [
|
||||||
|
{ text: "7 delightful levels", highlight: true },
|
||||||
|
{ text: "of friendship", highlight: false },
|
||||||
|
],
|
||||||
|
// TODO: Add translations for the following languages
|
||||||
|
[Lang.da]: [
|
||||||
|
{ text: "7 delightful levels", highlight: true },
|
||||||
|
{ text: "of friendship", highlight: false },
|
||||||
|
],
|
||||||
|
[Lang.no]: [
|
||||||
|
{ text: "7 delightful levels", highlight: true },
|
||||||
|
{ text: "of friendship", highlight: false },
|
||||||
|
],
|
||||||
|
[Lang.sv]: [
|
||||||
|
{ text: "7 delightful levels", highlight: true },
|
||||||
|
{ text: "of friendship", highlight: false },
|
||||||
|
],
|
||||||
|
[Lang.fi]: [
|
||||||
|
{ text: "7 delightful levels", highlight: true },
|
||||||
|
{ text: "of friendship", highlight: false },
|
||||||
|
],
|
||||||
|
[Lang.de]: [
|
||||||
|
{ text: "7 delightful levels", highlight: true },
|
||||||
|
{ text: "of friendship", highlight: false },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
export default function DynamicContent({
|
export default function DynamicContent({
|
||||||
dynamicContent,
|
dynamicContent,
|
||||||
firstItem,
|
firstItem,
|
||||||
@@ -43,9 +75,17 @@ export default function DynamicContent({
|
|||||||
dynamicContent.title
|
dynamicContent.title
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const isOverviewTable =
|
||||||
|
dynamicContent.component === LoyaltyComponentEnum.overview_table
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SectionContainer className={styles.container}>
|
<SectionContainer className={styles.container}>
|
||||||
{displayHeader ? (
|
{isOverviewTable ? (
|
||||||
|
<div className={styles.header}>
|
||||||
|
<OverviewTableTitle texts={titleTranslations[Lang.en]} />
|
||||||
|
<Subtitle>{dynamicContent.subtitle}</Subtitle>
|
||||||
|
</div>
|
||||||
|
) : displayHeader ? (
|
||||||
<Header
|
<Header
|
||||||
link={dynamicContent.link}
|
link={dynamicContent.link}
|
||||||
subtitle={dynamicContent.subtitle}
|
subtitle={dynamicContent.subtitle}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
query GetAccountPage($locale: String!, $uid: String!) {
|
query GetAccountPage($locale: String!, $uid: String!) {
|
||||||
account_page(locale: $locale, uid: $uid) {
|
account_page(locale: $locale, uid: $uid) {
|
||||||
|
heading
|
||||||
url
|
url
|
||||||
title
|
title
|
||||||
content {
|
content {
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ const accountPageContentItem = z.discriminatedUnion("__typename", [
|
|||||||
|
|
||||||
export const validateAccountPageSchema = z.object({
|
export const validateAccountPageSchema = z.object({
|
||||||
account_page: z.object({
|
account_page: z.object({
|
||||||
|
heading: z.string().nullable(),
|
||||||
url: z.string(),
|
url: z.string(),
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
content: z.array(accountPageContentItem),
|
content: z.array(accountPageContentItem),
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
import { removeEmptyObjects } from "../../utils"
|
import { removeEmptyObjects } from "../../utils"
|
||||||
import {
|
import {
|
||||||
type AccountPage,
|
type AccountPage,
|
||||||
|
AccountPageDataRaw,
|
||||||
AccountPageRefsDataRaw,
|
AccountPageRefsDataRaw,
|
||||||
validateAccountPageRefsSchema,
|
validateAccountPageRefsSchema,
|
||||||
validateAccountPageSchema,
|
validateAccountPageSchema,
|
||||||
@@ -62,7 +63,7 @@ export const accountPageQueryRouter = router({
|
|||||||
generateTag(lang, validatedAccountPageRefs.data.account_page.system.uid),
|
generateTag(lang, validatedAccountPageRefs.data.account_page.system.uid),
|
||||||
].flat()
|
].flat()
|
||||||
|
|
||||||
const response = await request<AccountPageRefsDataRaw>(
|
const response = await request<AccountPageDataRaw>(
|
||||||
GetAccountPage,
|
GetAccountPage,
|
||||||
{
|
{
|
||||||
locale: lang,
|
locale: lang,
|
||||||
|
|||||||
Reference in New Issue
Block a user