File tree Expand file tree Collapse file tree
projects/social_platform/src/app/office/courses/lesson Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 @for (task of tasks(); track task.id) {
1212 < div
1313 class ="progress__task "
14+ (click) ="onSelectTask(task) "
1415 [ngClass] ="{
1516 'progress__task--done': isDone(task),
16- 'progress__task--current': isCurrent(task.id)
17+ 'progress__task--current': isCurrent(task.id),
18+ 'progress__task--clickable': isDone(task)
1719 } "
1820 >
1921 < p class ="text-body-12 "> {{ task.order }}</ p >
8284
8385 < app-button
8486 [loader] ="loader() "
85- [disabled] ="isSubmitDisabled() "
86- [style.opacity] ="isSubmitDisabled() ? 0.5 : 1 "
87+ [disabled] ="isSubmitDisabled() || isViewingCompleted() "
88+ [style.opacity] ="isSubmitDisabled() || isViewingCompleted() ? 0.5 : 1 "
8789 size ="big "
8890 customTypographyClass ="text-body-12 "
8991 class ="action__button "
Original file line number Diff line number Diff line change 7373 border : 0 !important ;
7474 }
7575
76+ & --clickable {
77+ cursor : pointer ;
78+ }
79+
7680 & --current {
7781 border : 0.5px solid var (--accent );
7882 }
Original file line number Diff line number Diff line change @@ -157,6 +157,24 @@ export class LessonComponent implements OnInit {
157157 return task . isCompleted || this . completedTaskIds ( ) . has ( task . id ) ;
158158 }
159159
160+ protected readonly isViewingCompleted = computed ( ( ) => {
161+ const task = this . currentTask ( ) ;
162+ return task ? this . isDone ( task ) : false ;
163+ } ) ;
164+
165+ onSelectTask ( task : Task ) {
166+ if ( ! this . isDone ( task ) ) return ;
167+
168+ this . currentTaskId . set ( task . id ) ;
169+ this . answerBody . set ( null ) ;
170+ this . success . set ( false ) ;
171+ this . hasError . set ( false ) ;
172+
173+ if ( this . isComplete ( ) ) {
174+ this . router . navigate ( [ "./" ] , { relativeTo : this . route } ) ;
175+ }
176+ }
177+
160178 onSubmitAnswer ( ) {
161179 const task = this . currentTask ( ) ;
162180 if ( ! task ) return ;
You can’t perform that action at this time.
0 commit comments