Skip to content

Commit 84d3c03

Browse files
committed
Refactor course page header and sidebar components
1 parent 8110f13 commit 84d3c03

File tree

7 files changed

+22
-37
lines changed

7 files changed

+22
-37
lines changed

app/components/course-page/header/main-section.hbs

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
{{#if (eq @currentStep.type "CourseStageStep")}}
1616
{{! @glint-expect-error not typesafe }}
1717
<span class="font-bold text-gray-700">{{@currentStep.courseStage.name}}</span>
18+
<span class="font-mono text-base sm:text-lg md:text-xl">
19+
{{! @glint-expect-error not typesafe }}
20+
<span class="text-gray-300">#</span><span class="font-mono text-gray-400">{{@currentStep.courseStage.uppercasedSlug}}</span>
21+
</span>
1822
{{else}}
1923
<span class="font-bold text-gray-700">{{@currentStep.title}}</span>
2024
{{/if}}

app/components/course-page/header/navigation-controls.hbs

+9-18
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,15 @@
77

88
<CoursePage::StepSwitcherContainer @currentStep={{@currentStep}} @stepList={{@stepList}} />
99

10-
{{#if (eq @currentStep.type "CourseStageStep")}}
11-
<div class="flex items-center">
12-
<div class="inline-flex items-center text-xs font-semibold text-gray-500">
13-
{{#each this.currentStepAsCourseStageStep.breadcrumbs as |breadcrumb index|}}
14-
{{#if (eq index 0)}}
15-
{{breadcrumb}}
16-
{{else}}
17-
<span class="text-gray-300 px-2 inline-flex">&gt;</span>
18-
{{breadcrumb}}
19-
{{/if}}
20-
{{/each}}
21-
</div>
22-
23-
{{#if this.currentStepAsCourseStageStep.courseStage.primaryExtension}}
24-
<BetaCourseExtensionLabel class="ml-2" />
25-
{{/if}}
26-
</div>
27-
{{/if}}
10+
<div class="flex items-center">
11+
{{#if @course.releaseStatusIsBeta}}
12+
<BetaCourseLabel />
13+
{{else if @course.isFree}}
14+
<FreeCourseLabel @course={{@course}} />
15+
{{else if (and (eq @currentStep.type "CourseStageStep") this.currentStepAsCourseStageStep.courseStage.primaryExtension)}}
16+
<BetaCourseExtensionLabel />
17+
{{/if}}
18+
</div>
2819
</div>
2920

3021
<div class="flex items-center gap-x-3">

app/components/course-page/sidebar.hbs

-7
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@
99
</div>
1010

1111
<div class="px-3">
12-
{{! Find ways to move this out of sidebar? }}
13-
{{#if @course.releaseStatusIsBeta}}
14-
<BetaCourseLabel class="mr-3 mt-3 sm:mt-2" @tooltipSide="right" />
15-
{{else if @course.isFree}}
16-
<FreeCourseLabel @course={{@course}} class="mr-3 mt-3 sm:mt-2" @tooltipSide="right" />
17-
{{/if}}
18-
1912
{{! @glint-expect-error: not typesafe yet}}
2013
<CoursePage::RepositoryDropdown @repositories={{@repositories}} @activeRepository={{@activeRepository}} class="mt-4" />
2114
</div>

app/models/course-stage.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,7 @@ export default class CourseStageModel extends Model {
6767
}
6868

6969
get identifierForURL() {
70-
if (this.isBaseStage) {
71-
return `${this.positionWithinCourse}`; // Example: /stages/3
72-
} else {
73-
return `${this.primaryExtensionSlug}:${this.positionWithinExtension}`; // Example: /stages/ext2:1
74-
}
70+
return this.slug;
7571
}
7672

7773
get isBaseStage() {
@@ -150,6 +146,10 @@ Our interactive concepts can help with this:
150146
return this.position > 3;
151147
}
152148

149+
get uppercasedSlug() {
150+
return this.slug.toUpperCase();
151+
}
152+
153153
hasCommunitySolutionsForLanguage(language: LanguageModel) {
154154
return ((this.communitySolutionCounts || {})[language.slug] || 0) > 0;
155155
}

app/styles/prism-light-theme.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pre[class*='language-'] {
88
color: black;
99
background: none;
1010
text-shadow: 0 1px white;
11-
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
11+
font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
1212
font-size: 1em;
1313
text-align: left;
1414
white-space: pre;

app/utils/course-page-step-list/course-stage-step.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ export default class CourseStageStep extends Step {
1919

2020
get breadcrumbs(): string[] {
2121
if (this.courseStage.isExtensionStage) {
22-
return [
23-
this.courseStage.primaryExtension!.name,
24-
`Stage ${this.courseStage.positionWithinExtension}/${this.courseStage.primaryExtension!.stages.length}`,
25-
];
22+
return [this.courseStage.primaryExtension!.name, `Stage #${this.courseStage.uppercasedSlug}`];
2623
} else {
27-
return [`Stage ${this.courseStage.positionWithinCourse}/${this.courseStage.course.baseStages.length}`];
24+
return [`Stage #${this.courseStage.uppercasedSlug}`];
2825
}
2926
}
3027

tailwind.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module.exports = {
4343
},
4444
fontFamily: {
4545
sans: 'Montserrat, sans-serif',
46-
mono: 'Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace',
46+
mono: 'SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
4747
},
4848
extend: {
4949
brightness: {

0 commit comments

Comments
 (0)