Skip to content

Commit

Permalink
Merge pull request #2026 from codecrafters-io/standard-interface-sig
Browse files Browse the repository at this point in the history
add sig type standard
  • Loading branch information
rohitpaulk authored Jul 28, 2024
2 parents e0e6f9d + 88cbf55 commit a6388dd
Show file tree
Hide file tree
Showing 148 changed files with 284 additions and 284 deletions.
2 changes: 1 addition & 1 deletion .prompts/js-to-ts-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Component from "@glimmer/component";
import UserModel from "codecrafters-frontend/models/user";
import { action } from "@ember/object";

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type RouterService from '@ember/routing/router-service';
import type AuthenticatorService from 'codecrafters-frontend/services/authenticator';

interface Signature {
Element: HTMLElement;
Element: HTMLButtonElement;

Args: {
affiliateLink: AffiliateLinkModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import logoImage from '/assets/images/logo/logomark-color.svg';
import type AffiliateLinkModel from 'codecrafters-frontend/models/affiliate-link';

interface Signature {
Element: HTMLElement;
Element: HTMLDivElement;

Args: {
affiliateLink: AffiliateLinkModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Component from '@glimmer/component';

interface Signature {
Element: HTMLElement;
Element: HTMLDivElement;

Args: {
testimonial: {
Expand Down
4 changes: 2 additions & 2 deletions app/components/avatar-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import UserModel from 'codecrafters-frontend/models/user';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';

type Signature = {
interface Signature {
Element: HTMLImageElement;

Args: {
user: UserModel;
};
};
}

export default class AvatarImageComponent extends Component<Signature> {
@tracked avatarImageFailedToLoad = false;
Expand Down
4 changes: 2 additions & 2 deletions app/components/blocks/concept-question-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Prism from 'prismjs';
import 'prismjs/components/prism-rust'; // This is the only one we use in concepts at the moment
import { tracked } from '@glimmer/tracking';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
Expand All @@ -16,7 +16,7 @@ type Signature = {
onStepBackButtonClick: () => void;
isCurrentBlock: boolean;
};
};
}

export default class ConceptQuestionBlockComponent extends Component<Signature> {
@tracked isSubmitted = false;
Expand Down
5 changes: 2 additions & 3 deletions app/components/blocks/markdown-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import Component from '@glimmer/component';
import { MarkdownBlock } from 'codecrafters-frontend/utils/blocks';
import { action } from '@ember/object';
import Prism from 'prismjs';

import 'prismjs/components/prism-rust'; // This is the only one we use in concepts at the moment

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
model: MarkdownBlock;
};
};
}

export default class MarkdownBlockComponent extends Component<Signature> {
@action
Expand Down
4 changes: 0 additions & 4 deletions app/components/code-walkthrough-snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ interface Signature {
filePath: string;
highlightedLines: string;
};

Blocks: {
default: [];
};
}

export default class CodeWalkthroughSnippetComponent extends Component<Signature> {}
Expand Down
4 changes: 2 additions & 2 deletions app/components/comment-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type AuthenticatorService from 'codecrafters-frontend/services/authentica
import type AnalyticsEventTrackerService from 'codecrafters-frontend/services/analytics-event-tracker';
import type LanguageModel from 'codecrafters-frontend/models/language';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
Expand All @@ -25,7 +25,7 @@ type Signature = {
onSubmit?: () => void;
target: CourseStageModel | CommunityCourseStageSolutionModel;
};
};
}

export default class CommentFormComponent extends Component<Signature> {
@service declare authenticator: AuthenticatorService;
Expand Down
4 changes: 2 additions & 2 deletions app/components/concept-admin/blocks-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import type Transition from '@ember/routing/transition';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
concept: ConceptModel;
};
};
}

type BlockWithMetadata = {
id: string;
Expand Down
4 changes: 2 additions & 2 deletions app/components/concept-admin/blocks-page/editable-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { ClickToContinueBlock, ConceptQuestionBlock, MarkdownBlock } from 'codecrafters-frontend/utils/blocks';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
Expand All @@ -22,7 +22,7 @@ type Signature = {
Blocks: {
dragHandler: [];
};
};
}

export default class EditableBlockComponent extends Component<Signature> {
@tracked mutableBlock: Block | null = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ interface Signature {
Element: HTMLDivElement;

Args: {
description: string;
icon: string;
title: string;
description: string;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ interface Signature {
Element: HTMLDivElement;

Args: {
onBlockAdded: (block: Block) => void;
isVisibleWithoutHover: boolean;
onBlockAdded: (block: Block) => void;
};
}

Expand Down
10 changes: 5 additions & 5 deletions app/components/concept-admin/delete-concept-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import type RouterService from '@ember/routing/router-service';
import type Store from '@ember-data/store';
import type ConceptModel from 'codecrafters-frontend/models/concept';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
onClose?: () => void;
concept: ConceptModel;
onClose?: () => void;
};
};
}

export default class DeleteConceptModalComponent extends Component<Signature> {
@service router!: RouterService;
@service store!: Store;
@service declare router: RouterService;
@service declare store: Store;

@action
async deleteConcept() {
Expand Down
4 changes: 2 additions & 2 deletions app/components/concept-admin/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import RouterService from '@ember/routing/router-service';
import { inject as service } from '@ember/service';
import ConceptModel from 'codecrafters-frontend/models/concept';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
concept: ConceptModel;
};
};
}

