({ context }: Props)
| 18 | } |
| 19 | |
| 20 | export function GHESReleaseNotes({ context }: Props) { |
| 21 | const router = useRouter() |
| 22 | const { currentProduct } = useMainContext() |
| 23 | const [focusedPatch, setFocusedPatch] = useState('') |
| 24 | const { latestPatch, latestRelease, currentVersion, releaseNotes, releases, message } = context |
| 25 | return ( |
| 26 | <div className="d-flex"> |
| 27 | <article className="min-width-0 flex-1"> |
| 28 | <div className="d-flex flex-items-center flex-justify-center color-bg-default text-bold px-5 py-2"> |
| 29 | <h1 className="f4 py-3 m-0"> |
| 30 | {currentVersion.planTitle} {currentVersion.currentRelease} release notes |
| 31 | </h1> |
| 32 | </div> |
| 33 | <MarkdownContent data-search="article-body"> |
| 34 | {releaseNotes.map((patch) => { |
| 35 | return ( |
| 36 | <GHESReleaseNotePatch |
| 37 | key={patch.version} |
| 38 | patch={patch} |
| 39 | currentVersion={currentVersion} |
| 40 | latestPatch={latestPatch} |
| 41 | latestRelease={latestRelease} |
| 42 | message={message} |
| 43 | didEnterView={() => { |
| 44 | setFocusedPatch(patch.version) |
| 45 | }} |
| 46 | /> |
| 47 | ) |
| 48 | })} |
| 49 | </MarkdownContent> |
| 50 | </article> |
| 51 | |
| 52 | <aside |
| 53 | className={cx( |
| 54 | 'position-sticky d-none d-md-block border-left no-print color-bg-default flex-shrink-0', |
| 55 | styles.aside |
| 56 | )} |
| 57 | > |
| 58 | <nav className="height-full overflow-auto"> |
| 59 | <MarkdownContent> |
| 60 | <ul className="list-style-none pl-0 text-bold"> |
| 61 | {releases.map((release) => { |
| 62 | const releaseLink = `/${router.locale}/${currentVersion.plan}@${release.version}/${currentProduct?.id}/release-notes` |
| 63 | |
| 64 | // Use client-side router link component only if it's a supported release. |
| 65 | // Otherwise, it will trigger a NextJS data XHR fetch for releases |
| 66 | // that are deprecated when in fact you should load it regularly |
| 67 | // so it's read as a proxy from the archive. |
| 68 | const LinkComponent = currentVersion.releases.includes(release.version) |
| 69 | ? Link |
| 70 | : PlainLink |
| 71 | |
| 72 | if (!release.patches || release.patches.length === 0) { |
| 73 | return ( |
| 74 | <li key={release.version} className="border-bottom"> |
| 75 | <LinkComponent |
| 76 | href={releaseLink} |
| 77 | className="Link--primary no-underline px-3 py-4 my-0 d-flex flex-items-center flex-justify-between" |
nothing calls this directly
no test coverage detected