-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
feat: redesign the previous releases page #7630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
7e18186
feat(releaseData): add minorVersions prop
araujogui 7690b45
feat: create draft minor releases table modal
araujogui 5d74cf7
refactor: initials improvements
araujogui 7a0bb61
refactor: mv releasemodal component to correct dir
araujogui 3a884c9
fix: release modal translation keys
araujogui eaad760
feat: align button group
araujogui e48060b
chore: rename badge component to badgegroup
araujogui 26179cd
refactor(BadgeGroup): use badge component
araujogui e57f065
feat(DownloadReleasesTable): add status badge
araujogui 5fd0565
feat(Modal): make subheader optional
araujogui 0617dff
refactor: create kind types
araujogui 15772af
feat(ui-components): create separator component
araujogui 5822520
feat(site): some improvements
araujogui c801322
refactor: nit
araujogui 81b57b4
feat(site): add eol alerts
araujogui 7f6fe44
fix: remove incorrect anchor href
araujogui 704dba8
feat(ui-components): add smaller badge size
araujogui 741536f
feat(site): add maintenance release status
araujogui 50881df
feat(site): make codename prominent
araujogui e6955a1
chore: fix vertical separator story
araujogui 0851074
refactor: some minor changes
araujogui 14edfae
fix: badgegroup references
araujogui dd3f334
refactor: small nit
araujogui fc55af1
feat: add minor versions release date
araujogui 88dd748
feat: smaller minor releases table
araujogui fe6c2e7
fix: oops wrong req
araujogui 04ae3ea
feat: create release overview component
araujogui 761ddd6
fix: minor release links
araujogui 76665a5
feat(ui-components): add badge border on dark mode
araujogui c71369e
chore: fix stylelint
araujogui ed0092f
chore: fix dep range
araujogui e8c2872
feat: format datetimes
araujogui 4927366
refactor: small nits
araujogui f550d22
fix: release announce links
araujogui 737bfa8
refactor: remove comment
araujogui 9a17e53
feat: use npm icon
araujogui File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
apps/site/components/Downloads/DownloadReleasesTable/DetailsButton.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use client'; | ||
|
||
import { useTranslations } from 'next-intl'; | ||
import type { FC } from 'react'; | ||
import { use } from 'react'; | ||
|
||
import LinkWithArrow from '@/components/LinkWithArrow'; | ||
import { ReleaseModalContext } from '@/providers/releaseModalProvider'; | ||
import type { NodeRelease } from '@/types'; | ||
|
||
type DetailsButtonProps = { | ||
versionData: NodeRelease; | ||
}; | ||
|
||
const DetailsButton: FC<DetailsButtonProps> = ({ versionData }) => { | ||
const t = useTranslations('components.downloadReleasesTable'); | ||
|
||
const { openModal } = use(ReleaseModalContext); | ||
|
||
return ( | ||
<LinkWithArrow | ||
className="cursor-pointer" | ||
onClick={() => openModal(versionData)} | ||
> | ||
{t('details')} | ||
</LinkWithArrow> | ||
); | ||
}; | ||
|
||
export default DetailsButton; |
58 changes: 58 additions & 0 deletions
58
apps/site/components/Downloads/DownloadReleasesTable/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import Badge from '@node-core/ui-components/Common/Badge'; | ||
import { getTranslations } from 'next-intl/server'; | ||
import type { FC } from 'react'; | ||
|
||
import FormattedTime from '@/components/Common/FormattedTime'; | ||
import DetailsButton from '@/components/Downloads/DownloadReleasesTable/DetailsButton'; | ||
import getReleaseData from '@/next-data/releaseData'; | ||
|
||
// This is a React Async Server Component | ||
// Note that Hooks cannot be used in a RSC async component | ||
// Async Components do not get re-rendered at all. | ||
const DownloadReleasesTable: FC = async () => { | ||
const releaseData = await getReleaseData(); | ||
|
||
const t = await getTranslations(); | ||
|
||
return ( | ||
<table id="tbVersions" className="download-table full-width"> | ||
<thead> | ||
<tr> | ||
<th>{t('components.downloadReleasesTable.version')}</th> | ||
<th>{t('components.downloadReleasesTable.codename')}</th> | ||
<th>{t('components.downloadReleasesTable.firstReleased')}</th> | ||
<th>{t('components.downloadReleasesTable.lastUpdated')}</th> | ||
<th>{t('components.downloadReleasesTable.status')}</th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{releaseData.map(release => ( | ||
<tr key={release.major}> | ||
<td data-label="Version">v{release.major}</td> | ||
<td data-label="LTS">{release.codename || '-'}</td> | ||
<td data-label="Date"> | ||
<FormattedTime date={release.currentStart} /> | ||
</td> | ||
<td data-label="Date"> | ||
<FormattedTime date={release.releaseDate} /> | ||
</td> | ||
<td data-label="Status"> | ||
<Badge | ||
kind={release.status === 'End-of-life' ? 'warning' : 'default'} | ||
size="small" | ||
> | ||
{release.status} | ||
araujogui marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</Badge> | ||
</td> | ||
<td className="download-table-last"> | ||
<DetailsButton versionData={release} /> | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
); | ||
}; | ||
|
||
export default DownloadReleasesTable; |
8 changes: 8 additions & 0 deletions
8
apps/site/components/Downloads/MinorReleasesTable/index.module.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@reference "../../../styles/index.css"; | ||
|
||
.links { | ||
@apply flex | ||
h-4 | ||
items-center | ||
gap-2; | ||
} |
64 changes: 64 additions & 0 deletions
64
apps/site/components/Downloads/MinorReleasesTable/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
'use client'; | ||
|
||
import Separator from '@node-core/ui-components/Common/Separator'; | ||
import { useTranslations } from 'next-intl'; | ||
import type { FC } from 'react'; | ||
|
||
import Link from '@/components/Link'; | ||
import { BASE_CHANGELOG_URL } from '@/next.constants.mjs'; | ||
import type { MinorVersion } from '@/types'; | ||
import { getNodeApiLink } from '@/util/getNodeApiLink'; | ||
|
||
import styles from './index.module.css'; | ||
|
||
type MinorReleasesTableProps = { | ||
releases: Array<MinorVersion>; | ||
}; | ||
|
||
export const MinorReleasesTable: FC<MinorReleasesTableProps> = ({ | ||
releases, | ||
}) => { | ||
const t = useTranslations('components.minorReleasesTable'); | ||
|
||
return ( | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>{t('version')}</th> | ||
<th>{t('links')}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{releases.map(release => ( | ||
<tr key={release.version}> | ||
<td>v{release.version}</td> | ||
<td> | ||
<div className={styles.links}> | ||
<Link | ||
kind="neutral" | ||
href={`https://nodejs.org/download/release/v${release.version}/`} | ||
AugustinMauroy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
> | ||
{t('actions.release')} | ||
</Link> | ||
<Separator orientation="vertical" /> | ||
<Link | ||
kind="neutral" | ||
href={`${BASE_CHANGELOG_URL}${release.version}`} | ||
> | ||
{t('actions.changelog')} | ||
</Link> | ||
<Separator orientation="vertical" /> | ||
<Link | ||
kind="neutral" | ||
href={getNodeApiLink(`v${release.version}`)} | ||
> | ||
{t('actions.docs')} | ||
</Link> | ||
</div> | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import AlertBox from '@node-core/ui-components/Common/AlertBox'; | ||
import Modal from '@node-core/ui-components/Common/Modal'; | ||
import { useTranslations } from 'next-intl'; | ||
import type { FC } from 'react'; | ||
|
||
import { MinorReleasesTable } from '@/components/Downloads/MinorReleasesTable'; | ||
import { ReleaseOverview } from '@/components/Downloads/ReleaseOverview'; | ||
import LinkWithArrow from '@/components/LinkWithArrow'; | ||
import type { NodeRelease } from '@/types'; | ||
|
||
type ReleaseModalProps = { | ||
isOpen: boolean; | ||
closeModal: () => void; | ||
release: NodeRelease; | ||
}; | ||
|
||
const ReleaseModal: FC<ReleaseModalProps> = ({ | ||
isOpen, | ||
closeModal, | ||
release, | ||
}) => { | ||
const t = useTranslations(); | ||
|
||
const modalHeadingKey = release.codename | ||
? 'components.releaseModal.title' | ||
: 'components.releaseModal.titleWithoutCodename'; | ||
|
||
const modalHeading = t(modalHeadingKey, { | ||
version: release.major, | ||
codename: release.codename ?? '', | ||
}); | ||
|
||
return ( | ||
<Modal open={isOpen} onOpenChange={closeModal} heading={modalHeading}> | ||
araujogui marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{release.status === 'End-of-life' && ( | ||
<AlertBox | ||
title={t('components.common.alertBox.warning')} | ||
level="warning" | ||
size="small" | ||
> | ||
{t('components.releaseModal.unsupportedVersionWarning')} | ||
</AlertBox> | ||
)} | ||
|
||
{release.releaseAnnounceLink && ( | ||
<LinkWithArrow href={release.releaseAnnounceLink}> | ||
{t('components.releaseModal.releaseAnnouncement')} | ||
</LinkWithArrow> | ||
)} | ||
|
||
<h5>{t('components.releaseModal.overview')}</h5> | ||
|
||
<ReleaseOverview release={release} /> | ||
|
||
<h5>{t('components.releaseModal.minorVersions')}</h5> | ||
|
||
<MinorReleasesTable releases={release.minorVersions} /> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ReleaseModal; |
38 changes: 38 additions & 0 deletions
38
apps/site/components/Downloads/ReleaseOverview/index.module.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@reference "../../../styles/index.css"; | ||
|
||
.root { | ||
@apply rounded | ||
border | ||
border-neutral-200 | ||
p-4 | ||
text-neutral-900 | ||
dark:border-neutral-800 | ||
dark:text-white; | ||
|
||
.container { | ||
@apply grid | ||
grid-cols-2 | ||
gap-4 | ||
lg:grid-cols-3; | ||
} | ||
|
||
.item { | ||
@apply flex | ||
items-center | ||
gap-2; | ||
|
||
h1 { | ||
@apply text-sm | ||
font-semibold; | ||
} | ||
|
||
h2 { | ||
@apply text-xs | ||
font-normal; | ||
} | ||
|
||
svg { | ||
@apply size-4; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.