Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.26",
"turndown": "^4.0.2",
"typescript": "^4.8.4",
"universal-navigation": "https://github.com/topcoder-platform/universal-navigation",
"universal-navigation": "https://github.com/topcoder-platform/universal-navigation#9e62ddc61d",
"uuid": "^9.0.0"
},
"devDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion src/apps/platform/src/components/app-header/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ interface NavigationRequest {

const AppHeader: FC<{}> = () => {

const { activeToolName, activeToolRoute }: RouterContextData = useContext(routerContext)
const { activeToolName, activeToolRoute, routeNavConfigs }: RouterContextData = useContext(routerContext)
const { profile, initialized: profileReady }: ProfileContextData = useContext(profileContext)
const { logoutUrl }: ConfigContextValue = useConfigContext()
const [ready, setReady]: [boolean, Dispatch<SetStateAction<boolean>>] = useState<boolean>(false)
Expand Down Expand Up @@ -95,6 +95,7 @@ const AppHeader: FC<{}> = () => {
sprig: 'disable',
},
onReady() { setReady(true) },
showSalesCta: routeNavConfigs?.showSalesCta,
signIn() { window.location.href = authUrlLogin() },
signOut() { window.location.href = logoutUrl },
signUp() { window.location.href = authUrlSignup() },
Expand All @@ -112,6 +113,7 @@ const AppHeader: FC<{}> = () => {
userInfo,
profileReady,
logoutUrl,
routeNavConfigs,
])

// update uni-nav's tool details
Expand All @@ -121,6 +123,7 @@ const AppHeader: FC<{}> = () => {
'update',
navElementId,
{
showSalesCta: routeNavConfigs?.showSalesCta,
toolName: activeToolName,
toolRoot: activeToolRoute,
},
Expand All @@ -129,6 +132,7 @@ const AppHeader: FC<{}> = () => {
activeToolName,
activeToolRoute,
navElementId,
routeNavConfigs,
])

// update uni-nav's user/auth details
Expand Down
3 changes: 3 additions & 0 deletions src/apps/talent-search/src/talent-search.routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export const talentSearchRoutes: ReadonlyArray<PlatformRoute> = [
domain: AppSubdomain.talentSearch,
element: <TalentSearchAppRoot />,
id: toolTitle,
navConfig: {
showSalesCta: true,
},
rolesRequired: isAdminRestricted ? [
UserRole.administrator,
] : undefined,
Expand Down
1 change: 1 addition & 0 deletions src/libs/core/lib/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export * from './router-context'
export * from './routes-functions'
export * from './platform-route.model'
export * from './router.utils'
export * from './route-nav-config.model'
export * from './rewrite-route'
3 changes: 3 additions & 0 deletions src/libs/core/lib/router/platform-route.model.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { RouteNavConfig } from './route-nav-config.model'

export interface PlatformRoute {
domain?: string
alternativePaths?: Array<string>
Expand All @@ -9,4 +11,5 @@ export interface PlatformRoute {
rolesRequired?: Array<string>
route: string
title?: string
navConfig?: RouteNavConfig
}
3 changes: 3 additions & 0 deletions src/libs/core/lib/router/route-nav-config.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface RouteNavConfig {
showSalesCta?: boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const RouterProvider: FC<RouterProviderProps> = (props: RouterProviderPro
isRootRoute: isRootRoute(loggedInRoot, props.rootLoggedOut),
rootLoggedInRoute: loggedInRoot,
rootLoggedOutRoute: props.rootLoggedOut,
routeNavConfigs: activeRoute?.navConfig,
}
setRouteContextData(contextData)
}
Expand Down
2 changes: 2 additions & 0 deletions src/libs/core/lib/router/router-context/router.context.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Context, createContext, ReactElement } from 'react'

import { PlatformRoute } from '../platform-route.model'
import { RouteNavConfig } from '../route-nav-config.model'

export interface RouterContextData {
activeToolName?: string
activeToolRoute?: string
routeNavConfigs?: RouteNavConfig
allRoutes: Array<PlatformRoute>
getChildren: (parent: string) => Array<PlatformRoute>
getChildRoutes: (parent: string) => Array<ReactElement>
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19095,9 +19095,9 @@ unist-util-visit@^4.0.0:
unist-util-is "^5.0.0"
unist-util-visit-parents "^5.1.1"

"universal-navigation@https://github.com/topcoder-platform/universal-navigation":
version "1.0.12"
resolved "https://github.com/topcoder-platform/universal-navigation#92b8a638a901dedc0b59edb121161d9dabc8333a"
"universal-navigation@https://github.com/topcoder-platform/universal-navigation#9e62ddc61d":
version "1.0.17"
resolved "https://github.com/topcoder-platform/universal-navigation#9e62ddc61d44711e501b02e4c0890c348a3aa96d"

universalify@^0.2.0:
version "0.2.0"
Expand Down