@@ -4,31 +4,21 @@ import { MainContextT, MainContext, getMainContext } from 'components/context/Ma
4
4
import { DefaultLayout } from 'components/DefaultLayout'
5
5
import { GHAEReleaseNotes } from 'components/release-notes/GHAEReleaseNotes'
6
6
import { GHESReleaseNotes } from 'components/release-notes/GHESReleaseNotes'
7
- import {
8
- CurrentVersion ,
9
- GHAEReleaseNotesContextT ,
10
- GHESReleaseNotesContextT ,
11
- } from 'components/release-notes/types'
7
+ import { GHAEReleaseNotesContextT , GHESReleaseNotesContextT } from 'components/release-notes/types'
12
8
13
9
const liquid = new Liquid ( )
14
10
type Props = {
15
11
mainContext : MainContextT
16
- ghaeContext : GHAEReleaseNotesContextT
17
- ghesContext : GHESReleaseNotesContextT
18
- currentVersion : CurrentVersion
12
+ ghaeContext ?: GHAEReleaseNotesContextT
13
+ ghesContext ?: GHESReleaseNotesContextT
19
14
}
20
- export default function ReleaseNotes ( {
21
- mainContext,
22
- ghesContext,
23
- ghaeContext,
24
- currentVersion,
25
- } : Props ) {
15
+ export default function ReleaseNotes ( { mainContext, ghesContext, ghaeContext } : Props ) {
26
16
return (
27
17
< MainContext . Provider value = { mainContext } >
28
18
< DefaultLayout >
29
- { currentVersion . plan === 'enterprise-server' && < GHESReleaseNotes context = { ghesContext } /> }
19
+ { ghesContext && < GHESReleaseNotes context = { ghesContext } /> }
30
20
31
- { currentVersion . plan === 'github-ae' && < GHAEReleaseNotes context = { ghaeContext } /> }
21
+ { ghaeContext && < GHAEReleaseNotes context = { ghaeContext } /> }
32
22
</ DefaultLayout >
33
23
</ MainContext . Provider >
34
24
)
@@ -42,35 +32,41 @@ export const getServerSideProps: GetServerSideProps<Props> = async (context) =>
42
32
return {
43
33
props : {
44
34
mainContext : getMainContext ( req , res ) ,
45
- currentVersion,
46
- ghesContext : {
47
- currentVersion,
48
- latestPatch,
49
- latestRelease,
50
- prevRelease : req . context . prevRelease || '' ,
51
- nextRelease : req . context . nextRelease || '' ,
52
- releaseNotes : req . context . releaseNotes ,
53
- releases : req . context . releases ,
54
- message : {
55
- ghes_release_notes_upgrade_patch_only : liquid . parseAndRenderSync (
56
- req . context . site . data . ui . header . notices . ghes_release_notes_upgrade_patch_only ,
57
- { latestPatch, latestRelease }
58
- ) ,
59
- ghes_release_notes_upgrade_release_only : liquid . parseAndRenderSync (
60
- req . context . site . data . ui . header . notices . ghes_release_notes_upgrade_release_only ,
61
- { latestPatch, latestRelease }
62
- ) ,
63
- ghes_release_notes_upgrade_patch_and_release : liquid . parseAndRenderSync (
64
- req . context . site . data . ui . header . notices . ghes_release_notes_upgrade_patch_and_release ,
65
- { latestPatch, latestRelease }
66
- ) ,
67
- } ,
68
- } ,
69
- ghaeContext : {
70
- currentVersion,
71
- releaseNotes : req . context . releaseNotes ,
72
- releases : req . context . releases ,
73
- } ,
35
+ ghesContext :
36
+ currentVersion . plan === 'enterprise-server'
37
+ ? {
38
+ currentVersion,
39
+ latestPatch,
40
+ latestRelease,
41
+ prevRelease : req . context . prevRelease || '' ,
42
+ nextRelease : req . context . nextRelease || '' ,
43
+ releaseNotes : req . context . releaseNotes ,
44
+ releases : req . context . releases ,
45
+ message : {
46
+ ghes_release_notes_upgrade_patch_only : liquid . parseAndRenderSync (
47
+ req . context . site . data . ui . header . notices . ghes_release_notes_upgrade_patch_only ,
48
+ { latestPatch, latestRelease }
49
+ ) ,
50
+ ghes_release_notes_upgrade_release_only : liquid . parseAndRenderSync (
51
+ req . context . site . data . ui . header . notices . ghes_release_notes_upgrade_release_only ,
52
+ { latestPatch, latestRelease }
53
+ ) ,
54
+ ghes_release_notes_upgrade_patch_and_release : liquid . parseAndRenderSync (
55
+ req . context . site . data . ui . header . notices
56
+ . ghes_release_notes_upgrade_patch_and_release ,
57
+ { latestPatch, latestRelease }
58
+ ) ,
59
+ } ,
60
+ }
61
+ : undefined ,
62
+ ghaeContext :
63
+ currentVersion . plan === 'github-ae'
64
+ ? {
65
+ currentVersion,
66
+ releaseNotes : req . context . releaseNotes ,
67
+ releases : req . context . releases ,
68
+ }
69
+ : undefined ,
74
70
} ,
75
71
}
76
72
}
0 commit comments