Skip to content

Commit

Permalink
Merge pull request #2422 from codecrafters-io/test-concept-preloading
Browse files Browse the repository at this point in the history
Preload concept images
  • Loading branch information
rohitpaulk authored Nov 23, 2024
2 parents bcc409a + f974b46 commit a1e6447
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
3 changes: 0 additions & 3 deletions app/components/concept-page/content.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<div class="block md:hidden px-3 border-b flex-shrink-0 sticky top-0 backdrop-blur-sm bg-white/80 z-20 w-full">
{{#if (gt this.currentProgressPercentage 0)}}
<div class="py-5">
{{! @glint-expect-error not ts-ified yet}}
<ConceptProgress @latestConceptEngagement={{@latestConceptEngagement}} />
</div>
{{else}}
Expand All @@ -21,7 +20,6 @@
<div class="container mx-auto lg:max-w-screen-lg px-3 md:px-6">
<div class="flex flex-col-reverse items-stretch md:flex-row">
<div class="md:pr-8 pt-10 pb-[75vh] min-w-0 flex-grow">
{{! @glint-expect-error not ts-ified yet}}
<Concept @concept={{@concept}} @latestConceptEngagement={{@latestConceptEngagement}} />

{{#animated-if this.hasCompletedConcept}}
Expand Down Expand Up @@ -67,7 +65,6 @@
<div class="hidden md:block border-l pl-8 flex-shrink-0 py-2 w-64">
{{#if (gt this.currentProgressPercentage 0)}}
<div class="sticky py-9 top-0 bg-white">
{{! @glint-expect-error not ts-ified yet}}
<ConceptProgress @latestConceptEngagement={{@latestConceptEngagement}} data-test-concept-progress />
</div>
{{else}}
Expand Down
6 changes: 6 additions & 0 deletions app/components/concept-progress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ export default class ConceptProgressComponent extends Component<Signature> {
return fade;
}
}

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
ConceptProgress: typeof ConceptProgressComponent;
}
}
13 changes: 13 additions & 0 deletions app/components/concept.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,17 @@
{{/each}}
</div>
{{/each}}
</div>

{{! Preload all blocks that might contain images }}
<div class="hidden">
{{#each this.allBlocks as |block|}}
{{#if (eq block.type "markdown")}}
{{! @glint-expect-error: block isn't typed as MarkdownBlock }}
<Blocks::MarkdownBlock @model={{block}} />
{{else if (eq block.type "concept_animation")}}
{{! @glint-expect-error: block isn't typed as ConceptAnimationBlock }}
<Blocks::ConceptAnimationBlock @model={{block}} />
{{/if}}
{{/each}}
</div>
6 changes: 6 additions & 0 deletions app/components/concept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,9 @@ export default class ConceptComponent extends Component<Signature> {
});
}
}

declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
Concept: typeof ConceptComponent;
}
}

0 comments on commit a1e6447

Please sign in to comment.