33import { useTranslations } from 'next-intl' ;
44import type { FC } from 'react' ;
55import { useContext , useMemo } from 'react' ;
6- import semVer from 'semver' ;
76
87import AlertBox from '@/components/Common/AlertBox' ;
98import Skeleton from '@/components/Common/Skeleton' ;
109import JSXCodeBox from '@/components/JSX/CodeBox' ;
11- import { ESP_SUPPORT_THRESHOLD_VERSION } from '@/next.constants.mjs' ;
1210import { createSval } from '@/next.jsx.compiler.mjs' ;
1311import { ReleaseContext , ReleasesContext } from '@/providers/releaseProvider' ;
1412import type { ReleaseContextType } from '@/types/release' ;
@@ -46,6 +44,7 @@ const ReleaseCodeBox: FC = () => {
4644 [ platform ]
4745 ) ;
4846
47+ // Parses the snippets based on the selected platform, package manager, and release context
4948 const parsedSnippets = useMemo ( ( ) => {
5049 // Retrieves a snippet for the given Installation Method (aka Platform)
5150 const platformSnippet = snippets . find (
@@ -67,20 +66,19 @@ const ReleaseCodeBox: FC = () => {
6766
6867 // Determines the code language based on the OS
6968 const codeLanguage = os === 'WIN' ? 'ps1' : 'bash' ;
69+
70+ // Determines if the code box should render the skeleton loader
7071 const renderSkeleton = os === 'LOADING' || platform === '' ;
7172
7273 return (
7374 < div className = "mb-6 mt-4 flex flex-col gap-2" >
74- { semVer . lt ( release . versionWithPrefix , ESP_SUPPORT_THRESHOLD_VERSION ) && (
75+ { release . status === 'End-of-life' && (
7576 < AlertBox title = "Warning" level = "warning" size = "small" >
7677 { t ( 'layouts.download.codeBox.unsupportedVersionWarning' ) }
7778 </ AlertBox >
7879 ) }
7980
80- < Skeleton
81- loading = { renderSkeleton }
82- hide = { ! currentPlatform || currentPlatform . recommended }
83- >
81+ < Skeleton loading = { renderSkeleton } hide = { currentPlatform ?. recommended } >
8482 < AlertBox title = "Info" level = "info" size = "small" >
8583 { t ( 'layouts.download.codeBox.communityPlatformInfo' ) }
8684 </ AlertBox >
@@ -108,7 +106,7 @@ const ReleaseCodeBox: FC = () => {
108106 platform : currentPlatform ?. label ,
109107 b : chunks => < b > { chunks } </ b > ,
110108 link : chunks => (
111- < LinkWithArrow href = { currentPlatform ?. maintainerUrl } >
109+ < LinkWithArrow href = { currentPlatform ?. url } >
112110 { chunks }
113111 </ LinkWithArrow >
114112 ) ,
0 commit comments