feat(client): ts-migrate client/src/resources/certAndProjectMap.js (#42648)

Co-authored-by: Parth Parth <thecodingaviator@users.noreply.github.com>
pull/42624/head
Parth Parth 2021-06-29 15:51:49 +05:30 committed by Mrugesh Mohapatra
parent b334031b2f
commit 6b52d6c331
No known key found for this signature in database
GPG Key ID: 68BDF41E23F50DD8
5 changed files with 13 additions and 8 deletions

View File

@ -20,7 +20,7 @@ import {
userByNameSelector, userByNameSelector,
fetchProfileForUser fetchProfileForUser
} from '../redux'; } from '../redux';
import { certMap } from '../resources/certAndProjectMap'; import { certMap } from '../resources/cert-and-project-map';
import { createFlashMessage } from '../components/Flash/redux'; import { createFlashMessage } from '../components/Flash/redux';
import standardErrorMessage from '../utils/standardErrorMessage'; import standardErrorMessage from '../utils/standardErrorMessage';
import reallyWeirdErrorMessage from '../utils/reallyWeirdErrorMessage'; import reallyWeirdErrorMessage from '../utils/reallyWeirdErrorMessage';

View File

@ -2,7 +2,10 @@ import React, { useState } from 'react';
import '../components/layouts/project-links.css'; import '../components/layouts/project-links.css';
import { maybeUrlRE } from '../utils'; import { maybeUrlRE } from '../utils';
import { Spacer, Link } from '../components/helpers'; import { Spacer, Link } from '../components/helpers';
import { projectMap, legacyProjectMap } from '../resources/certAndProjectMap'; import {
projectMap,
legacyProjectMap
} from '../resources/cert-and-project-map';
import ProjectModal from '../components/SolutionViewer/ProjectModal'; import ProjectModal from '../components/SolutionViewer/ProjectModal';
import { find, first } from 'lodash-es'; import { find, first } from 'lodash-es';
import { Trans, useTranslation } from 'react-i18next'; import { Trans, useTranslation } from 'react-i18next';

View File

@ -14,7 +14,7 @@ import { withTranslation } from 'react-i18next';
import { import {
projectMap, projectMap,
legacyProjectMap legacyProjectMap
} from '../../resources/certAndProjectMap'; } from '../../resources/cert-and-project-map';
import SectionHeader from './section-header'; import SectionHeader from './section-header';
import ProjectModal from '../SolutionViewer/ProjectModal'; import ProjectModal from '../SolutionViewer/ProjectModal';

View File

@ -440,7 +440,7 @@ const certMap = [
{ {
id: '606243f50267e718b1e755f4', id: '606243f50267e718b1e755f4',
title: 'Relational Databases', title: 'Relational Databases',
slug: 'relational-databases', certSlug: 'relational-databases',
flag: 'isRelationalDatabasesCert', flag: 'isRelationalDatabasesCert',
projects: [ projects: [
{ {
@ -704,10 +704,12 @@ const certMap = [
} }
] ]
} }
]; ] as const;
const legacyProjectMap = {}; const titles = certMap.map(({ title }) => title);
const projectMap = {}; type Title = typeof titles[number];
const legacyProjectMap: Partial<Record<Title, unknown>> = {};
const projectMap: Partial<Record<Title, unknown>> = {};
certMap.forEach(cert => { certMap.forEach(cert => {
// Filter out Legacy Full Stack so inputs for project // Filter out Legacy Full Stack so inputs for project

View File

@ -10,7 +10,7 @@ import GreenPass from '../../../assets/icons/green-pass';
import GreenNotCompleted from '../../../assets/icons/green-not-completed'; import GreenNotCompleted from '../../../assets/icons/green-not-completed';
import { certificatesByNameSelector } from '../../../redux'; import { certificatesByNameSelector } from '../../../redux';
import { CurrentCertsType, User } from '../../../redux/prop-types'; import { CurrentCertsType, User } from '../../../redux/prop-types';
import { certMap } from '../../../resources/certAndProjectMap'; import { certMap } from '../../../resources/cert-and-project-map';
import { import {
certSlugTypeMap, certSlugTypeMap,
superBlockCertTypeMap superBlockCertTypeMap