From 3ce66e1201ab386c9d1fc695b8e881c02c0f7b8c Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Sun, 20 Oct 2019 21:01:53 -0400 Subject: [PATCH] [+] Implement next course --- src/components/navigation/navigation.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/navigation/navigation.ts b/src/components/navigation/navigation.ts index 13f2060..ead8e15 100644 --- a/src/components/navigation/navigation.ts +++ b/src/components/navigation/navigation.ts @@ -14,7 +14,8 @@ export default class Navigation extends Vue // @ts-ignore @Prop() activeIndex: string; - @Prop() courses: any; + // @ts-ignore + @Prop() courses: Course[]; /** * This is called when the instance is created. @@ -82,7 +83,14 @@ export default class Navigation extends Vue */ public nextCourse() { - // TODO: implement this. + // Find current course + let courseId = this.activeIndex.split('/')[1]; + + // Find current course index + let courseIndex = this.courses.findIndex(c => c.id == +courseId); + + // Set tab to the next index + this.updateIndex(CourseUtils.formatTabIndex(this.courses[courseIndex + 1])) } /**