Skip to content

Commit

Permalink
Read eyebrow text from org namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
RunarVestmann committed Dec 19, 2024
1 parent 7bc2a59 commit a6ab935
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions apps/web/screens/Article/Article.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,14 @@ interface ArticleSidebarProps {
article: Article
activeSlug?: string | string[]
n: (s: string) => string
organizationNamespace: Record<string, string>
}

const ArticleSidebar: FC<React.PropsWithChildren<ArticleSidebarProps>> = ({
article,
activeSlug,
n,
organizationNamespace,
}) => {
const { linkResolver } = useLinkResolver()
const { activeLocale } = useI18n()
Expand Down Expand Up @@ -296,7 +298,9 @@ const ArticleSidebar: FC<React.PropsWithChildren<ArticleSidebarProps>> = ({
{article?.organization && article.organization.length > 0 && (
<InstitutionPanel
img={article.organization[0].logo?.url}
institutionTitle={n('organization')}
institutionTitle={
organizationNamespace?.['organization'] ?? n('organization')
}
institution={article.organization[0].title}
locale={activeLocale}
linkProps={{
Expand All @@ -308,7 +312,12 @@ const ArticleSidebar: FC<React.PropsWithChildren<ArticleSidebarProps>> = ({
/>
)}
{article?.subArticles && article.subArticles.length > 0 && (
<ArticleNavigation article={article} activeSlug={activeSlug} n={n} />
<ArticleNavigation
article={article}
activeSlug={activeSlug}
n={n}
organizationNamespace={organizationNamespace}
/>
)}
<RelatedContent
title={n('relatedMaterial')}
Expand All @@ -325,13 +334,15 @@ export interface ArticleProps {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
stepOptionsFromNamespace: { data: Record<string, any>[]; slug: string }[]
stepperNamespace: GetNamespaceQuery['getNamespace']
organizationNamespace: Record<string, string>
}

const ArticleScreen: Screen<ArticleProps> = ({
article,
namespace,
stepperNamespace,
stepOptionsFromNamespace,
organizationNamespace,
}) => {
const { activeLocale } = useI18n()
const portalRef = useRef()
Expand Down Expand Up @@ -540,7 +551,8 @@ const ArticleScreen: Screen<ArticleProps> = ({
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error make web strict
title: article.organization[0].title,
label: n('organization'),
label:
organizationNamespace?.['organization'] ?? n('organization'),
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error make web strict
href: getOrganizationLink(
Expand Down Expand Up @@ -616,6 +628,7 @@ const ArticleScreen: Screen<ArticleProps> = ({
article={article}
n={n}
activeSlug={query.subSlug}
organizationNamespace={organizationNamespace}
/>
</Sticky>
}
Expand Down Expand Up @@ -648,6 +661,7 @@ const ArticleScreen: Screen<ArticleProps> = ({
n={n}
activeSlug={query.subSlug}
isMenuDialog
organizationNamespace={organizationNamespace}
/>
</Box>
)}
Expand Down Expand Up @@ -774,6 +788,7 @@ const ArticleScreen: Screen<ArticleProps> = ({
n={n}
activeSlug={query.subSlug}
isMenuDialog
organizationNamespace={organizationNamespace}
/>
</Box>
)}
Expand Down Expand Up @@ -910,14 +925,15 @@ ArticleScreen.getProps = async ({ apolloClient, query, locale }) => {

const organizationNamespace = extractNamespaceFromOrganization(
article.organization?.[0],
)
) as Record<string, string>

return {
article,
namespace,
stepOptionsFromNamespace,
stepperNamespace,
customTopLoginButtonItem: organizationNamespace?.customTopLoginButtonItem,
organizationNamespace,
...getThemeConfig(article),
}
}
Expand Down

0 comments on commit a6ab935

Please sign in to comment.