Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
<div class="bg-white dark:bg-gray-850 rounded-md shadow-xs border border-gray-200 dark:border-white/5 relative" ...attributes>
<div class="p-4 md:p-6">
<div class="leading-7 prose dark:prose-invert mb-4">
<div class="prose dark:prose-invert">
{{markdown-to-html @course.descriptionMarkdown}}
</div>

{{#if (gt @course.frequentlyAskedQuestions.length 0)}}
{{! Extra if convinces typescript that frequentlyAskedQuestions is not null }}
{{#if @course.frequentlyAskedQuestions}}
<CollapsibleFaqList @faqs={{@course.frequentlyAskedQuestions}} class="mb-6" />
<CollapsibleFaqList @faqs={{@course.frequentlyAskedQuestions}} class="mt-4" />
{{/if}}
{{/if}}

<h3 class="font-semibold text-gray-600 dark:text-gray-400 text-center text-sm relative mb-3">
<span class="block h-px w-full bg-gray-200 dark:bg-white/5 absolute top-50-percent -mt-px"></span>
<span class="relative px-6 bg-white dark:bg-gray-850">Stages</span>
</h3>

<CourseOverviewPage::StageList @course={{@course}} @completedStages={{@completedStages}} />
</div>
</div>
18 changes: 18 additions & 0 deletions app/components/course-overview-page/introduction-and-faq.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Component from '@glimmer/component';
import type CourseModel from 'codecrafters-frontend/models/course';

interface Signature {
Element: HTMLDivElement;

Args: {
course: CourseModel;
};
}

export default class CourseOverviewPageIntroductionAndFaq extends Component<Signature> {}

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
'CourseOverviewPage::IntroductionAndFaq': typeof CourseOverviewPageIntroductionAndFaq;
}
}
48 changes: 0 additions & 48 deletions app/components/course-overview-page/introduction-and-stages.ts

This file was deleted.

16 changes: 16 additions & 0 deletions app/components/course-overview-page/stage-list-card-list.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="space-y-4 w-full" ...attributes>
<CourseOverviewPage::StageListCard
@title={{if (gt @course.extensions.length 0) "Base Stages" "Stages"}}
@descriptionMarkdown={{@course.descriptionMarkdown}}
@stages={{@course.sortedBaseStages}}
/>

{{#each @course.sortedExtensions as |extension|}}
<CourseOverviewPage::StageListCard
@title={{extension.name}}
@descriptionMarkdown={{extension.descriptionMarkdown}}
@stages={{extension.sortedStages}}
@isCollapsedByDefault={{true}}
/>
{{/each}}
</div>
18 changes: 18 additions & 0 deletions app/components/course-overview-page/stage-list-card-list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Component from '@glimmer/component';
import type CourseModel from 'codecrafters-frontend/models/course';

interface Signature {
Element: HTMLDivElement;

Args: {
course: CourseModel;
};
}

export default class CourseOverviewPageStageListCardList extends Component<Signature> {}

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
'CourseOverviewPage::StageListCardList': typeof CourseOverviewPageStageListCardList;
}
}
29 changes: 29 additions & 0 deletions app/components/course-overview-page/stage-list-card.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<div
class="grid grid-cols-1 md:grid-cols-[2fr_3fr] p-4 md:p-6 gap-4 md:gap-6 bg-white dark:bg-gray-850 rounded-md shadow-xs border border-gray-200 dark:border-white/5 group relative
{{unless this.isExpanded 'h-48 overflow-hidden'}}"
...attributes
>
<div>
<h3 class="font-semibold text-gray-900 dark:text-gray-100 text-lg mb-3">
{{@title}}
</h3>

<div class="prose dark:prose-invert prose-sm mb-4">
{{markdown-to-html @descriptionMarkdown}}
</div>
</div>

<div class="min-w-0">
<CourseOverviewPage::StageListCard::List @stages={{@stages}} />
</div>

{{#unless this.isExpanded}}
<div
class="absolute z-20 bottom-0 left-0 right-0 h-32 vertical-mask dark:vertical-mask-gray-850 p-4 flex items-end justify-center pointer-events-none group-hover:pointer-events-auto"
>
<TertiaryButton class="opacity-0 group-hover:opacity-100 transition-opacity duration-200" {{on "click" this.handleExpandClick}}>
Click to expand
</TertiaryButton>
</div>
{{/unless}}
</div>
30 changes: 30 additions & 0 deletions app/components/course-overview-page/stage-list-card.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Component from '@glimmer/component';
import type CourseStageModel from 'codecrafters-frontend/models/course-stage';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';

interface Signature {
Element: HTMLDivElement;

Args: {
title: string;
descriptionMarkdown: string;
stages: CourseStageModel[];
isCollapsedByDefault?: boolean;
};
}

export default class CourseOverviewPageStageListCard extends Component<Signature> {
@tracked isExpanded = !this.args.isCollapsedByDefault;

@action
handleExpandClick() {
this.isExpanded = true;
}
}

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
'CourseOverviewPage::StageListCard': typeof CourseOverviewPageStageListCard;
}
}
17 changes: 17 additions & 0 deletions app/components/course-overview-page/stage-list-card/list-item.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div class="relative flex items-center" data-test-stage-list-item ...attributes>
{{! Bullet point }}
<div class="relative z-10 mr-1 flex-shrink-0">
<div class="w-3.5 h-3.5 rounded-full border-3 bg-gray-200 dark:bg-gray-800 border-white dark:border-gray-600"></div>
</div>

{{! Stage name and difficulty }}
<div class="flex-1 flex items-center justify-between min-w-0 gap-4">
<div class="text-gray-600 dark:text-gray-300 text-sm truncate">
{{@stage.name}}
</div>

<div class="flex-shrink-0">
<CourseStageDifficultyLabel @stage={{@stage}} />
</div>
</div>
</div>
18 changes: 18 additions & 0 deletions app/components/course-overview-page/stage-list-card/list-item.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Component from '@glimmer/component';
import type CourseStageModel from 'codecrafters-frontend/models/course-stage';

interface Signature {
Element: HTMLDivElement;

Args: {
stage: CourseStageModel;
};
}

export default class StageListCardListItem extends Component<Signature> {}

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
'CourseOverviewPage::StageListCard::ListItem': typeof StageListCardListItem;
}
}
13 changes: 13 additions & 0 deletions app/components/course-overview-page/stage-list-card/list.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class="relative">
{{! Connecting line }}
{{#if (gt @stages.length 1)}}
{{! template-lint-disable no-inline-styles }}
<div class="absolute left-[calc(0.4375rem-0.5px)] top-3 bottom-3 w-px bg-gray-200 dark:bg-white/5" style="height: calc(100% - 1rem);"></div>
{{/if}}

<div class="relative">
{{#each @stages as |stage index|}}
<CourseOverviewPage::StageListCard::ListItem @stage={{stage}} class="{{if (eq index (sub @stages.length 1)) 'pt-1' 'py-1'}}" />
{{/each}}
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import Component from '@glimmer/component';
import CourseModel from 'codecrafters-frontend/models/course';
import type CourseStageModel from 'codecrafters-frontend/models/course-stage';

interface Signature {
Element: HTMLDivElement;

Args: {
course: CourseModel;
stages: CourseStageModel[];
completedStages?: CourseStageModel[];
currentStage?: CourseStageModel;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing Stage Completion Status Display

The StageListCard::List component signature declares completedStages and currentStage as optional parameters, but these parameters are never referenced in the template (stage-list-card/list.hbs) or passed to child components. This means stage completion status is not being displayed, even though the data is available. The old IntroductionAndStages component passed this information through to display which stages were completed, but the refactored version lost this functionality. Either these parameters should be removed from the signature if intentionally unused, or they should be implemented to restore the completion status display functionality.

Fix in Cursor Fix in Web

};
}

export default class StageList extends Component<Signature> {}
export default class StageListCardList extends Component<Signature> {}

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
'CourseOverviewPage::StageList': typeof StageList;
'CourseOverviewPage::StageListCard::List': typeof StageListCardList;
}
}
1 change: 0 additions & 1 deletion app/components/course-overview-page/stage-list.hbs

This file was deleted.

3 changes: 2 additions & 1 deletion app/templates/course-overview.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<div class="flex items-start flex-row mb-4">
<div class="grow">
<CourseOverviewPage::Notices @course={{this.model.course}} class="mb-4" />
<CourseOverviewPage::IntroductionAndStages @course={{this.model.course}} @completedStages={{this.completedStages}} class="w-full" />
<CourseOverviewPage::IntroductionAndFaq @course={{this.model.course}} class="w-full mb-4" />
<CourseOverviewPage::StageListCardList @course={{this.model.course}} />
</div>

<div class="hidden lg:block sticky top-2 w-80 shrink-0 pt-2 ml-2">
Expand Down
3 changes: 2 additions & 1 deletion app/templates/join-course.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
<div class="flex items-start flex-row mb-4">
<div class="grow">
<CourseOverviewPage::Notices @course={{this.model.course}} class="mb-4" />
<CourseOverviewPage::IntroductionAndStages @course={{this.model.course}} class="w-full" />
<CourseOverviewPage::IntroductionAndFaq @course={{this.model.course}} class="w-full mb-4" />
<CourseOverviewPage::StageListCardList @course={{this.model.course}} />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Stage Progress Display Broken

The completedStages data is no longer being passed to the new StageListCardList component. Similar to the course-overview template, this breaks the stage completion display feature that was present in the old component structure.

Fix in Cursor Fix in Web

</div>

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