Skip to content

Commit d69e73b

Browse files
committed
pass courseId as query param when navigating from course to program page
1 parent 1fe0c04 commit d69e73b

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

projects/social_platform/src/app/office/courses/detail/course-detail.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ export class CourseDetailComponent implements OnInit {
7777
}
7878

7979
redirectToProgram(): void {
80-
this.router.navigateByUrl(`/office/program/${this.course()?.partnerProgramId}`);
80+
this.router.navigate([`/office/program/${this.course()?.partnerProgramId}`], {
81+
queryParams: { courseId: this.course()?.id },
82+
});
8183
}
8284
}

projects/social_platform/src/app/office/courses/shared/course/course.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<div class="course">
55
<div class="course__cover">
66
<app-avatar [size]="68" [url]="course.avatarUrl"></app-avatar>
7-
<img src="assets\icons\svg\rocket.svg" class="course__rocket" />
87
<app-button
98
customTypographyClass="text-body-10"
109
[color]="isMember() ? 'primary' : isSubs() ? 'red' : 'green'"

projects/social_platform/src/app/office/features/detail/detail.component.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,11 @@
181181
участники
182182
</app-button>
183183
</a>
184-
} @else { @if (info().courseId) {
185-
<a class="info__contacts" [routerLink]="'/office/courses/' + info().courseId">
184+
} @else { @if (info().courseId || queryCourseId()) {
185+
<a
186+
class="info__contacts"
187+
[routerLink]="'/office/courses/' + (info().courseId || queryCourseId())"
188+
>
186189
<app-button appearance="outline" size="medium" customTypographyClass="text-body-12">
187190
перейти в курс
188191
</app-button>

projects/social_platform/src/app/office/features/detail/detail.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export class DeatilComponent implements OnInit, OnDestroy {
8080
profile?: User;
8181
profileProjects = signal<User["projects"]>([]);
8282
listType: "project" | "program" | "profile" = "project";
83+
queryCourseId = signal<number | null>(null);
8384

8485
// Переменная для подсказок
8586
isTooltipVisible = false;
@@ -158,6 +159,12 @@ export class DeatilComponent implements OnInit, OnDestroy {
158159
this.listType = data["listType"];
159160
});
160161

162+
const queryParamsSub$ = this.route.queryParams.subscribe(params => {
163+
const courseId = params["courseId"];
164+
this.queryCourseId.set(courseId ? +courseId : null);
165+
});
166+
this.subscriptions.push(queryParamsSub$);
167+
161168
this.initializeBackPath();
162169

163170
this.updatePageStates();

0 commit comments

Comments
 (0)