type Tab = {
icon: string;
Expand Down
4 changes: 2 additions & 2 deletions app/components/concept-page/question-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import type ConceptQuestionModel from 'codecrafters-frontend/models/concept-ques
import type { Option } from 'codecrafters-frontend/models/concept-question';
import { next } from '@ember/runloop';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
question: ConceptQuestionModel;
onSubmit: () => void;
};
};
}

export default class QuestionCardComponent extends Component<Signature> {
@tracked selectedOptionIndex: number | null = null;
Expand Down
2 changes: 1 addition & 1 deletion app/components/concept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface Signature {
latestConceptEngagement: ConceptEngagementModel;
};

Element: HTMLElement;
Element: HTMLDivElement;
}

interface BlockGroup {
Expand Down
4 changes: 2 additions & 2 deletions app/components/concept/continue-or-step-back.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ interface Signature {
Element: HTMLDivElement;

Args: {
continueButtonText: string;
onContinueButtonClick: () => void;
onStepBackButtonClick: () => void;
shouldHighlightKeyboardShortcuts: boolean;
shouldShowStepBackButton: boolean;
shouldShowContinueButton: boolean;
continueButtonText: string;
shouldShowStepBackButton: boolean;
};
}

Expand Down
4 changes: 2 additions & 2 deletions app/components/contest-page/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { formatDistanceStrict } from 'date-fns';
import { formatInTimeZone } from 'date-fns-tz';
import { inject as service } from '@ember/service';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
allContests: ContestModel[];
contest: ContestModel;
};
};
}

export default class ContestPageHeaderComponent extends Component<Signature> {
@service declare date: DateService;
Expand Down
4 changes: 2 additions & 2 deletions app/components/contest-page/how-it-works-card.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Component from '@glimmer/component';
import ContestModel from 'codecrafters-frontend/models/contest';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
contest: ContestModel;
};
};
}

export default class ContestPageHowItWorksCardComponent extends Component<Signature> {}

Expand Down
4 changes: 2 additions & 2 deletions app/components/contest-page/leaderboard-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type LanguageModel from 'codecrafters-frontend/models/language';
import type LeaderboardEntryModel from 'codecrafters-frontend/models/leaderboard-entry';
import type UserModel from 'codecrafters-frontend/models/user';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
Expand All @@ -15,7 +15,7 @@ type Signature = {
topEntries: LeaderboardEntryModel[];
surroundingEntries: LeaderboardEntryModel[];
};
};
}

export default class ContestPageLeaderboardCardComponent extends Component<Signature> {
@service declare authenticator: AuthenticatorService;
Expand Down
4 changes: 2 additions & 2 deletions app/components/contest-page/leaderboard-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import type LanguageModel from 'codecrafters-frontend/models/language';
import type LeaderboardEntryModel from 'codecrafters-frontend/models/leaderboard-entry';
import { inject as service } from '@ember/service';

type Signature = {
interface Signature {
Element: HTMLAnchorElement;

Args: {
entry: LeaderboardEntryModel;
languages: LanguageModel[];
};
};
}

export default class ContestPageLeaderboardEntryComponent extends Component<Signature> {
@service declare authenticator: AuthenticatorService;
Expand Down
4 changes: 2 additions & 2 deletions app/components/contest-page/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import ContestModel from 'codecrafters-frontend/models/contest';
import DateService from 'codecrafters-frontend/services/date';
import { inject as service } from '@ember/service';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
allContests: ContestModel[];
contest: ContestModel;
};
};
}

export default class ContestPageNavigationComponent extends Component<Signature> {
@service declare date: DateService;
Expand Down
4 changes: 2 additions & 2 deletions app/components/contest-page/prize-details-card.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Component from '@glimmer/component';
import ContestModel from 'codecrafters-frontend/models/contest';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
allContests: ContestModel[];
contest: ContestModel;
};
};
}

export default class ContestPagePrizeDetailsCardComponent extends Component<Signature> {}

Expand Down
2 changes: 1 addition & 1 deletion app/components/copyable-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { later } from '@ember/runloop';
import { tracked } from '@glimmer/tracking';

interface Signature {
Element: HTMLElement;
Element: HTMLDivElement;

Args: {
backgroundColor?: 'gray' | 'white';
Expand Down
2 changes: 1 addition & 1 deletion app/components/copyable-terminal-command-with-variants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type CopyableTerminalCommandVariant = {
};

interface Signature {
Element: HTMLElement;
Element: HTMLDivElement;

Args: {
onCopyButtonClick?: () => void;
Expand Down
2 changes: 1 addition & 1 deletion app/components/copyable-terminal-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { tracked } from '@glimmer/tracking';
import fade from 'ember-animated/transitions/fade';

interface Signature {
Element: HTMLElement;
Element: HTMLDivElement;

Args: {
commands: string[];
Expand Down
4 changes: 2 additions & 2 deletions app/components/course-admin/buildpacks-page/buildpack-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { inject as service } from '@ember/service';
import RouterService from '@ember/routing/router-service';
import BuildpackModel from 'codecrafters-frontend/models/buildpack';

type Signature = {
interface Signature {
Element: HTMLDivElement;

Args: {
buildpack: BuildpackModel;
};
};
}

export default class BuildpackComponent extends Component<Signature> {
@service declare router: RouterService;
Expand Down
Loading

0 comments on commit a6388dd

Please sign in to comment.