Skip to content

Commit f49b5b7

Browse files
committed
feat: refactor course card display into separate component
Create a new `TrackPageCourseCardList` component to encapsulate the logic for displaying course cards with progress. Move relevant functionality from `TrackPageIntroductionAndCourses` to the new component, improving code organization and reusability. Update template references to use the new component.
1 parent 05ead72 commit f49b5b7

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

app/components/track-page/introduction-and-courses.ts renamed to app/components/track-page/course-card-list.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface Signature {
1515
};
1616
}
1717

18-
export default class TrackPageIntroductionAndCoursesComponent extends Component<Signature> {
18+
export default class TrackPageCourseCardListComponent extends Component<Signature> {
1919
logoImage = logoImage;
2020
comingSoonImage = comingSoonImage;
2121

@@ -37,17 +37,10 @@ export default class TrackPageIntroductionAndCoursesComponent extends Component<
3737
};
3838
});
3939
}
40-
41-
get userHasStartedTrack() {
42-
return (
43-
this.authenticator.currentUser &&
44-
this.authenticator.currentUser.repositories.filterBy('language', this.args.language).filterBy('lastSubmissionAt')[0]
45-
);
46-
}
4740
}
4841

4942
declare module '@glint/environment-ember-loose/registry' {
5043
export default interface Registry {
51-
'TrackPage::IntroductionAndCourses': typeof TrackPageIntroductionAndCoursesComponent;
44+
'TrackPage::CourseCardList': typeof TrackPageCourseCardListComponent;
5245
}
5346
}

app/templates/join-track.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
<div class="flex items-start">
2626
<div class="flex-grow">
27-
<TrackPage::IntroductionAndCourses @language={{@model.language}} @courses={{this.sortedCourses}} class="w-full mb-4" />
27+
<TrackPage::CourseCardList @language={{@model.language}} @courses={{this.sortedCourses}} class="w-full mb-4" />
2828
</div>
2929

3030
<div class="hidden lg:block w-80 flex-shrink-0 sticky top-4 ml-2">

app/templates/track.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="container mx-auto lg:max-w-screen-lg px-3 md:px-6 py-6 md:py-10">
1111
<div class="flex items-start">
1212
<div class="flex-grow">
13-
<TrackPage::IntroductionAndCourses @language={{@model.language}} @courses={{this.sortedCourses}} class="w-full mb-4" />
13+
<TrackPage::CourseCardList @language={{@model.language}} @courses={{this.sortedCourses}} class="w-full mb-4" />
1414
</div>
1515

1616
<div class="hidden lg:block w-80 flex-shrink-0 sticky top-4 ml-2">

0 commit comments

Comments
 (0)