-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1809 from codecrafters-io/code-example-confirmati…
…on-modal CC-1265 Add code example confirmation modal
- Loading branch information
Showing
6 changed files
with
462 additions
and
20 deletions.
There are no files selected for viewing
69 changes: 57 additions & 12 deletions
69
app/components/course-page/course-stage-step/community-solutions-list.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 26 additions & 4 deletions
30
app/components/course-page/course-stage-step/community-solutions-list.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,53 @@ | ||
import rippleSpinnerImage from '/assets/images/icons/ripple-spinner.svg'; | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import CourseStageStep from 'codecrafters-frontend/utils/course-page-step-list/course-stage-step'; | ||
import rippleSpinnerImage from '/assets/images/icons/ripple-spinner.svg'; | ||
import { action } from '@ember/object'; | ||
import { service } from '@ember/service'; | ||
import type CommunityCourseStageSolutionModel from 'codecrafters-frontend/models/community-course-stage-solution'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import type AuthenticatorService from 'codecrafters-frontend/services/authenticator'; | ||
import type CommunityCourseStageSolutionModel from 'codecrafters-frontend/models/community-course-stage-solution'; | ||
import type CoursePageStateService from 'codecrafters-frontend/services/course-page-state'; | ||
import type RepositoryModel from 'codecrafters-frontend/models/repository'; | ||
|
||
type Signature = { | ||
Element: HTMLDivElement; | ||
|
||
Args: { | ||
solutions: CommunityCourseStageSolutionModel[]; | ||
repository: string; | ||
stageIncompleteModalWasDismissed: boolean; | ||
repository: RepositoryModel; | ||
}; | ||
}; | ||
|
||
export default class CommunitySolutionsListComponent extends Component<Signature> { | ||
rippleSpinnerImage = rippleSpinnerImage; | ||
|
||
@service declare authenticator: AuthenticatorService; | ||
@service declare coursePageState: CoursePageStateService; | ||
|
||
@tracked configureGithubIntegrationModalIsOpen = false; | ||
|
||
get shouldShowStageIncompleteModal() { | ||
return ( | ||
!this.args.stageIncompleteModalWasDismissed && | ||
this.coursePageState.currentStep.type === 'CourseStageStep' && | ||
!(this.coursePageState.currentStep as CourseStageStep).courseStage.isFirst && | ||
!(this.coursePageState.currentStep as CourseStageStep).courseStage.isSecond && | ||
this.args.solutions.length > 0 && | ||
this.coursePageState.currentStep.status !== 'complete' | ||
); | ||
} | ||
|
||
@action | ||
handleSolutionExpand(solution: CommunityCourseStageSolutionModel, solutionIndex: number) { | ||
if (this.authenticator.isAuthenticated) { | ||
solution.createView({ position_in_list: solutionIndex + 1 }); | ||
} | ||
} | ||
} | ||
|
||
declare module '@glint/environment-ember-loose/registry' { | ||
export default interface Registry { | ||
'CoursePage::CourseStageStep::CommunitySolutionsList': typeof CommunitySolutionsListComponent; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.