mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: course start button bug
This commit is contained in:
parent
1c86a829b0
commit
2108763b6d
1 changed files with 2 additions and 4 deletions
|
|
@ -43,8 +43,7 @@ const CourseClient = (props: any) => {
|
||||||
|
|
||||||
function isCourseStarted() {
|
function isCourseStarted() {
|
||||||
const runs = course.trail.runs;
|
const runs = course.trail.runs;
|
||||||
// checks if one of the obejcts in the array has the property "STATUS_IN_PROGRESS"
|
return runs.some((run: any) => run.status === "STATUS_IN_PROGRESS" && run.course_id === course.id);
|
||||||
return runs.some((run: any) => run.status === "STATUS_IN_PROGRESS");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function quitCourse() {
|
async function quitCourse() {
|
||||||
|
|
@ -193,11 +192,10 @@ const CourseClient = (props: any) => {
|
||||||
</div>
|
</div>
|
||||||
<div className="-space-y-2 ">
|
<div className="-space-y-2 ">
|
||||||
<div className="text-[12px] text-neutral-400 font-semibold">Author</div>
|
<div className="text-[12px] text-neutral-400 font-semibold">Author</div>
|
||||||
<div className="text-xl font-bold text-neutral-800">{course.authors[0].first_name} {course.authors[0].last_name} { (course.authors[0].first_name && course.authors[0].last_name) ? course.authors[0].first_name + ' ' + course.authors[0].last_name : course.authors[0].username }</div>
|
<div className="text-xl font-bold text-neutral-800">{course.authors[0].first_name} {course.authors[0].last_name} {(course.authors[0].first_name && course.authors[0].last_name) ? course.authors[0].first_name + ' ' + course.authors[0].last_name : course.authors[0].username}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{console.log(course)}
|
|
||||||
|
|
||||||
{isCourseStarted() ? (
|
{isCourseStarted() ? (
|
||||||
<button className="py-2 px-5 mx-auto rounded-xl text-white font-bold h-12 w-[200px] drop-shadow-md bg-red-600 hover:bg-red-700 hover:cursor-pointer" onClick={quitCourse}>
|
<button className="py-2 px-5 mx-auto rounded-xl text-white font-bold h-12 w-[200px] drop-shadow-md bg-red-600 hover:bg-red-700 hover:cursor-pointer" onClick={quitCourse}>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue