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,6 +1,7 @@
import JsonToHtml from "@/components/JsonToHtml"
import Overview from "@/components/MyPages/Blocks/Overview"
import Shortcuts from "@/components/MyPages/Blocks/Shortcuts"
import { getLang } from "@/i18n/serverContext"
import { removeMultipleSlashes } from "@/utils/url"
import { modWebviewLink } from "@/utils/webviews"
@@ -39,7 +40,7 @@ function DynamicComponent({ component, props }: AccountPageContentProps) {
}
}
export default function Content({ lang, content }: ContentProps) {
export default function Content({ content }: ContentProps) {
return (
<>
{content.map((item, idx) => {
@@ -62,7 +63,6 @@ export default function Content({ lang, content }: ContentProps) {
: null
const componentProps = {
lang,
title: item.dynamic_content.title,
// TODO: rename preamble to subtitle in Contentstack?
subtitle: item.dynamic_content.preamble,
@@ -79,7 +79,7 @@ export default function Content({ lang, content }: ContentProps) {
const shortcuts = item.shortcuts.shortcuts.map((shortcut) => {
return {
...shortcut,
url: modWebviewLink(shortcut.url, lang),
url: modWebviewLink(shortcut.url, getLang()),
}
})
return (