Skip to content

Commit

Permalink
Removing live course access concept (#1191)
Browse files Browse the repository at this point in the history
* Update CourseCard.tsx

Removed concept of liveCourseAccess from Course Card

* Update index.tsx

Remove concept of liveCourseAccess from Course Card

---------

Co-authored-by: Kylee Fields <[email protected]>
  • Loading branch information
eliezerjoel and kyleecodes authored Nov 13, 2024
1 parent d36b607 commit 33629d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
31 changes: 3 additions & 28 deletions components/cards/CourseCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Circle from '@mui/icons-material/Circle';
import Event from '@mui/icons-material/Event';
import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown';
import PendingOutlined from '@mui/icons-material/PendingOutlined';
import {
Expand All @@ -19,7 +17,6 @@ import { useRouter } from 'next/router';
import { useState } from 'react';
import { PROGRESS_STATUS } from '../../constants/enums';
import { iconTextRowStyle, rowStyle } from '../../styles/common';
import { courseIsLiveNow, courseIsLiveSoon } from '../../utils/courseLiveStatus';
import { formatDateToString } from '../../utils/dateTime';
import Link from '../common/Link';
import ProgressStatus from '../common/ProgressStatus';
Expand Down Expand Up @@ -71,20 +68,17 @@ const statusRowStyle = {
interface CourseCardProps {
course: ISbStoryData;
courseProgress: PROGRESS_STATUS | null;
liveCourseAccess: boolean;
clickable?: boolean;
}

const CourseCard = (props: CourseCardProps) => {
const { course, courseProgress, liveCourseAccess, clickable = true } = props;
const { course, courseProgress, clickable = true } = props;
const [expanded, setExpanded] = useState<boolean>(false);
const t = useTranslations('Courses');
const router = useRouter();
const locale = router.locale || 'en';

const courseComingSoon: boolean = course.content.coming_soon;
const courseLiveSoon: boolean = courseIsLiveSoon(course.content);
const courseLiveNow: boolean = courseIsLiveNow(course.content);

const handleExpandClick = () => {
setExpanded(!expanded);
Expand Down Expand Up @@ -145,32 +139,13 @@ const CourseCard = (props: CourseCardProps) => {
</CardContent>
)}
<CardActions sx={cardActionsStyle}>
{courseComingSoon && (!courseLiveSoon || !liveCourseAccess) && (
{courseComingSoon && !courseLiveSoon && (

Check failure on line 142 in components/cards/CourseCard.tsx

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot find name 'courseLiveSoon'.
<Box sx={statusRowStyle}>
<PendingOutlined color="error" />
<Typography>{t('comingSoon')}</Typography>
</Box>
)}
{courseLiveSoon && liveCourseAccess && (
<Box sx={statusRowStyle}>
<Event color="error" />
<Typography>
{t.rich('liveFrom', {
date: formatDateToString(course.content.live_start_date, locale),
})}
</Typography>
</Box>
)}
{courseLiveNow && liveCourseAccess && (
<Box sx={statusRowStyle}>
<Circle color="error" />
<Typography>
{t.rich('liveUntil', {
date: formatDateToString(course.content.live_end_date, locale),
})}
</Typography>
</Box>
)}


<IconButton
sx={{ marginLeft: 'auto' }}
Expand Down
3 changes: 0 additions & 3 deletions pages/courses/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const CourseList: NextPage<Props> = ({ stories }) => {
const courses = useTypedSelector((state) => state.courses);

const eventUserData = getEventUserData(userCreatedAt, partnerAccesses, partnerAdmin);
const liveCourseAccess = !!userId; // soon to be retired in issue 1176
const t = useTranslations('Courses');

const headerProps = {
Expand Down Expand Up @@ -163,7 +162,6 @@ const CourseList: NextPage<Props> = ({ stories }) => {
key={course.id}
course={course}
courseProgress={courseProgress}
liveCourseAccess={liveCourseAccess}
/>
);
})}
Expand All @@ -177,7 +175,6 @@ const CourseList: NextPage<Props> = ({ stories }) => {
key={course.id}
course={course}
courseProgress={courseProgress}
liveCourseAccess={liveCourseAccess}
/>
);
})}
Expand Down

0 comments on commit 33629d3

Please sign in to comment.