Skip to content

Commit a975e2f

Browse files
feat: remove live courses support (#1271)
Co-authored-by: Kylee Fields <[email protected]>
1 parent 21a5f1d commit a975e2f

File tree

12 files changed

+74
-281
lines changed

12 files changed

+74
-281
lines changed

components/cards/CourseCard.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown';
2-
import PendingOutlined from '@mui/icons-material/PendingOutlined';
32
import {
43
Box,
54
Card,
@@ -78,8 +77,6 @@ const CourseCard = (props: CourseCardProps) => {
7877
const [expanded, setExpanded] = useState<boolean>(false);
7978
const t = useTranslations('Courses');
8079

81-
const courseComingSoon: boolean = course.content.coming_soon;
82-
8380
const handleExpandClick = () => {
8481
setExpanded(!expanded);
8582
};
@@ -136,13 +133,6 @@ const CourseCard = (props: CourseCardProps) => {
136133
</CardContent>
137134
)}
138135
<CardActions sx={cardActionsStyle}>
139-
{courseComingSoon && (
140-
<Box sx={statusRowStyle}>
141-
<PendingOutlined color="error" />
142-
<Typography>{t('comingSoon')}</Typography>
143-
</Box>
144-
)}
145-
146136
{!!courseProgress && courseProgress !== PROGRESS_STATUS.NOT_STARTED && (
147137
<ProgressStatus status={courseProgress} />
148138
)}

components/course/CourseIntroduction.tsx

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@ import { Box, Link as MuiLink, Typography } from '@mui/material';
22
import { ISbRichtext } from '@storyblok/react';
33
import { useTranslations } from 'next-intl';
44
import { useEffect, useState } from 'react';
5-
import { render } from 'storyblok-rich-text-react-renderer';
65
import {
76
COURSE_INTRO_VIDEO_TRANSCRIPT_CLOSED,
87
COURSE_INTRO_VIDEO_TRANSCRIPT_OPENED,
98
} from '../../constants/events';
109
import { rowStyle } from '../../styles/common';
1110
import { EventUserData, logEvent } from '../../utils/logEvent';
12-
import { RichTextOptions } from '../../utils/richText';
1311
import Video from '../video/Video';
1412
import VideoTranscriptModal from '../video/VideoTranscriptModal';
15-
import CourseStatusHeader from './CourseStatusHeader';
1613

1714
const containerStyle = {
1815
...rowStyle,
@@ -28,26 +25,11 @@ interface CourseIntroductionProps {
2825
video: { url: string };
2926
name: string;
3027
video_transcript: ISbRichtext;
31-
live_soon_content: ISbRichtext;
32-
live_now_content: ISbRichtext;
33-
courseLiveSoon?: boolean;
34-
courseLiveNow?: boolean;
35-
liveCourseAccess?: boolean;
3628
eventData: EventUserData;
3729
}
3830

3931
const CourseIntroduction = (props: CourseIntroductionProps) => {
40-
const {
41-
video,
42-
name,
43-
video_transcript,
44-
live_soon_content,
45-
live_now_content,
46-
courseLiveSoon = false,
47-
courseLiveNow = false,
48-
liveCourseAccess = false,
49-
eventData,
50-
} = props;
32+
const { video, name, video_transcript, eventData } = props;
5133
const [openTranscriptModal, setOpenTranscriptModal] = useState<boolean | null>(null);
5234

5335
const t = useTranslations('Courses');
@@ -102,22 +84,8 @@ const CourseIntroduction = (props: CourseIntroductionProps) => {
10284
setOpenTranscriptModal={setOpenTranscriptModal}
10385
openTranscriptModal={openTranscriptModal}
10486
/>
105-
{/* Video position switches column depending on if live content shown */}
106-
{liveCourseAccess && (courseLiveSoon || courseLiveNow) && <IntroductionVideo />}
10787
</Box>
108-
{liveCourseAccess && courseLiveSoon ? (
109-
<Box flex={1}>
110-
<CourseStatusHeader status="liveSoon" />
111-
{render(live_soon_content, RichTextOptions)}
112-
</Box>
113-
) : liveCourseAccess && courseLiveNow ? (
114-
<Box flex={1}>
115-
<CourseStatusHeader status="liveNow" />
116-
{render(live_now_content, RichTextOptions)}
117-
</Box>
118-
) : (
119-
<IntroductionVideo />
120-
)}
88+
<IntroductionVideo />
12189
</Box>
12290
);
12391
};

components/course/CourseStatusHeader.tsx

Lines changed: 0 additions & 36 deletions
This file was deleted.

components/storyblok/StoryblokCoursePage.tsx

Lines changed: 35 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,18 @@ import Cookies from 'js-cookie';
44
import { useTranslations } from 'next-intl';
55
import Head from 'next/head';
66
import { useEffect, useState } from 'react';
7-
import { render } from 'storyblok-rich-text-react-renderer';
87
import SessionCard from '../../components/cards/SessionCard';
98
import { ContentUnavailable } from '../../components/common/ContentUnavailable';
109
import Link from '../../components/common/Link';
1110
import CourseHeader from '../../components/course/CourseHeader';
1211
import CourseIntroduction from '../../components/course/CourseIntroduction';
13-
import CourseStatusHeader from '../../components/course/CourseStatusHeader';
1412
import { PROGRESS_STATUS } from '../../constants/enums';
1513
import { COURSE_OVERVIEW_VIEWED } from '../../constants/events';
1614
import { useTypedSelector } from '../../hooks/store';
1715
import { rowStyle } from '../../styles/common';
18-
import { courseIsLiveNow, courseIsLiveSoon } from '../../utils/courseLiveStatus';
1916
import { determineCourseProgress } from '../../utils/courseProgress';
2017
import hasAccessToPage from '../../utils/hasAccessToPage';
2118
import { getEventUserData, logEvent } from '../../utils/logEvent';
22-
import { RichTextOptions } from '../../utils/richText';
2319
import { SignUpBanner } from '../banner/SignUpBanner';
2420

2521
const containerStyle = {
@@ -49,12 +45,6 @@ export interface StoryblokCoursePageProps {
4945
video_transcript: ISbRichtext;
5046
weeks: { name: string; sessions: any }[]; // TODO: replace type with StoryblokSessionPageProps
5147
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;
5848
languages: string[]; // TODO: implement this field - currently uses FF_DISABLED_COURSES env var
5949
component: 'Course';
6050
}
@@ -73,12 +63,6 @@ const StoryblokCoursePage = (props: StoryblokCoursePageProps) => {
7363
video_transcript,
7464
weeks,
7565
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,
8266
} = props;
8367

8468
const t = useTranslations('Courses');
@@ -119,29 +103,10 @@ const StoryblokCoursePage = (props: StoryblokCoursePageProps) => {
119103

120104
const eventUserData = getEventUserData(userCreatedAt, partnerAccesses, partnerAdmin);
121105

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-
138106
const eventData = {
139107
...eventUserData,
140108
course_name: name,
141109
course_storyblok_id: storyId,
142-
course_coming_soon: courseComingSoon,
143-
course_live_soon: courseLiveSoon,
144-
course_live_now: courseLiveNow,
145110
course_progress: courseProgress,
146111
};
147112

@@ -170,12 +135,6 @@ const StoryblokCoursePage = (props: StoryblokCoursePageProps) => {
170135
video_transcript,
171136
weeks,
172137
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,
179138
})}
180139
>
181140
<Head>
@@ -196,63 +155,42 @@ const StoryblokCoursePage = (props: StoryblokCoursePageProps) => {
196155
courseProgress={courseProgress}
197156
/>
198157
<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+
})}
250188
</Box>
251-
);
252-
})}
253-
</Box>
254-
</>
255-
)}
189+
</Box>
190+
);
191+
})}
192+
</Box>
193+
</>
256194
</Container>
257195
{!isLoggedIn && <SignUpBanner />}
258196
</Box>

0 commit comments

Comments
 (0)