Skip to content

Commit 7b847b7

Browse files
author
Maria Mattlin
committed
Merge branch 'dev' into PROD-2321_bug-hunt-intake-form
2 parents d47f454 + 5f20052 commit 7b847b7

File tree

40 files changed

+362
-152
lines changed

40 files changed

+362
-152
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const EnvironmentConfigDev: GlobalConfig = {
77
...EnvironmentConfigDefault,
88
DISABLED_TOOLS: [],
99
ENV: AppHostEnvironment.dev,
10-
LEARN_SRC: 'https://freecodecamp.topcoder-dev.com/',
10+
LEARN_SRC: 'https://freecodecamp.topcoder-dev.com',
1111
// TODO: Move stripe creds to .env file
1212
STRIPE: {
1313
ADMIN_TOKEN:

src-ts/header/logo/Logo.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { Link, useLocation } from 'react-router-dom'
33

44
import {
55
LogoIcon,
6-
profileContext,
7-
ProfileContextData,
86
routeContext,
97
RouteContextData,
108
} from '../../lib'
@@ -14,16 +12,11 @@ import styles from './Logo.module.scss'
1412

1513
const Logo: FC<{}> = () => {
1614

17-
const { isLoggedIn }: ProfileContextData = useContext<ProfileContextData>(profileContext)
18-
const {
19-
isRootRoute,
20-
rootLoggedInRoute,
21-
rootLoggedOutRoute,
22-
}: RouteContextData = useContext(routeContext)
15+
const routeContextData: RouteContextData = useContext(routeContext)
2316

2417
// the logo should be a link to the home page for all pages except the home page
25-
const isLink: boolean = !isRootRoute(useLocation().pathname)
26-
const rootRoute: string = isLoggedIn ? rootLoggedInRoute : rootLoggedOutRoute
18+
const isLink: boolean = !routeContextData.isRootRoute(useLocation().pathname)
19+
const rootRoute: string = routeContextData.rootLoggedInRoute || ''
2720

2821
return (
2922
<div className={styles[`logo-${!isLink ? 'no-' : ''}link`]}>

src-ts/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/profile-panel/ProfilePanel.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ interface ProfilePanelProps {
2121
const ProfilePanel: FC<ProfilePanelProps> = (props: ProfilePanelProps) => {
2222

2323
const { profile }: ProfileContextData = useContext(profileContext)
24-
const {
25-
getPath,
26-
rootLoggedOutRoute,
27-
}: RouteContextData = useContext(routeContext)
24+
const { getPath }: RouteContextData = useContext(routeContext)
2825

2926
const navigate: NavigateFunction = useNavigate()
3027

@@ -61,7 +58,7 @@ const ProfilePanel: FC<ProfilePanelProps> = (props: ProfilePanelProps) => {
6158
</span>
6259
</div>
6360
<a
64-
href={authUrlLogout(rootLoggedOutRoute)}
61+
href={authUrlLogout}
6562
className={classNames(styles.logout, styles['nav-item'])}
6663
>
6764
<span className={styles.icon}>

src-ts/header/utility-selectors/UtilitySelector/ProfileSelector/profile-not-logged-in/ProfileNotLoggedIn.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const ProfileNotLoggedIn: FC<{}> = () => {
2323
label='Sign Up'
2424
size='md'
2525
tabIndex={-1}
26-
url={authUrlSignup()}
26+
url={authUrlSignup}
2727
/>
2828
</>
2929
)

src-ts/lib/breadcrumb/Breadcrumb.module.scss

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,16 @@
1212
margin: 0 auto;
1313
@include pagePaddings;
1414

15+
@include ltemd {
16+
padding-top: $pad-xs;
17+
padding-bottom: $pad-xs;
18+
}
19+
1520
ol {
1621
display: flex;
1722
padding-left: 0px;
1823
margin: 0;
1924

20-
&.hidden-mobile {
21-
@include ltemd {
22-
display: none;
23-
}
24-
}
25-
26-
&.show-mobile {
27-
@include gtemd {
28-
display: none;
29-
}
30-
}
31-
3225
>li {
3326
display: inline-flex;
3427
align-items: center;

src-ts/lib/breadcrumb/Breadcrumb.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const Breadcrumb: FC<BreadcrumbProps> = (props: BreadcrumbProps) => {
1818
return createPortal((
1919
<div className={styles['breadcrumb-wrap']}>
2020
<nav className={styles.breadcrumb}>
21-
<ol className={styles['show-mobile']}>
21+
<ol className='desktop-hide'>
2222
<>
2323
{
2424
props.items.length <= 2 && props.items.map((item, index) =>
@@ -55,7 +55,7 @@ const Breadcrumb: FC<BreadcrumbProps> = (props: BreadcrumbProps) => {
5555
}
5656
</>
5757
</ol>
58-
<ol className={styles['hidden-mobile']}>
58+
<ol className='mobile-hide'>
5959
{props.items.map((item, index) =>
6060
<BreadcrumbItem
6161
index={index + 1}

src-ts/lib/contact-support-form/contact-support-form.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,5 @@ export const contactSupportFormDef: FormDefinition = {
8282
],
8383
successMessage: 'Your request has been submitted.',
8484
}
85+
86+
export const contactSupportPath: string = '/support'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export { default as ContactSupportForm } from './ContactSupportForm'
2-
export { contactSupportFormDef } from './contact-support-form.config'
2+
export { contactSupportFormDef, contactSupportPath } from './contact-support-form.config'

src-ts/lib/functions/authentication-functions/authentication-url.config.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ export const authentication: string = EnvironmentConfig.URL.ACCOUNTS_APP_CONNECT
44

55
export const login: string = `${authentication}?retUrl=${encodeURIComponent(window.location.href.match(/[^?]*/)?.[0] || window.location.host)}`
66

7-
export function logout(loggedOutRoute: string): string {
8-
return `${authentication}?logout=true&retUrl=${encodeURIComponent('https://' + window.location.host)}${loggedOutRoute}`
9-
}
7+
export const logout: string = `${authentication}?logout=true&retUrl=${encodeURIComponent('https://' + window.location.host)}`
108

11-
export function signup(): string {
12-
return `${login}&regSource=tcBusiness&mode=signUp`
13-
}
9+
export const signup: string = `${login}&regSource=tcBusiness&mode=signUp`

src-ts/lib/loading-spinner/LoadingSpinner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface LoadingSpinnerProps {
1616

1717
const LoadingSpinner: FC<LoadingSpinnerProps> = ({ show = false, className }: LoadingSpinnerProps) => {
1818
return (
19-
<div className={classNames(styles['loading-spinner'], show ? 'show' : 'hide', className)}>
19+
<div className={classNames(styles['loading-spinner'], styles[show ? 'show' : 'hide'], className)}>
2020
<PuffLoader color={'#2196f3'} loading={true} size={100} />
2121
</div>
2222
)

src-ts/lib/route-provider/route-context-data.model.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ReactElement } from 'react'
1+
import { FC, ReactElement } from 'react'
22

33
import { PlatformRoute } from './platform-route.model'
44

@@ -9,10 +9,11 @@ export interface RouteContextData {
99
getPath: (routeTitle: string) => string
1010
getPathFromRoute: (route: PlatformRoute) => string
1111
getRouteElement: (route: PlatformRoute) => JSX.Element
12+
initialized: boolean
1213
isActiveTool: (activePath: string, toolRoute: PlatformRoute) => boolean
1314
isRootRoute: (activePath: string) => boolean
1415
rootLoggedInRoute: string
15-
rootLoggedOutRoute: string
16+
rootLoggedOutFC: FC<{}>
1617
toolsRoutes: Array<PlatformRoute>
1718
toolsRoutesForNav: Array<PlatformRoute>
1819
utilsRoutes: Array<PlatformRoute>

src-ts/lib/route-provider/route.context.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ export const defaultRouteContextData: RouteContextData = {
99
getPath: () => '',
1010
getPathFromRoute: () => '',
1111
getRouteElement: () => <></>,
12+
initialized: false,
1213
isActiveTool: () => false,
1314
isRootRoute: () => false,
1415
rootLoggedInRoute: '',
15-
rootLoggedOutRoute: '',
16+
rootLoggedOutFC: () => <></>,
1617
toolsRoutes: [],
1718
toolsRoutesForNav: [],
1819
utilsRoutes: [],

src-ts/lib/route-provider/route.provider.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ interface RouteProviderProps {
2222
children: ReactNode
2323
rootCustomer: string
2424
rootLoggedOut: string
25+
rootLoggedOutFC: FC<{}>
2526
rootMember: string
2627
toolsRoutes: Array<PlatformRoute>
2728
utilsRoutes: Array<PlatformRoute>
2829
}
2930

3031
export const RouteProvider: FC<RouteProviderProps> = (props: RouteProviderProps) => {
3132

32-
const { profile }: ProfileContextData = useContext<ProfileContextData>(profileContext)
33+
const { initialized, profile }: ProfileContextData = useContext<ProfileContextData>(profileContext)
3334

3435
const [routeContextData, setRouteContextData]: [RouteContextData, Dispatch<SetStateAction<RouteContextData>>]
3536
= useState<RouteContextData>(defaultRouteContextData)
@@ -68,18 +69,23 @@ export const RouteProvider: FC<RouteProviderProps> = (props: RouteProviderProps)
6869
...utilsRoutes,
6970
]
7071
// TODO: support additional roles and landing pages
71-
const loggedInRoot: string = !!profile?.isCustomer ? props.rootCustomer : props.rootMember
72+
const loggedInRoot: string = !profile
73+
? ''
74+
: profile.isCustomer
75+
? props.rootCustomer
76+
: props.rootMember
7277
const contextData: RouteContextData = {
7378
allRoutes,
7479
getChildRoutes,
7580
getChildren,
7681
getPath,
7782
getPathFromRoute,
7883
getRouteElement,
84+
initialized,
7985
isActiveTool,
8086
isRootRoute: isRootRoute(loggedInRoot, props.rootLoggedOut),
8187
rootLoggedInRoute: loggedInRoot,
82-
rootLoggedOutRoute: props.rootLoggedOut,
88+
rootLoggedOutFC: props.rootLoggedOutFC,
8389
toolsRoutes,
8490
toolsRoutesForNav,
8591
utilsRoutes,
@@ -135,7 +141,10 @@ export const RouteProvider: FC<RouteProviderProps> = (props: RouteProviderProps)
135141

136142
useEffect(() => {
137143
getAndSetRoutes()
144+
// THIS WILL BE FIXED IN https://github.com/topcoder-platform/platform-ui/tree/PROD-2321_bug-hunt-intake-form
145+
// eslint-disable-next-line react-hooks/exhaustive-deps
138146
}, [
147+
initialized,
139148
profile,
140149
props.toolsRoutes,
141150
props.utilsRoutes,
@@ -155,9 +164,7 @@ function isActiveTool(activePath: string, toolRoute: PlatformRoute): boolean {
155164
)
156165
}
157166

158-
function isRootRoute(rootLoggedIn: string, rootLoggedOut: string):
159-
(activePath: string) => boolean {
160-
167+
function isRootRoute(rootLoggedIn: string | undefined, rootLoggedOut: string): (activePath: string) => boolean {
161168
return (activePath: string) => {
162169
return [rootLoggedIn, rootLoggedOut].some(route => activePath === route)
163170
}

src-ts/lib/styles/_layout.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
html {
55
--header-height: 80px;
66
--footer-height: 51px;
7+
--breadcrumb-height: 64px;
78

89
@include ltemd {
910
--header-height: 64px;
11+
--breadcrumb-height: 48px;
1012
}
1113

1214
@include ltesm {

src-ts/tools/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export { default as toolsRoutes, } from './tools.routes'
66
export {
77
ChallengeMetadataName,
88
dashboardRoute as routeRootCustomer,
9-
rootRoute as routeRootLoggedOut,
109
workContext,
1110
WorkDetailDetails,
1211
WorkDetailDetailsPane,

0 commit comments

Comments
 (0)