| 15 | * formatted with the major version and codename if available. |
| 16 | */ |
| 17 | const groupReleasesByStatus = (releases: Array<NodeRelease>) => { |
| 18 | const groupedByStatus = releases.reduce((acc, release) => { |
| 19 | const { status, major, codename, versionWithPrefix } = release; |
| 20 | |
| 21 | if (!acc[status]) { |
| 22 | acc[status] = []; |
| 23 | } |
| 24 | |
| 25 | acc[status].push({ |
| 26 | label: `Node.js v${major}.x ${codename ? `(${codename})` : ''}`, |
| 27 | value: `/download/archive/${versionWithPrefix}`, |
| 28 | }); |
| 29 | |
| 30 | return acc; |
| 31 | }, {} as Navigations); |
| 32 | |
| 33 | return STATUS_ORDER.filter(status => groupedByStatus[status]).map(status => ({ |
| 34 | label: status, |
| 35 | items: groupedByStatus[status], |
| 36 | })); |
| 37 | }; |
| 38 | |
| 39 | type WithReleaseSelectProps = Omit< |
| 40 | ComponentProps<typeof StatelessSelect>, |