@@ -2,8 +2,10 @@ import { translations } from '@prezly/theme-kit-intl';
22import {
33 useCategories ,
44 useCompanyInformation ,
5+ useCurrentLocale ,
56 useGetLinkLocaleSlug ,
67 useNewsroom ,
8+ useNewsroomContext ,
79 useSearchSettings ,
810} from '@prezly/theme-kit-nextjs' ;
911import classNames from 'classnames' ;
@@ -14,7 +16,7 @@ import { useEffect, useRef, useState } from 'react';
1416import { FormattedMessage , useIntl } from 'react-intl' ;
1517
1618import { useDevice , useThemeSettings } from '@/hooks' ;
17- import { IconClose , IconImage , IconMenu , IconSearch } from '@/icons' ;
19+ import { IconClose , IconEmail , IconImage , IconMenu , IconSearch } from '@/icons' ;
1820import { Button , ButtonLink } from '@/ui' ;
1921
2022import CategoriesDropdown from './CategoriesDropdown' ;
@@ -31,6 +33,8 @@ interface Props {
3133
3234function Header ( { hasError } : Props ) {
3335 const { newsroom_logo, display_name, public_galleries_number } = useNewsroom ( ) ;
36+ const { contacts } = useNewsroomContext ( ) ;
37+ const currentLocale = useCurrentLocale ( ) as unknown as { localeCode : string } ;
3438 const { logoSize } = useThemeSettings ( ) ;
3539 const categories = useCategories ( ) ;
3640 const { name } = useCompanyInformation ( ) ;
@@ -154,6 +158,35 @@ function Header({ hasError }: Props) {
154158 >
155159 < div role = "none" className = { styles . backdrop } onClick = { closeMenu } />
156160 < ul id = "menu" className = { styles . navigationInner } >
161+ { contacts &&
162+ contacts . length > 0 &&
163+ contacts . some ( ( contact ) =>
164+ contact . display_locales . some ( ( locale ) => {
165+ const normalizedLocaleCode = locale . code . replace (
166+ '_' ,
167+ '-' ,
168+ ) ;
169+ const normalizedCurrentLocale =
170+ currentLocale . localeCode . replace ( '_' , '-' ) ;
171+ return (
172+ normalizedLocaleCode === normalizedCurrentLocale ||
173+ locale . language_code === currentLocale . localeCode
174+ ) ;
175+ } ) ,
176+ ) && (
177+ < li className = { styles . navigationItem } >
178+ < ButtonLink
179+ href = "#contacts"
180+ variation = "navigation"
181+ className = { styles . navigationButton }
182+ icon = { IconEmail }
183+ >
184+ < FormattedMessage
185+ { ...translations . contacts . title }
186+ />
187+ </ ButtonLink >
188+ </ li >
189+ ) }
157190 { public_galleries_number > 0 && (
158191 < li className = { styles . navigationItem } >
159192 < ButtonLink
0 commit comments