Skip to content

Commit 78a110f

Browse files
committed
PROD-3245 - add universal-navigation as npm dependency, fix typings issue in header
1 parent b158852 commit 78a110f

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"swr": "^1.3.0",
7070
"tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.26",
7171
"typescript": "^4.8.4",
72+
"universal-navigation": "https://github.com/topcoder-platform/universal-navigation",
7273
"uuid": "^9.0.0"
7374
},
7475
"devDependencies": {

src-ts/header/Header.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
useState,
1111
} from 'react'
1212
import { NavigateFunction, useNavigate } from 'react-router-dom'
13+
import { type TcUniNavFn } from 'universal-navigation'
1314
import classNames from 'classnames'
1415

1516
import { EnvironmentConfig, PageSubheaderPortalId } from '../config'
@@ -27,7 +28,7 @@ import {
2728
import UniNavSnippet from './universal-nav-snippet'
2829

2930
// eslint-disable-next-line @typescript-eslint/no-explicit-any
30-
declare let tcUniNav: any
31+
declare let tcUniNav: TcUniNavFn
3132
UniNavSnippet(EnvironmentConfig.UNIVERSAL_NAV.URL)
3233

3334
interface NavigationRequest {
@@ -80,13 +81,13 @@ const Header: FC = () => {
8081
signIn() { window.location.href = authUrlLogin() },
8182
signOut() { window.location.href = authUrlLogout },
8283
signUp() { window.location.href = authUrlSignup() },
83-
toolName: activeToolName,
84-
toolRoot: activeToolRoute,
84+
toolName: activeToolName ?? '',
85+
toolRoot: activeToolRoute ?? '',
8586
type: 'tool',
8687
user: profile ? {
8788
handle: profile.handle,
8889
initials: `${profile.firstName.charAt(0)}${profile.lastName.charAt(0)}`,
89-
photoURL: profile.photoURL,
90+
photoURL: profile.photoURL ?? '',
9091
userId: profile.userId,
9192
} : undefined,
9293
},
@@ -109,8 +110,8 @@ const Header: FC = () => {
109110
'update',
110111
navElementId,
111112
{
112-
toolName: activeToolName,
113-
toolRoute: activeToolRoute,
113+
toolName: activeToolName ?? '',
114+
toolRoot: activeToolRoute ?? '',
114115
},
115116
)
116117
}, [

yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14062,6 +14062,10 @@ unique-string@^2.0.0:
1406214062
dependencies:
1406314063
crypto-random-string "^2.0.0"
1406414064

14065+
"universal-navigation@https://github.com/topcoder-platform/universal-navigation":
14066+
version "1.0.0"
14067+
resolved "https://github.com/topcoder-platform/universal-navigation#1324cf3b338a9b5c98a758bf1876f8ef4d78aacb"
14068+
1406514069
universalify@^0.2.0:
1406614070
version "0.2.0"
1406714071
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0"

0 commit comments

Comments
 (0)