From 5ffd65e4e7f067422ff7c00696c464fb0cdc2173 Mon Sep 17 00:00:00 2001 From: Vishwasa Navada K Date: Tue, 9 Nov 2021 19:51:46 +0530 Subject: [PATCH] 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. --- .../client-only-routes/show-certification.tsx | 6 +- .../show-profile-or-four-oh-four.tsx | 6 +- .../client-only-routes/show-project-links.tsx | 8 +- .../src/client-only-routes/show-settings.tsx | 6 +- client/src/components/Map/index.tsx | 8 +- client/src/redux/prop-types.ts | 186 +++++------------- .../Challenges/classic/desktop-layout.tsx | 4 +- .../templates/Challenges/classic/editor.tsx | 18 +- .../src/templates/Challenges/classic/show.tsx | 14 +- .../templates/Challenges/codeally/show.tsx | 11 +- .../components/completion-modal.tsx | 7 +- .../Challenges/projects/backend/Show.tsx | 10 +- .../Challenges/projects/frontend/Show.tsx | 11 +- .../src/templates/Challenges/video/Show.tsx | 11 +- client/src/templates/Introduction/intro.tsx | 12 +- .../Introduction/super-block-intro.tsx | 14 +- client/src/utils/ajax.ts | 10 +- 17 files changed, 113 insertions(+), 229 deletions(-) diff --git a/client/src/client-only-routes/show-certification.tsx b/client/src/client-only-routes/show-certification.tsx index c91126a6d3..33074c2152 100644 --- a/client/src/client-only-routes/show-certification.tsx +++ b/client/src/client-only-routes/show-certification.tsx @@ -25,7 +25,7 @@ import { userByNameSelector, fetchProfileForUser } from '../redux'; -import { UserType } from '../redux/prop-types'; +import { User } from '../redux/prop-types'; import { certMap } from '../resources/cert-and-project-map'; import certificateMissingMessage from '../utils/certificate-missing-message'; import reallyWeirdErrorMessage from '../utils/really-weird-error-message'; @@ -69,7 +69,7 @@ interface IShowCertificationProps { certSlug: string; }) => void; signedInUserName: string; - user: UserType; + user: User; userFetchState: { complete: boolean; }; @@ -78,7 +78,7 @@ interface IShowCertificationProps { } const requestedUserSelector = (state: unknown, { username = '' }) => - userByNameSelector(username.toLowerCase())(state) as UserType; + userByNameSelector(username.toLowerCase())(state) as User; const validCertSlugs = certMap.map(cert => cert.certSlug); diff --git a/client/src/client-only-routes/show-profile-or-four-oh-four.tsx b/client/src/client-only-routes/show-profile-or-four-oh-four.tsx index 2cab086fc2..c4e0ed9c6d 100644 --- a/client/src/client-only-routes/show-profile-or-four-oh-four.tsx +++ b/client/src/client-only-routes/show-profile-or-four-oh-four.tsx @@ -12,7 +12,7 @@ import { fetchProfileForUser, usernameSelector } from '../redux'; -import { UserType } from '../redux/prop-types'; +import { User } from '../redux/prop-types'; interface IShowProfileOrFourOhFourProps { fetchProfileForUser: (username: string) => void; @@ -23,14 +23,14 @@ interface IShowProfileOrFourOhFourProps { }; isSessionUser: boolean; maybeUser: string; - requestedUser: UserType; + requestedUser: User; showLoading: boolean; } const createRequestedUserSelector = () => (state: unknown, { maybeUser = '' }) => - userByNameSelector(maybeUser.toLowerCase())(state) as UserType; + userByNameSelector(maybeUser.toLowerCase())(state) as User; const createIsSessionUserSelector = () => (state: unknown, { maybeUser = '' }) => diff --git a/client/src/client-only-routes/show-project-links.tsx b/client/src/client-only-routes/show-project-links.tsx index 15ece65c64..bc243df3a0 100644 --- a/client/src/client-only-routes/show-project-links.tsx +++ b/client/src/client-only-routes/show-project-links.tsx @@ -4,11 +4,7 @@ import '../components/layouts/project-links.css'; import { Trans, useTranslation } from 'react-i18next'; import ProjectModal from '../components/SolutionViewer/ProjectModal'; import { Spacer, Link } from '../components/helpers'; -import { - ChallengeFiles, - CompletedChallenge, - UserType -} from '../redux/prop-types'; +import { ChallengeFiles, CompletedChallenge, User } from '../redux/prop-types'; import { projectMap, legacyProjectMap @@ -19,7 +15,7 @@ import { maybeUrlRE } from '../utils'; interface IShowProjectLinksProps { certName: string; name: string; - user: UserType; + user: User; } type SolutionStateType = { diff --git a/client/src/client-only-routes/show-settings.tsx b/client/src/client-only-routes/show-settings.tsx index 7b01dc6943..c49e9337be 100644 --- a/client/src/client-only-routes/show-settings.tsx +++ b/client/src/client-only-routes/show-settings.tsx @@ -22,7 +22,7 @@ import { isSignedInSelector, hardGoTo as navigate } from '../redux'; -import { UserType } from '../redux/prop-types'; +import { User } from '../redux/prop-types'; import { submitNewAbout, updateUserFlag, verifyCert } from '../redux/settings'; const { apiLocation } = envData; @@ -40,7 +40,7 @@ interface IShowSettingsProps { updateIsHonest: () => void; updatePortfolio: () => void; updateQuincyEmail: (isSendQuincyEmail: boolean) => void; - user: UserType; + user: User; verifyCert: () => void; path?: string; } @@ -49,7 +49,7 @@ const mapStateToProps = createSelector( signInLoadingSelector, userSelector, isSignedInSelector, - (showLoading: boolean, user: UserType, isSignedIn) => ({ + (showLoading: boolean, user: User, isSignedIn) => ({ showLoading, user, isSignedIn diff --git a/client/src/components/Map/index.tsx b/client/src/components/Map/index.tsx index a1c0239c8f..34df2a2e38 100644 --- a/client/src/components/Map/index.tsx +++ b/client/src/components/Map/index.tsx @@ -6,7 +6,7 @@ import envData from '../../../../config/env.json'; import { isAuditedCert } from '../../../../utils/is-audited'; import { generateIconComponent, SuperBlock } from '../../assets/icons'; import LinkButton from '../../assets/icons/link-button'; -import { ChallengeNodeType } from '../../redux/prop-types'; +import { ChallengeNode } from '../../redux/prop-types'; import { Link, Spacer } from '../helpers'; import './map.css'; @@ -20,7 +20,7 @@ interface MapProps { interface MapData { allChallengeNode: { - nodes: ChallengeNodeType[]; + nodes: ChallengeNode[]; }; } @@ -39,7 +39,7 @@ const linkSpacingStyle = { alignItems: 'center' }; -function renderLandingMap(nodes: ChallengeNodeType[]) { +function renderLandingMap(nodes: ChallengeNode[]) { nodes = nodes.filter(node => node.superBlock !== 'coding-interview-prep'); return (