@@ -4,22 +4,18 @@ import Cookies from 'js-cookie';
4
4
import { useTranslations } from 'next-intl' ;
5
5
import Head from 'next/head' ;
6
6
import { useEffect , useState } from 'react' ;
7
- import { render } from 'storyblok-rich-text-react-renderer' ;
8
7
import SessionCard from '../../components/cards/SessionCard' ;
9
8
import { ContentUnavailable } from '../../components/common/ContentUnavailable' ;
10
9
import Link from '../../components/common/Link' ;
11
10
import CourseHeader from '../../components/course/CourseHeader' ;
12
11
import CourseIntroduction from '../../components/course/CourseIntroduction' ;
13
- import CourseStatusHeader from '../../components/course/CourseStatusHeader' ;
14
12
import { PROGRESS_STATUS } from '../../constants/enums' ;
15
13
import { COURSE_OVERVIEW_VIEWED } from '../../constants/events' ;
16
14
import { useTypedSelector } from '../../hooks/store' ;
17
15
import { rowStyle } from '../../styles/common' ;
18
- import { courseIsLiveNow , courseIsLiveSoon } from '../../utils/courseLiveStatus' ;
19
16
import { determineCourseProgress } from '../../utils/courseProgress' ;
20
17
import hasAccessToPage from '../../utils/hasAccessToPage' ;
21
18
import { getEventUserData , logEvent } from '../../utils/logEvent' ;
22
- import { RichTextOptions } from '../../utils/richText' ;
23
19
import { SignUpBanner } from '../banner/SignUpBanner' ;
24
20
25
21
const containerStyle = {
@@ -49,12 +45,6 @@ export interface StoryblokCoursePageProps {
49
45
video_transcript : ISbRichtext ;
50
46
weeks : { name : string ; sessions : any } [ ] ; // TODO: replace type with StoryblokSessionPageProps
51
47
included_for_partners : string [ ] ;
52
- coming_soon : boolean ;
53
- coming_soon_content : ISbRichtext ;
54
- live_start_date : string ;
55
- live_end_date : string ;
56
- live_soon_content : ISbRichtext ;
57
- live_now_content : ISbRichtext ;
58
48
languages : string [ ] ; // TODO: implement this field - currently uses FF_DISABLED_COURSES env var
59
49
component : 'Course' ;
60
50
}
@@ -73,12 +63,6 @@ const StoryblokCoursePage = (props: StoryblokCoursePageProps) => {
73
63
video_transcript,
74
64
weeks,
75
65
included_for_partners,
76
- coming_soon,
77
- coming_soon_content,
78
- live_start_date,
79
- live_end_date,
80
- live_soon_content,
81
- live_now_content,
82
66
} = props ;
83
67
84
68
const t = useTranslations ( 'Courses' ) ;
@@ -119,29 +103,10 @@ const StoryblokCoursePage = (props: StoryblokCoursePageProps) => {
119
103
120
104
const eventUserData = getEventUserData ( userCreatedAt , partnerAccesses , partnerAdmin ) ;
121
105
122
- const courseComingSoon : boolean = coming_soon ;
123
- const courseLiveSoon : boolean = courseIsLiveSoon ( {
124
- live_start_date,
125
- live_end_date,
126
- coming_soon,
127
- live_soon_content,
128
- } ) ;
129
- const courseLiveNow : boolean = courseIsLiveNow ( {
130
- live_start_date,
131
- live_end_date,
132
- coming_soon,
133
- live_now_content,
134
- } ) ;
135
- // only show live content to public users
136
- const liveCourseAccess = partnerAccesses . length === 0 && ! partnerAdmin . id ;
137
-
138
106
const eventData = {
139
107
...eventUserData ,
140
108
course_name : name ,
141
109
course_storyblok_id : storyId ,
142
- course_coming_soon : courseComingSoon ,
143
- course_live_soon : courseLiveSoon ,
144
- course_live_now : courseLiveNow ,
145
110
course_progress : courseProgress ,
146
111
} ;
147
112
@@ -170,12 +135,6 @@ const StoryblokCoursePage = (props: StoryblokCoursePageProps) => {
170
135
video_transcript,
171
136
weeks,
172
137
included_for_partners,
173
- coming_soon,
174
- coming_soon_content,
175
- live_start_date,
176
- live_end_date,
177
- live_soon_content,
178
- live_now_content,
179
138
} ) }
180
139
>
181
140
< Head >
@@ -196,63 +155,42 @@ const StoryblokCoursePage = (props: StoryblokCoursePageProps) => {
196
155
courseProgress = { courseProgress }
197
156
/>
198
157
< Container sx = { containerStyle } >
199
- { courseComingSoon ? (
200
- < >
201
- { liveCourseAccess && courseLiveSoon ? (
202
- < Box maxWidth = { 700 } >
203
- < CourseStatusHeader status = "liveSoon" />
204
- { render ( live_soon_content , RichTextOptions ) }
205
- </ Box >
206
- ) : (
207
- < Box maxWidth = { 700 } >
208
- < CourseStatusHeader status = "comingSoon" />
209
- { render ( coming_soon_content , RichTextOptions ) }
210
- </ Box >
211
- ) }
212
- </ >
213
- ) : (
214
- < >
215
- { video && (
216
- < CourseIntroduction
217
- video = { video }
218
- name = { name }
219
- video_transcript = { video_transcript }
220
- live_soon_content = { live_soon_content }
221
- live_now_content = { live_now_content }
222
- eventData = { eventData }
223
- courseLiveSoon = { courseLiveSoon }
224
- courseLiveNow = { courseLiveNow }
225
- liveCourseAccess = { liveCourseAccess }
226
- />
227
- ) }
228
- < Box sx = { sessionsContainerStyle } >
229
- { weeks . map ( ( week : any ) => {
230
- return (
231
- < Box mb = { 6 } key = { week . name . split ( ':' ) [ 0 ] } >
232
- < Typography mb = { { xs : 0 , md : 3.5 } } key = { week . name } component = "h2" variant = "h2" >
233
- { week . name }
234
- </ Typography >
235
- < Box sx = { cardsContainerStyle } >
236
- { week . sessions . map ( ( session : any ) => {
237
- const position = `${ t ( 'session' ) } ${ session . position / 10 - 1 } ` ;
238
-
239
- return (
240
- < SessionCard
241
- key = { session . id }
242
- session = { session }
243
- sessionSubtitle = { position }
244
- storyblokCourseId = { storyId }
245
- isLoggedIn = { isLoggedIn }
246
- />
247
- ) ;
248
- } ) }
249
- </ Box >
158
+ < >
159
+ { video && (
160
+ < CourseIntroduction
161
+ video = { video }
162
+ name = { name }
163
+ video_transcript = { video_transcript }
164
+ eventData = { eventData }
165
+ />
166
+ ) }
167
+ < Box sx = { sessionsContainerStyle } >
168
+ { weeks . map ( ( week : any ) => {
169
+ return (
170
+ < Box mb = { 6 } key = { week . name . split ( ':' ) [ 0 ] } >
171
+ < Typography mb = { { xs : 0 , md : 3.5 } } key = { week . name } component = "h2" variant = "h2" >
172
+ { week . name }
173
+ </ Typography >
174
+ < Box sx = { cardsContainerStyle } >
175
+ { week . sessions . map ( ( session : any ) => {
176
+ const position = `${ t ( 'session' ) } ${ session . position / 10 - 1 } ` ;
177
+
178
+ return (
179
+ < SessionCard
180
+ key = { session . id }
181
+ session = { session }
182
+ sessionSubtitle = { position }
183
+ storyblokCourseId = { storyId }
184
+ isLoggedIn = { isLoggedIn }
185
+ />
186
+ ) ;
187
+ } ) }
250
188
</ Box >
251
- ) ;
252
- } ) }
253
- </ Box >
254
- </ >
255
- ) }
189
+ </ Box >
190
+ ) ;
191
+ } ) }
192
+ </ Box >
193
+ </ >
256
194
</ Container >
257
195
{ ! isLoggedIn && < SignUpBanner /> }
258
196
</ Box >
0 commit comments