Skip to content

Commit ebafc09

Browse files
Merge branch 'qa' into PROD-1515_sorting
2 parents a6b0d3e + 0ede0a4 commit ebafc09

File tree

23 files changed

+145
-66
lines changed

23 files changed

+145
-66
lines changed

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ workflows:
7575
filters:
7676
branches:
7777
only:
78-
- develop
78+
# - develop
79+
- qa
7980

8081
# Production builds are exectuted only on tagged commits to the
8182
# master branch.

src-ts/header/tool-selectors/tool-selectors-narrow/tool-selector-narrow/ToolSelectorNarrow.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import classNames from 'classnames'
2-
import { FC } from 'react'
2+
import { FC, useContext } from 'react'
33
import { Link, useLocation } from 'react-router-dom'
44

5-
import { IconOutline, PlatformRoute, routeIsActive } from '../../../../lib'
5+
import { IconOutline, PlatformRoute, routeContext, RouteContextData, routeIsActive } from '../../../../lib'
66

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

@@ -14,22 +14,23 @@ const isParamRoute: (route: string) => boolean = (route: string) => !!route.matc
1414

1515
const ToolSelectorNarrow: FC<ToolSelectorNarrowProps> = (props: ToolSelectorNarrowProps) => {
1616

17-
const route: PlatformRoute = props.route
18-
const path: string = props.route.route
17+
const { getPathFromRoute }: RouteContextData = useContext(routeContext)
18+
const toolRoute: PlatformRoute = props.route
19+
const toolPath: string = getPathFromRoute(toolRoute)
1920

2021
const baseClass: string = 'tool-selector-narrow'
21-
const isActive: boolean = routeIsActive(useLocation().pathname, path)
22+
const isActive: boolean = routeIsActive(useLocation().pathname, toolPath)
2223
const activeIndicaterClass: string = `${baseClass}-${isActive ? '' : 'in'}active`
23-
const hasChildren: boolean = !!route.children.some(child => !!child.route && !isParamRoute(child.route))
24+
const hasChildren: boolean = !!toolRoute.children.some(child => !!child.route && !isParamRoute(child.route))
2425

2526
return (
2627
<div className={styles[baseClass]}>
2728
<Link
2829
className={classNames(styles[`${baseClass}-link`], styles[activeIndicaterClass])}
29-
key={path}
30-
to={path}
30+
key={toolPath}
31+
to={toolPath}
3132
>
32-
{route.title}
33+
{toolRoute.title}
3334
{hasChildren && <IconOutline.ChevronRightIcon />}
3435
</Link>
3536
</div>

src-ts/header/tool-selectors/tool-selectors-wide/tool-selector-wide/ToolSelectorWide.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ import classNames from 'classnames'
22
import { FC, useContext } from 'react'
33
import { Link, useLocation } from 'react-router-dom'
44

5-
import { ToolTitle } from '../../../../config'
6-
import { PlatformRoute, routeContext, RouteContextData, routeIsActive, routeIsHome } from '../../../../lib'
5+
import {
6+
PlatformRoute,
7+
routeContext,
8+
RouteContextData,
9+
routeIsActive,
10+
routeIsHome,
11+
} from '../../../../lib'
712
import '../../../../lib/styles/index.scss'
813

914
import styles from './ToolSelectorWide.module.scss'
@@ -14,15 +19,17 @@ interface ToolSelectorWideProps {
1419

1520
const ToolSelectorWide: FC<ToolSelectorWideProps> = (props: ToolSelectorWideProps) => {
1621

17-
const { getPath, getPathFromRoute }: RouteContextData = useContext(routeContext)
18-
const currentPath: string = useLocation().pathname
22+
const { getPathFromRoute }: RouteContextData = useContext(routeContext)
23+
const activePath: string = useLocation().pathname
24+
const toolRoute: PlatformRoute = props.route
25+
const toolPath: string = getPathFromRoute(toolRoute)
26+
27+
const isActive: boolean = routeIsActive(activePath, toolPath)
1928

20-
// for now, the work tool should be active for all pages except the account
21-
const isActive: boolean = !routeIsActive(currentPath, getPath(ToolTitle.settings))
2229
const activeIndicatorClass: string = `tool-selector-wide-${isActive ? '' : 'in'}active`
2330

2431
// the tool link should be usable for all active routes except the home page
25-
const isLink: boolean = isActive && !routeIsHome(currentPath)
32+
const isLink: boolean = isActive && !routeIsHome(activePath)
2633

2734
return (
2835
<div className={classNames(
@@ -33,9 +40,9 @@ const ToolSelectorWide: FC<ToolSelectorWideProps> = (props: ToolSelectorWideProp
3340
<Link
3441
className='large-tab'
3542
tabIndex={-1}
36-
to={getPathFromRoute(props.route)}
43+
to={toolPath}
3744
>
38-
{props.route.title}
45+
{toolRoute.title}
3946
</Link>
4047
<div className={styles['active-indicator']}></div>
4148
</div>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { EnvironmentConfig } from '../../../config'
2+
import { routeSelfServiceRoot } from '../../route-provider'
23

34
export const authentication: string = EnvironmentConfig.URL.ACCOUNTS_APP_CONNECTOR
45

56
export function login(fallback: string): string {
67
return `${authentication}?retUrl=${encodeURIComponent(window.location.href.match(/[^?]*/)?.[0] || fallback)}`
78
}
89

9-
export const logout: string = `${authentication}?logout=true&retUrl=${encodeURIComponent('https://' + window.location.host)}/self-service`
10+
export const logout: string = `${authentication}?logout=true&retUrl=${encodeURIComponent('https://' + window.location.host)}${routeSelfServiceRoot}`
1011

1112
export function signup(fallback: string): string {
1213
return `${login(fallback)}&regSource=tcBusiness&mode=signUp`

src-ts/lib/portal/Portal.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { createPortal } from 'react-dom'
33

44
interface PortalProps {
55
children: ReactNode
6+
className?: string,
67
portalId?: string
78
portalNode?: HTMLElement
89
portalRef?: MutableRefObject<HTMLElement>,
@@ -13,6 +14,7 @@ const Portal: FC<PortalProps> = (
1314
portalId,
1415
portalNode,
1516
children,
17+
className,
1618
portalRef,
1719
}: PortalProps) => {
1820

@@ -26,9 +28,12 @@ const Portal: FC<PortalProps> = (
2628
}
2729

2830
const backupHtmlNode: HTMLElement = document.createElement('div')
31+
if (className) {
32+
backupHtmlNode.classList.add(className)
33+
}
2934
document.body.appendChild(backupHtmlNode)
3035
return backupHtmlNode
31-
}, [portalNode]) as HTMLElement
36+
}, [portalNode, className]) as HTMLElement
3237

3338
useEffect(() => {
3439
return () => {
@@ -41,6 +46,7 @@ const Portal: FC<PortalProps> = (
4146
if (portalRef) {
4247
portalRef.current = portalNode ?? defaultPortalNode
4348
}
49+
4450
return createPortal(children, portalNode ?? defaultPortalNode)
4551
}
4652

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
export const routeRoot: string = '/work/dashboard'
2+
export const routeSelfServiceRoot: string = '/self-service'
3+
export const routeSelfServiceStart: string = `${routeSelfServiceRoot}/wizard`
24

35
export function routeIsActive(activePath: string, pathName: string, rootPath?: string): boolean {
4-
return activePath?.startsWith(pathName)
5-
&& (pathName !== rootPath || activePath === rootPath)
6+
let isActive: boolean = isActivePath(activePath, pathName, rootPath)
7+
8+
// temporarilily, if the path we're testing against is the work tool
9+
// also check if the current path is self-service
10+
if (!isActive && pathName.startsWith(routeRoot)) {
11+
isActive = isActivePath(activePath, routeSelfServiceRoot)
12+
}
13+
14+
return isActive
615
}
716

817
export function routeIsHome(activePath: string): boolean {
918
// TODO: make the alternate home route configurable
10-
return [routeRoot, '/self-service'].some(route => activePath === route)
19+
return [routeRoot, routeSelfServiceRoot].some(route => activePath === route)
20+
}
21+
22+
export function routeWorkDetails(workId: string): string {
23+
return `${routeSelfServiceRoot}/work-items/${workId}`
24+
}
25+
26+
function isActivePath(activePath: string, pathName: string, rootPath?: string): boolean {
27+
return activePath?.startsWith(pathName)
28+
&& (pathName !== rootPath || activePath === rootPath)
1129
}

src-ts/lib/styles/variables/_palette.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ $blue-100: #2C95D7;
118118
$blue-75: #50ADE8;
119119
$blue-50: #83C5EE;
120120
$blue-25: #BAE1F9;
121-
$blue-15: #EAF6FD;
121+
$blue-15: #D6EDFC;
122+
$blue-10: #EAF6FD;
122123
// dark
123124
$blue-120: #2984BD;
124125
$blue-140: #16679A;

src-ts/lib/svgs/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { ReactComponent as SocialIconLinkedin } from './social-linkedin-icon.svg
1010
import { ReactComponent as SocialIconTwitter } from './social-tw-icon.svg'
1111
import { ReactComponent as SocialIconYoutube } from './social-yt-icon.svg'
1212
import { ReactComponent as TooltipArrowIcon } from './tooltip-arrow.svg'
13-
import { ReactComponent as WorkTypeDataExplorationIcon } from './work-type-data-exploration.svg'
14-
import { ReactComponent as WorkTypeUnknownIcon } from './work-type-unknown.svg'
15-
import { ReactComponent as WorkTypeWebsiteDesignIcon } from './work-type-website-design.svg'
13+
import { ReactComponent as WorkTypeCategoryDataIcon } from './work-type-category-data.svg'
14+
import { ReactComponent as WorkTypeCategoryDesignIcon } from './work-type-category-design.svg'
15+
import { ReactComponent as WorkTypeCategoryUnknownIcon } from './work-type-category-unknown.svg'
1616

1717
export { ActiveTabTipIcon }
1818
export { IconOutline }
@@ -24,6 +24,6 @@ export { SocialIconLinkedin }
2424
export { SocialIconTwitter }
2525
export { SocialIconYoutube }
2626
export { TooltipArrowIcon }
27-
export { WorkTypeDataExplorationIcon }
28-
export { WorkTypeUnknownIcon }
29-
export { WorkTypeWebsiteDesignIcon }
27+
export { WorkTypeCategoryDataIcon }
28+
export { WorkTypeCategoryDesignIcon }
29+
export { WorkTypeCategoryUnknownIcon }

0 commit comments

Comments
 (0)