@@ -7,24 +7,30 @@ interface IfProps {
77 lang ?: LanguageKey ;
88 clientLang ?: LanguageKey ;
99 agentLang ?: LanguageKey ;
10- clientOrAgentLang ?: LanguageKey ;
1110 loggedIn ?: boolean ;
1211 className ?: string ;
1312 children : React . ReactNode ;
1413 as ?: React . ElementType ;
1514}
1615
17- const If : React . FC < IfProps > = ( { lang, clientLang, agentLang, clientOrAgentLang , loggedIn, children } ) => {
16+ const If : React . FC < IfProps > = ( { lang, clientLang, agentLang, loggedIn, children } ) => {
1817 const { activePage } = useLayoutContext ( ) ;
19- const { language, clientLanguage, agentLanguage } = activePage ;
18+ const { language, isDualLanguage , clientLanguage, agentLanguage } = activePage ;
2019 const userContext = useContext ( UserContext ) ;
2120
2221 let shouldShow = true ;
2322
2423 // Check language condition if lang prop is provided
25- if ( lang !== undefined && language ) {
24+ if ( lang !== undefined ) {
2625 const splitLang = lang . split ( ',' ) ;
27- shouldShow = shouldShow && splitLang . includes ( language ) ;
26+ if ( isDualLanguage ) {
27+ // On dual-language pages, check if either client or agent matches
28+ const clientMatches = clientLanguage && splitLang . includes ( clientLanguage ) ;
29+ const agentMatches = agentLanguage && splitLang . includes ( agentLanguage ) ;
30+ shouldShow = shouldShow && ! ! ( clientMatches || agentMatches ) ;
31+ } else if ( language ) {
32+ shouldShow = shouldShow && splitLang . includes ( language ) ;
33+ }
2834 }
2935
3036 // Check client language condition if clientLang prop is provided
@@ -39,14 +45,6 @@ const If: React.FC<IfProps> = ({ lang, clientLang, agentLang, clientOrAgentLang,
3945 shouldShow = shouldShow && splitLang . includes ( agentLanguage ) ;
4046 }
4147
42- // Check if either client or agent matches (OR logic) - useful for shared requirements
43- if ( clientOrAgentLang !== undefined ) {
44- const splitLang = clientOrAgentLang . split ( ',' ) ;
45- const clientMatches = clientLanguage && splitLang . includes ( clientLanguage ) ;
46- const agentMatches = agentLanguage && splitLang . includes ( agentLanguage ) ;
47- shouldShow = shouldShow && ( clientMatches || agentMatches ) ;
48- }
49-
5048 // Check logged in condition if loggedIn prop is provided
5149 if ( loggedIn !== undefined && userContext . sessionState !== undefined ) {
5250 const isSignedIn = userContext . sessionState . signedIn ?? false ;
0 commit comments