-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathindex.tsx
More file actions
77 lines (70 loc) · 2.53 KB
/
index.tsx
File metadata and controls
77 lines (70 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
'use client';
import { useTranslations } from 'next-intl';
import { Fragment, useState } from 'react';
import type { FC } from 'react';
import FormattedTime from '#site/components/Common/FormattedTime';
import EOLModal from '#site/components/EOL/EOLModal';
import VulnerabilityChips from '#site/components/EOL/VulnerabilityChips';
import LinkWithArrow from '#site/components/LinkWithArrow';
import provideReleaseData from '#site/next-data/providers/releaseData';
import provideVulnerabilities from '#site/next-data/providers/vulnerabilities';
import { EOL_VERSION_IDENTIFIER } from '#site/next.constants.mjs';
const EOLReleaseTable: FC = () => {
const releaseData = provideReleaseData();
const vulnerabilities = provideVulnerabilities();
const eolReleases = releaseData.filter(
release => release.status === EOL_VERSION_IDENTIFIER
);
const t = useTranslations();
const [currentModal, setCurrentModal] = useState<string | undefined>();
return (
<table id="tbVulnerabilities">
<thead>
<tr>
<th>
{t('components.eolTable.version')} (
{t('components.eolTable.codename')})
</th>
<th>{t('components.eolTable.lastUpdated')}</th>
<th>{t('components.eolTable.vulnerabilities')}</th>
<th>{t('components.eolTable.details')}</th>
</tr>
</thead>
<tbody>
{eolReleases.map(release => (
<Fragment key={release.major}>
<tr>
<td data-label="Version">
v{release.major}{' '}
{release.codename ? `(${release.codename})` : ''}
</td>
<td data-label="Date">
<FormattedTime date={release.releaseDate} />
</td>
<td>
<VulnerabilityChips
vulnerabilities={vulnerabilities[release.major]}
/>
</td>
<td>
<LinkWithArrow
className="cursor-pointer"
onClick={() => setCurrentModal(release.version)}
>
{t('components.downloadReleasesTable.details')}
</LinkWithArrow>
</td>
</tr>
<EOLModal
release={release}
vulnerabilities={vulnerabilities[release.major]}
open={currentModal === release.version}
onOpenChange={open => open || setCurrentModal(undefined)}
/>
</Fragment>
))}
</tbody>
</table>
);
};
export default EOLReleaseTable;