File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import AlertBox from '@node-core/ui-components/Common/AlertBox' ;
22import { useTranslations } from 'next-intl' ;
3+ import { use , type FC } from 'react' ;
34
45import Link from '#site/components/Link' ;
6+ import { ReleasesContext } from '#site/providers/releaseProvider' ;
57
68import type { NodeReleaseStatus } from '#site/types' ;
7- import type { FC } from 'react' ;
89
910type WithReleaseAlertBoxProps = {
1011 status : NodeReleaseStatus ;
1112} ;
1213
1314const WithReleaseAlertBox : FC < WithReleaseAlertBoxProps > = ( { status } ) => {
15+ const { releases } = use ( ReleasesContext ) ;
1416 const t = useTranslations ( ) ;
1517
18+ const hasCurrent = releases . some ( ( { status } ) => status === 'Current' ) ;
19+ const hasAlpha = releases . some ( ( { status } ) => status === 'Alpha' ) ;
20+
1621 switch ( status ) {
1722 case 'EOL' :
1823 return (
@@ -43,17 +48,24 @@ const WithReleaseAlertBox: FC<WithReleaseAlertBoxProps> = ({ status }) => {
4348 </ AlertBox >
4449 ) ;
4550 case 'LTS' :
46- return (
47- < AlertBox
48- title = { t ( 'components.common.alertBox.info' ) }
49- level = "success"
50- size = "small"
51- >
52- { t . rich ( 'components.releaseModal.ltsVersionFeaturesNotice' , {
53- link : text => < Link href = "/download/current" > { text } </ Link > ,
54- } ) }
55- </ AlertBox >
56- ) ;
51+ if ( hasCurrent || hasAlpha ) {
52+ return (
53+ < AlertBox
54+ title = { t ( 'components.common.alertBox.info' ) }
55+ level = "success"
56+ size = "small"
57+ >
58+ { t . rich ( 'components.releaseModal.ltsVersionFeaturesNotice' , {
59+ link : text => (
60+ < Link href = { `/download/${ hasCurrent ? 'current' : 'alpha' } ` } >
61+ { text }
62+ </ Link >
63+ ) ,
64+ } ) }
65+ </ AlertBox >
66+ ) ;
67+ }
68+ return null ;
5769 default :
5870 return null ;
5971 }
You can’t perform that action at this time.
0 commit comments