@@ -5,37 +5,14 @@ import { useLocale, useTranslations } from 'next-intl';
55import { use } from 'react' ;
66
77import { redirect , usePathname } from '#site/navigation' ;
8+ import { STATUS_KIND_MAP } from '#site/next.constants.mjs' ;
89import {
910 ReleaseContext ,
1011 ReleasesContext ,
1112} from '#site/providers/releaseProvider' ;
1213
13- import type { NodeReleaseStatus } from '#site/types/releases.js' ;
1414import type { FC } from 'react' ;
1515
16- const getDropDownStatus = ( status : NodeReleaseStatus ) => {
17- if ( status === 'LTS' ) {
18- return {
19- label : 'LTS' ,
20- kind : 'info' as const ,
21- } ;
22- }
23-
24- if ( status === 'Current' ) {
25- return {
26- label : 'Current' ,
27- kind : 'default' as const ,
28- } ;
29- }
30-
31- if ( status === 'End-of-life' ) {
32- return {
33- label : 'EoL' ,
34- kind : 'warning' as const ,
35- } ;
36- }
37- } ;
38-
3916const VersionDropdown : FC = ( ) => {
4017 const { releases } = use ( ReleasesContext ) ;
4118 const { release, setVersion } = use ( ReleaseContext ) ;
@@ -69,7 +46,10 @@ const VersionDropdown: FC = () => {
6946 values = { releases . map ( ( { status, versionWithPrefix } ) => ( {
7047 value : versionWithPrefix ,
7148 label : versionWithPrefix ,
72- badge : getDropDownStatus ( status ) ,
49+ badge : {
50+ label : status ,
51+ kind : STATUS_KIND_MAP [ status ] ,
52+ } ,
7353 } ) ) }
7454 defaultValue = { release . versionWithPrefix }
7555 onChange = { setVersionOrNavigate }
0 commit comments