Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): Article Institution Panel - Read eyebrow text from org namespace #17292

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
}
RunarVestmann marked this conversation as resolved.
Show resolved Hide resolved
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
Loading