chore: remove Types
suffixes from client/src/redux/prop-types.ts
(#44010)
* chore: remove Type suffixes from client/src/redux/prop-types.ts. * chore: add PropType suffixes to PropTypes in client/src/redux/prop-types.ts.
This commit is contained in:
committed by
GitHub
parent
4c88fcdc69
commit
5ffd65e4e7
@@ -1,7 +1,7 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { HandlerProps } from 'react-reflex';
|
||||
|
||||
export const FileType = PropTypes.shape({
|
||||
export const FilePropType = PropTypes.shape({
|
||||
key: PropTypes.string,
|
||||
ext: PropTypes.string,
|
||||
name: PropTypes.string,
|
||||
@@ -10,7 +10,7 @@ export const FileType = PropTypes.shape({
|
||||
tail: PropTypes.string
|
||||
});
|
||||
|
||||
export const MarkdownRemark = PropTypes.shape({
|
||||
export const MarkdownRemarkPropType = PropTypes.shape({
|
||||
html: PropTypes.string,
|
||||
frontmatter: PropTypes.shape({
|
||||
title: PropTypes.string,
|
||||
@@ -19,60 +19,15 @@ export const MarkdownRemark = PropTypes.shape({
|
||||
})
|
||||
});
|
||||
|
||||
export const ChallengeNode = PropTypes.shape({
|
||||
block: PropTypes.string,
|
||||
challengeOrder: PropTypes.number,
|
||||
challengeType: PropTypes.number,
|
||||
dashedName: PropTypes.string,
|
||||
description: PropTypes.string,
|
||||
challengeFiles: PropTypes.array,
|
||||
fields: PropTypes.shape({
|
||||
slug: PropTypes.string,
|
||||
blockName: PropTypes.string
|
||||
}),
|
||||
forumTopicId: PropTypes.number,
|
||||
guideUrl: PropTypes.string,
|
||||
head: PropTypes.arrayOf(PropTypes.string),
|
||||
helpCategory: PropTypes.string,
|
||||
instructions: PropTypes.string,
|
||||
isComingSoon: PropTypes.bool,
|
||||
removeComments: PropTypes.bool,
|
||||
isLocked: PropTypes.bool,
|
||||
isPrivate: PropTypes.bool,
|
||||
order: PropTypes.number,
|
||||
required: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
link: PropTypes.string,
|
||||
raw: PropTypes.string,
|
||||
src: PropTypes.string
|
||||
})
|
||||
),
|
||||
superOrder: PropTypes.number,
|
||||
superBlock: PropTypes.string,
|
||||
tail: PropTypes.arrayOf(PropTypes.string),
|
||||
time: PropTypes.string,
|
||||
title: PropTypes.string,
|
||||
translationPending: PropTypes.bool,
|
||||
videoUrl: PropTypes.string
|
||||
});
|
||||
|
||||
export const AllChallengeNode = PropTypes.shape({
|
||||
export const AllMarkdownRemarkPropType = PropTypes.shape({
|
||||
edges: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
node: ChallengeNode
|
||||
node: MarkdownRemarkPropType
|
||||
})
|
||||
)
|
||||
});
|
||||
|
||||
export const AllMarkdownRemark = PropTypes.shape({
|
||||
edges: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
node: MarkdownRemark
|
||||
})
|
||||
)
|
||||
});
|
||||
|
||||
export const User = PropTypes.shape({
|
||||
export const UserPropType = PropTypes.shape({
|
||||
about: PropTypes.string,
|
||||
completedChallenges: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
@@ -125,7 +80,7 @@ export const User = PropTypes.shape({
|
||||
website: PropTypes.string
|
||||
});
|
||||
|
||||
export const CurrentCertsType = PropTypes.arrayOf(
|
||||
export const CurrentCertsPropType = PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
show: PropTypes.bool,
|
||||
title: PropTypes.string,
|
||||
@@ -133,8 +88,8 @@ export const CurrentCertsType = PropTypes.arrayOf(
|
||||
})
|
||||
);
|
||||
|
||||
export const StepsType = PropTypes.shape({
|
||||
currentCerts: CurrentCertsType,
|
||||
export const StepsPropType = PropTypes.shape({
|
||||
currentCerts: CurrentCertsPropType,
|
||||
isShowCerts: PropTypes.bool,
|
||||
isShowName: PropTypes.bool,
|
||||
isShowProfile: PropTypes.bool
|
||||
@@ -142,13 +97,13 @@ export const StepsType = PropTypes.shape({
|
||||
|
||||
// TYPESCRIPT TYPES
|
||||
|
||||
export type CurrentCertType = {
|
||||
export type CurrentCert = {
|
||||
show: boolean;
|
||||
title: string;
|
||||
certSlug: string;
|
||||
};
|
||||
|
||||
export type MarkdownRemarkType = {
|
||||
export type MarkdownRemark = {
|
||||
fields: [{ component: string; nodeIdentity: string; slug: string }];
|
||||
fileAbsolutePath: string;
|
||||
frontmatter: {
|
||||
@@ -196,7 +151,7 @@ export interface VideoLocaleIds {
|
||||
portuguese?: string;
|
||||
}
|
||||
|
||||
export type ChallengeNodeType = {
|
||||
export type ChallengeNode = {
|
||||
block: string;
|
||||
challengeOrder: number;
|
||||
challengeType: number;
|
||||
@@ -211,15 +166,31 @@ export type ChallengeNodeType = {
|
||||
id: string;
|
||||
instructions: string;
|
||||
isComingSoon: boolean;
|
||||
internal?: {
|
||||
content: string;
|
||||
contentDigest: string;
|
||||
description: string;
|
||||
fieldOwners: string[];
|
||||
ignoreType: boolean | null;
|
||||
mediaType: string;
|
||||
owner: string;
|
||||
type: string;
|
||||
};
|
||||
removeComments: boolean;
|
||||
isLocked: boolean;
|
||||
isPrivate: boolean;
|
||||
order: number;
|
||||
question: Question;
|
||||
required: Required[];
|
||||
solutions: {
|
||||
[T in FileKey]: FileKeyChallenge;
|
||||
};
|
||||
sourceInstanceName: string;
|
||||
superOrder: number;
|
||||
superBlock: string;
|
||||
tail: string[];
|
||||
template: string;
|
||||
tests: Test[];
|
||||
time: string;
|
||||
title: string;
|
||||
translationPending: boolean;
|
||||
@@ -231,28 +202,28 @@ export type ChallengeNodeType = {
|
||||
videoUrl: string;
|
||||
};
|
||||
|
||||
export type AllChallengeNodeType = {
|
||||
export type AllChallengeNode = {
|
||||
edges: [
|
||||
{
|
||||
node: ChallengeNodeType;
|
||||
node: ChallengeNode;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
export type AllMarkdownRemarkType = {
|
||||
export type AllMarkdownRemark = {
|
||||
edges: [
|
||||
{
|
||||
node: MarkdownRemarkType;
|
||||
node: MarkdownRemark;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
export type ResizePropsType = {
|
||||
export type ResizeProps = {
|
||||
onStopResize: (arg0: HandlerProps) => void;
|
||||
onResize: () => void;
|
||||
};
|
||||
|
||||
export type DimensionsType = {
|
||||
export type Dimensions = {
|
||||
height: number;
|
||||
width: number;
|
||||
};
|
||||
@@ -272,7 +243,7 @@ export type CertTest = {
|
||||
title: string;
|
||||
};
|
||||
|
||||
export type UserType = {
|
||||
export type User = {
|
||||
about: string;
|
||||
acceptedPrivacyTerms: boolean;
|
||||
completedChallenges: CompletedChallenge[];
|
||||
@@ -288,7 +259,7 @@ export type UserType = {
|
||||
name: string;
|
||||
picture: string;
|
||||
points: number;
|
||||
portfolio: PortfolioType[];
|
||||
portfolio: Portfolio[];
|
||||
profileUI: {
|
||||
isLocked: boolean;
|
||||
showCerts: boolean;
|
||||
@@ -301,9 +272,9 @@ export type UserType = {
|
||||
twitter: string;
|
||||
username: string;
|
||||
website: string;
|
||||
} & isCertifiedTypes;
|
||||
} & isCertified;
|
||||
|
||||
export type isCertifiedTypes = {
|
||||
export type isCertified = {
|
||||
is2018DataVisCert: boolean;
|
||||
isApisMicroservicesCert: boolean;
|
||||
isBackEndCert: boolean;
|
||||
@@ -331,10 +302,10 @@ export type CompletedChallenge = {
|
||||
challengeFiles: ChallengeFiles;
|
||||
};
|
||||
|
||||
export type ExtTypes = 'js' | 'html' | 'css' | 'jsx';
|
||||
export type FileKeyTypes = 'indexjs' | 'indexhtml' | 'indexcss';
|
||||
export type Ext = 'js' | 'html' | 'css' | 'jsx';
|
||||
export type FileKey = 'indexjs' | 'indexhtml' | 'indexcss';
|
||||
|
||||
export type ChallengeMetaType = {
|
||||
export type ChallengeMeta = {
|
||||
block: string;
|
||||
id: string;
|
||||
introPath: string;
|
||||
@@ -347,7 +318,7 @@ export type ChallengeMetaType = {
|
||||
helpCategory: string;
|
||||
};
|
||||
|
||||
export type PortfolioType = {
|
||||
export type Portfolio = {
|
||||
id: string;
|
||||
title?: string;
|
||||
url?: string;
|
||||
@@ -355,88 +326,21 @@ export type PortfolioType = {
|
||||
description?: string;
|
||||
};
|
||||
|
||||
export type FileKeyChallengeType = {
|
||||
export type FileKeyChallenge = {
|
||||
contents: string;
|
||||
ext: ExtTypes;
|
||||
ext: Ext;
|
||||
head: string;
|
||||
id: string;
|
||||
key: FileKeyTypes;
|
||||
key: FileKey;
|
||||
name: string;
|
||||
tail: string;
|
||||
};
|
||||
|
||||
// This looks redundant - same as ChallengeNodeType above?
|
||||
// TODO: @moT01 Yes, it is an almost duplicate because @ojeytonwilliams
|
||||
// does not allow us to add 'Type' at the end...
|
||||
// The below is more accurate, because it was built based on graphql's
|
||||
// interpretation of what we have. The props commented out are what we
|
||||
// think are on the node, but actually do not exist.
|
||||
export type ChallengeNode = {
|
||||
block: string;
|
||||
challengeFiles: ChallengeFiles;
|
||||
challengeOrder: number;
|
||||
challengeType: number;
|
||||
dashedName: string;
|
||||
description: string;
|
||||
fields: {
|
||||
slug: string;
|
||||
blockName: string;
|
||||
tests: Test[];
|
||||
};
|
||||
forumTopicId: number;
|
||||
// guideUrl: string;
|
||||
// head: string[];
|
||||
helpCategory: string;
|
||||
id: string;
|
||||
instructions: string;
|
||||
internal?: {
|
||||
content: string;
|
||||
contentDigest: string;
|
||||
description: string;
|
||||
fieldOwners: string[];
|
||||
ignoreType: boolean | null;
|
||||
mediaType: string;
|
||||
owner: string;
|
||||
type: string;
|
||||
};
|
||||
order: number;
|
||||
question: {
|
||||
answers: string[];
|
||||
solution: number;
|
||||
text: string;
|
||||
} | null;
|
||||
removeComments: boolean;
|
||||
required: [
|
||||
{
|
||||
link: string;
|
||||
raw: string;
|
||||
src: string;
|
||||
}
|
||||
];
|
||||
solutions: {
|
||||
[T in FileKeyTypes]: FileKeyChallengeType;
|
||||
};
|
||||
sourceInstanceName: string;
|
||||
superBlock: string;
|
||||
superOrder: number;
|
||||
template: string;
|
||||
tests: Test[];
|
||||
time: string;
|
||||
title: string;
|
||||
translationPending: boolean;
|
||||
videoId?: string;
|
||||
videoUrl?: string;
|
||||
// isComingSoon: boolean;
|
||||
// isLocked: boolean;
|
||||
// isPrivate: boolean;
|
||||
// tail: string[];
|
||||
};
|
||||
|
||||
// Extra types built from challengeSchema
|
||||
|
||||
export type ChallengeFile = {
|
||||
fileKey: string;
|
||||
ext: ExtTypes;
|
||||
ext: Ext;
|
||||
name: string;
|
||||
editableRegionBoundaries: number[];
|
||||
usesMultifileEditor: boolean;
|
||||
|
Reference in New Issue
Block a user