({
patch,
currentVersion,
latestPatch,
latestRelease,
message,
didEnterView,
}: Props)
| 19 | didEnterView: () => void |
| 20 | } |
| 21 | export function GHESReleaseNotePatch({ |
| 22 | patch, |
| 23 | currentVersion, |
| 24 | latestPatch, |
| 25 | latestRelease, |
| 26 | message, |
| 27 | didEnterView, |
| 28 | }: Props) { |
| 29 | const { t } = useTranslation('header') |
| 30 | const containerRef = useRef<HTMLDivElement>(null) |
| 31 | const onScreen = useOnScreen(containerRef, { rootMargin: '-40% 0px -50%' }) |
| 32 | useEffect(() => { |
| 33 | if (onScreen) { |
| 34 | didEnterView() |
| 35 | } |
| 36 | }, [onScreen]) |
| 37 | |
| 38 | return ( |
| 39 | <div |
| 40 | ref={containerRef} |
| 41 | className={cx(styles.sectionHeading, 'mb-10 pb-6 border-bottom border-top')} |
| 42 | id={patch.version} |
| 43 | > |
| 44 | <header style={{ zIndex: 1 }} className="container-xl border-bottom px-3 pt-4 pb-2"> |
| 45 | <div className="d-flex flex-justify-between flex-wrap"> |
| 46 | <h2 className="border-bottom-0 m-0 p-0 mt-2"> |
| 47 | {currentVersion.versionTitle}.{patch.patchVersion} |
| 48 | </h2> |
| 49 | |
| 50 | {patch.release_candidate && ( |
| 51 | <span |
| 52 | className="IssueLabel color-bg-attention-emphasis color-fg-on-emphasis ml-3 flex-items-center d-inline-flex" |
| 53 | style={{ whiteSpace: 'pre' }} |
| 54 | > |
| 55 | Release Candidate |
| 56 | </span> |
| 57 | )} |
| 58 | |
| 59 | {currentVersion.plan === 'enterprise-server' && ( |
| 60 | <Link |
| 61 | href={`https://enterprise.github.com/releases/${patch.downloadVersion}/download`} |
| 62 | className="btn btn-outline mt-2 text-small text-bold no-underline" |
| 63 | > |
| 64 | Download GitHub Enterprise Server {patch.downloadVersion} |
| 65 | </Link> |
| 66 | )} |
| 67 | </div> |
| 68 | |
| 69 | <p className="color-fg-muted mt-1">{dayjs(patch.date).format('MMMM DD, YYYY')}</p> |
| 70 | |
| 71 | {patch.version !== latestPatch && currentVersion.currentRelease === latestRelease && ( |
| 72 | <p className="color-fg-muted mt-1"> |
| 73 | <span |
| 74 | dangerouslySetInnerHTML={{ __html: message.ghes_release_notes_upgrade_patch_only }} |
| 75 | />{' '} |
| 76 | {t('notices.release_notes_use_latest')} |
| 77 | </p> |
| 78 | )} |
nothing calls this directly
no test coverage detected