Skip to content

Commit dcbb4f0

Browse files
Merge pull request #100 from topcoder-platform/PROD-2195_migrate-mfe
Prod 2195 migrate mfe
2 parents 1e4b0c2 + 1802de9 commit dcbb4f0

File tree

367 files changed

+9081
-2476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

367 files changed

+9081
-2476
lines changed

src-ts/App.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
import { FC, ReactElement, useContext } from 'react'
2-
import { Route, Routes } from 'react-router-dom'
2+
import { Routes } from 'react-router-dom'
33
import { toast, ToastContainer } from 'react-toastify'
44

55
import { EnvironmentConfig } from './config'
66
import { Header } from './header'
7-
import { analyticsInitialize, logInitialize, ProfileProvider } from './lib'
8-
import { routeContext, RouteContextData } from './lib/route-provider'
7+
import { analyticsInitialize, logInitialize, routeContext, RouteContextData } from './lib'
98

109
analyticsInitialize(EnvironmentConfig)
1110
logInitialize(EnvironmentConfig)
1211

1312
const App: FC<{}> = () => {
1413

15-
const { allRoutes }: RouteContextData = useContext(routeContext)
14+
const { allRoutes, getRouteElement }: RouteContextData = useContext(routeContext)
1615

1716
const routeElements: Array<ReactElement> = allRoutes
18-
.map(route => {
19-
// if the route has children, add the wildcard to the path
20-
const path: string = `${route.route}${!route.children ? '' : '/*'}`
21-
return (<Route path={path} element={route.element} key={route.title} />)
22-
})
17+
.map(route => getRouteElement(route))
2318

2419
return (
25-
<ProfileProvider>
20+
<>
2621
<Header />
2722
<Routes>
2823
{routeElements}
@@ -38,7 +33,7 @@ const App: FC<{}> = () => {
3833
draggable
3934
pauseOnHover
4035
/>
41-
</ProfileProvider>
36+
</>
4237
)
4338
}
4439

src-ts/config/constants.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
export enum ToolTitle {
2-
designLib = 'Design Library',
3-
settings = 'Profile Settings',
2+
settings = 'Account Settings',
43
work = 'Work',
54
}
5+
6+
export enum FooterSocialConfig {
7+
facebook = 'https://www.facebook.com/topcoder',
8+
youtube = 'https://www.youtube.com/channel/UCFv29ANLT2FQmtvS9DRixNA',
9+
linkedin = 'https://www.linkedin.com/company/topcoder',
10+
twitter = 'https://twitter.com/topcoder',
11+
instagram = 'https://www.instagram.com/topcoder',
12+
}

src-ts/config/environments/environment.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { EnvironmentConfigProd } from './environment.prod.config'
88

99
function getEnvironmentConfig(): GlobalConfig {
1010

11-
switch (process.env.REACT_APP_HOST_ENV) {
11+
switch (process.env.APPENV) {
1212

1313
case AppHostEnvironment.bsouza:
1414
return EnvironmentConfigBsouza
@@ -23,7 +23,7 @@ function getEnvironmentConfig(): GlobalConfig {
2323
return EnvironmentConfigProd
2424

2525
default:
26-
throw new Error(`Cannot initialize an invalid host environment: ${process.env.REACT_APP_HOST_ENV}`)
26+
return EnvironmentConfigDefault
2727
}
2828
}
2929

src-ts/config/environments/environment.default.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { AppHostEnvironment } from './app-host-environment.enum'
44

55
export const EnvironmentConfigDefault: GlobalConfig = {
66
API: {
7+
FORUM_ACCESS_TOKEN: 'va.JApNvUOx3549h20I6tnl1kOQDc75NDIp.0jG3dA.EE3gZgV',
8+
FORUM_V2: 'https://vanilla.topcoder-dev.com/api/v2',
79
V3: 'https://api.topcoder-dev.com/v3',
810
V5: 'https://api.topcoder-dev.com/v5',
911
},

src-ts/config/environments/environment.prod.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ import { EnvironmentConfigDefault } from './environment.default.config'
77
export const EnvironmentConfigProd: GlobalConfig = {
88
...EnvironmentConfigDefault,
99
API: {
10+
FORUM_V2: 'https://vanilla.topcoder.com/api/v2',
1011
V3: 'https://api.topcoder.com/v3',
1112
V5: 'https://api.topcoder.com/v5',
1213
},
13-
DISABLED_TOOLS: [
14-
ToolTitle.designLib,
15-
],
14+
DISABLED_TOOLS: [ ],
1615
ENV: AppHostEnvironment.prod,
1716
TAG_MANAGER_ID: 'GTM-MXXQHG8',
1817
URL: {

src-ts/declarations.d.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
declare module '*.html' {
2-
const rawHtmlFile: string
3-
export = rawHtmlFile
2+
const htmlFile: string
3+
export = htmlFile
44
}
55

6+
declare module '*.scss' {
7+
const scssFile: { [style: string]: any }
8+
export = scssFile
9+
}
10+
11+
declare module '*.svg' {
12+
import * as React from 'react'
13+
14+
export const ReactComponent: React.FunctionComponent<React.SVGProps<
15+
SVGSVGElement
16+
> & { title?: string }>
17+
18+
const src: string
19+
export default src
20+
}
21+
22+
declare module '@topcoder/mfe-header'
23+
624
declare module 'tc-auth-lib'

src-ts/header/Header.module.scss

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,27 @@
1-
@import '../lib/styles';
1+
@import '../lib/styles/includes';
2+
3+
.header-wrap {
4+
display: block;
5+
background-color: $tc-black;
6+
}
27

38
.header {
49
display: grid;
510
height: $header-height;
6-
background-color: $tc-black;
711
align-items: center;
8-
padding: 0 $pad-xxl 0 0;
12+
width: 100%;
13+
margin: 0 auto;
14+
max-width: $xxl-min;
15+
@include pagePaddings;
16+
grid-template-columns: 78px 1fr auto;
917

1018
@include ltemd {
1119
grid-template-columns: $header-height 1fr $header-height;
1220
align-items: center;
1321
}
22+
}
1423

15-
@include sm {
16-
padding: 0 $pad-lg 0 0;
17-
}
18-
19-
@include md {
20-
grid-template-columns: $left-col-width-md 1fr auto;
21-
padding: 0 $pad-lg 0 0;
22-
}
23-
24-
@include lg {
25-
grid-template-columns: $left-col-width-lg 1fr auto;
26-
}
27-
28-
@include xl {
29-
grid-template-columns: $left-col-width-xl 1fr auto;
30-
}
31-
32-
@include xxl {
33-
grid-template-columns: $left-col-width-xl 1fr auto;
34-
}
24+
.subheader {
25+
width: 100%;
26+
position: relative;
3527
}

src-ts/header/Header.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ import { UtilitySelectors } from './utility-selectors'
77

88
const Header: FC<{}> = () => {
99
return (
10-
<header className={styles.header}>
11-
<ToolSelectors isWide={false} />
12-
<Logo />
13-
<ToolSelectors isWide={true} />
14-
<UtilitySelectors />
15-
</header>
10+
<div className={styles['header-wrap']}>
11+
<header className={styles.header}>
12+
<ToolSelectors isWide={false} />
13+
<Logo />
14+
<ToolSelectors isWide={true} />
15+
<UtilitySelectors />
16+
</header>
17+
<div id='page-subheader-portal-el' className={styles.subheader}></div>
18+
</div>
1619
)
1720
}
1821

src-ts/header/logo/Logo.module.scss

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
@import '../../lib/styles';
1+
@import '../../lib/styles/includes';
22

33
.logo-no-link,
44
.logo-link {
55
display: flex;
6-
flex-direction: column;
7-
align-items: center;
6+
7+
a {
8+
display: flex;
9+
}
810

911
svg {
1012
width: calc($pad-xxl + $pad-xxxxl);
1113
height: $pad-xl;
12-
@extend .pad-xxl;
1314
fill: none;
1415

1516
path {
@@ -20,10 +21,12 @@
2021
padding: 0;
2122
}
2223
}
24+
@include ltemd {
25+
margin: 0 auto;
26+
}
2327
}
2428

2529
.logo-no-link {
26-
2730
a {
2831
cursor: default;
2932
}

src-ts/header/logo/Logo.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
1-
import { FC } from 'react'
1+
import { FC, useContext } from 'react'
22
import { Link, useLocation } from 'react-router-dom'
33

4-
import { LogoIcon, routeIsActive, routeRoot } from '../../lib'
4+
import { LogoIcon, routeContext, RouteContextData } from '../../lib'
55
import '../../lib/styles/index.scss'
66

77
import styles from './Logo.module.scss'
88

99
const Logo: FC<{}> = () => {
1010

11+
const {
12+
isRootRoute,
13+
rootLoggedInRoute,
14+
}: RouteContextData = useContext(routeContext)
15+
1116
// the logo should be a link to the home page for all pages except the home page
12-
const isLink: boolean = routeIsActive(useLocation().pathname, routeRoot)
17+
const isLink: boolean = !isRootRoute(useLocation().pathname)
1318

1419
return (
15-
<div className={styles[`logo-${isLink ? 'no-' : ''}link`]}>
20+
<div className={styles[`logo-${!isLink ? 'no-' : ''}link`]}>
1621
<Link
1722
tabIndex={-1}
18-
to={routeRoot}
23+
to={rootLoggedInRoute}
1924
>
2025
<LogoIcon />
2126
</Link>

0 commit comments

Comments
 (0)