Merged in feature/refactor-lang (pull request #387)

feat: SW-238 Avoid prop drilling of lang

Approved-by: Michael Zetterberg
This commit is contained in:
Niclas Edenvin
2024-08-14 11:00:20 +00:00
parent 35128dbf44
commit e67212bd94
94 changed files with 378 additions and 322 deletions

View File

@@ -1,5 +1,3 @@
import { Lang } from "@/constants/languages"
import type { Image } from "@/types/image"
import type {
CurrentHeaderLink,
@@ -17,5 +15,4 @@ export type MainMenuProps = {
myPagesMobileDropdown: React.ReactNode | null
bookingHref: string
user: Pick<User, "firstName" | "lastName"> | null
lang: Lang
}

View File

@@ -1,5 +1,3 @@
import { Lang } from "@/constants/languages"
import type { TopMenuHeaderLink } from "@/types/requests/currentHeader"
export type TopMenuProps = {
@@ -7,5 +5,4 @@ export type TopMenuProps = {
homeHref: string
links: TopMenuHeaderLink[]
languageSwitcher: React.ReactNode | null
lang: Lang
}

View File

@@ -8,6 +8,5 @@ export type LanguageSwitcherLink = {
}
export type LanguageSwitcherProps = {
currentLanguage: Lang
urls: LanguageSwitcherData
}

View File

@@ -6,11 +6,11 @@ import {
import { LangParams } from "@/types/params"
export type SidebarProps = LangParams & {
export type SidebarProps = {
blocks: Sidebar[]
}
export type JoinLoyaltyContactProps = LangParams & {
export type JoinLoyaltyContactProps = {
block: JoinLoyaltyContact["join_loyalty_contact"]
}

View File

@@ -9,18 +9,15 @@ export type AccountPageContentProps = {
title: string | null
subtitle: string | null
link?: { href: string; text: string }
lang: Lang
}
}
export type AccountPageComponentProps = {
lang: Lang
title: string | null
subtitle: string | null
link?: { href: string; text: string }
}
export type ContentProps = {
lang: Lang
content: AccountPageContentItem[]
}

View File

@@ -24,12 +24,10 @@ export type EarnAndBurnProps = {
}
export interface TableProps {
lang: Lang
transactions: Transactions
}
export interface RowProps {
lang: Lang
transaction: Transaction
}

View File

@@ -6,10 +6,11 @@ export type PreviousStaysResponse = Awaited<
>
export type PreviousStaysNonNullResponseObject =
NonNullable<PreviousStaysResponse>
export type PreviousStays = NonNullable<PreviousStaysNonNullResponseObject>["data"]
export type PreviousStay = NonNullable<PreviousStaysNonNullResponseObject>["data"][number]
export type PreviousStays =
NonNullable<PreviousStaysNonNullResponseObject>["data"]
export type PreviousStay =
NonNullable<PreviousStaysNonNullResponseObject>["data"][number]
export interface PreviousStaysClientProps {
lang: Lang
initialPreviousStays: PreviousStaysNonNullResponseObject
}

View File

@@ -1,7 +1,5 @@
import type { Lang } from "@/constants/languages"
import type { Stay } from "@/server/routers/user/output"
export type StayCardProps = {
lang: Lang
stay: Stay
}

View File

@@ -6,10 +6,11 @@ export type UpcomingStaysResponse = Awaited<
>
export type UpcomingStaysNonNullResponseObject =
NonNullable<UpcomingStaysResponse>
export type UpcomingStays = NonNullable<UpcomingStaysNonNullResponseObject>["data"]
export type UpcomingStay = NonNullable<UpcomingStaysNonNullResponseObject>["data"][number]
export type UpcomingStays =
NonNullable<UpcomingStaysNonNullResponseObject>["data"]
export type UpcomingStay =
NonNullable<UpcomingStaysNonNullResponseObject>["data"][number]
export interface UpcomingStaysClientProps {
lang: Lang
initialUpcomingStays: UpcomingStaysNonNullResponseObject
}