-
Notifications
You must be signed in to change notification settings - Fork 21
PM-3452 Customer Portal App skeleton #1410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from './src' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /** | ||
| * The customer portal app. | ||
| */ | ||
| import { FC, useContext, useEffect, useMemo } from 'react' | ||
| import { Outlet, Routes } from 'react-router-dom' | ||
|
|
||
| import { routerContext, RouterContextData } from '~/libs/core' | ||
|
|
||
| import { CustomerPortalAppContextProvider, Layout, SWRConfigProvider } from './lib' | ||
| import { toolTitle } from './customer-portal.routes' | ||
| import './lib/styles/index.scss' | ||
|
|
||
| const CustomerPortalApp: FC = () => { | ||
| const { getChildRoutes }: RouterContextData = useContext(routerContext) | ||
| const childRoutes = useMemo(() => getChildRoutes(toolTitle), [getChildRoutes]) | ||
himaniraghav3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| useEffect(() => { | ||
| document.body.classList.add('customer-portal-app') | ||
| return () => { | ||
| document.body.classList.remove('customer-portal-app') | ||
| } | ||
| }, []) | ||
|
|
||
| return ( | ||
| <CustomerPortalAppContextProvider> | ||
| <SWRConfigProvider> | ||
| <Layout> | ||
| <Outlet /> | ||
| <Routes>{childRoutes}</Routes> | ||
| </Layout> | ||
| </SWRConfigProvider> | ||
| </CustomerPortalAppContextProvider> | ||
|
|
||
| ) | ||
| } | ||
|
|
||
| export default CustomerPortalApp | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export const PRIVILEGED_ROLES = [ | ||
| 'administrator', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just how roles are configured in our system |
||
| 'Project Manager', | ||
| 'Talent Manager', | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * Common config for routes in Customer Portal app. | ||
| */ | ||
| import { AppSubdomain, EnvironmentConfig } from '~/config' | ||
himaniraghav3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export const rootRoute: string | ||
| = EnvironmentConfig.SUBDOMAIN === AppSubdomain.customer | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| ? '' | ||
| : `/${AppSubdomain.customer}` | ||
|
|
||
| export const talentSearchRouteId = 'talent-search' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /** | ||
| * App routes | ||
| */ | ||
| import { AppSubdomain, ToolTitle } from '~/config' | ||
| import { | ||
| lazyLoad, | ||
| LazyLoadedComponent, | ||
| PlatformRoute, | ||
| Rewrite, | ||
| } from '~/libs/core' | ||
|
|
||
| import { | ||
| rootRoute, | ||
| talentSearchRouteId, | ||
| } from './config/routes.config' | ||
| import { customerPortalTalentSearchRoutes } from './pages/talent-search/talent-search.routes' | ||
|
|
||
| const CustomerPortalApp: LazyLoadedComponent = lazyLoad(() => import('./CustomerPortalApp')) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| export const toolTitle: string = ToolTitle.customer | ||
|
|
||
| export const customerPortalRoutes: ReadonlyArray<PlatformRoute> = [ | ||
| // Customer portal App Root | ||
| { | ||
| children: [ | ||
| { | ||
| authRequired: true, | ||
| element: <Rewrite to={talentSearchRouteId} />, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| route: '', | ||
| }, | ||
| ...customerPortalTalentSearchRoutes, | ||
| ], | ||
| domain: AppSubdomain.customer, | ||
| element: <CustomerPortalApp />, | ||
| id: toolTitle, | ||
| route: rootRoute, | ||
| title: toolTitle, | ||
| }, | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { customerPortalRoutes } from './customer-portal.routes' | ||
| export { rootRoute as customerPortalRootRoute } from './config/routes.config' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { ReactComponent as IconFile } from './icon-file.svg' | ||
| import { ReactComponent as IconChevronDown } from './selector.svg' | ||
| import { ReactComponent as IconArrowLeft } from './arrow-left.svg' | ||
| import { ReactComponent as IconExternalLink } from './external-link.svg' | ||
|
|
||
| export { | ||
| IconFile, | ||
| IconChevronDown, | ||
| IconArrowLeft, | ||
| IconExternalLink, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| @import '@libs/ui/styles/includes'; | ||
himaniraghav3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| .breadcrumb { | ||
| padding-bottom: $sp-6; | ||
| ul { | ||
| align-items: center; | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| li { | ||
| font-size: 14px; | ||
| line-height: 20px; | ||
| white-space: nowrap; | ||
| button, | ||
| a { | ||
| font-family: "Nunito Sans", sans-serif; | ||
| color: var(--GrayFontColor); | ||
| align-items: center; | ||
| display: flex; | ||
| &::after { | ||
| color: var(--GrayFontColor); | ||
himaniraghav3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| content: '/'; | ||
| padding: 0 $sp-2; | ||
| } | ||
| } | ||
| span { | ||
| font-family: "Nunito Sans", sans-serif; | ||
| color: var(--FontColor); | ||
himaniraghav3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { FC } from 'react' | ||
| import { Link } from 'react-router-dom' | ||
|
|
||
| import { BreadCrumbData } from '../../models' | ||
| import { useAppNavigate } from '../../hooks' | ||
|
|
||
| import styles from './BreadCrumb.module.scss' | ||
|
|
||
| interface Props { | ||
| list: BreadCrumbData[] | ||
| } | ||
|
|
||
| export const BreadCrumb: FC<Props> = (props: Props) => { | ||
| const navigate = useAppNavigate() | ||
| return ( | ||
| <div className={styles.breadcrumb}> | ||
| <ul> | ||
| {props.list.map(item => ( | ||
| <li key={item.index}> | ||
himaniraghav3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| {item.path ? ( | ||
| item.fallback ? ( | ||
| <button | ||
| type='button' | ||
| onClick={function onClick() { | ||
| navigate(item.path as number, { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| fallback: item.fallback, | ||
| }) | ||
| }} | ||
| > | ||
| {item.label} | ||
| </button> | ||
| ) : ( | ||
| <Link to={item.path as string}> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| {item.label} | ||
| </Link> | ||
| ) | ||
| ) : ( | ||
| <span>{item.label}</span> | ||
| )} | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| export default BreadCrumb | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default as BreadCrumb } from './BreadCrumb' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| @import '@libs/ui/styles/includes'; | ||
|
|
||
| .layout { | ||
| position: relative; | ||
| font-family: $font-roboto; | ||
| color: var(--Primary); | ||
|
|
||
| .main { | ||
| @include ltelg { | ||
| padding: 36px 0; | ||
| } | ||
| } | ||
|
|
||
| h1, | ||
| h2, | ||
| h3, | ||
| h4 { | ||
| font-family: $font-roboto; | ||
| } | ||
| } | ||
|
|
||
| .contentLayoutOuter { | ||
| margin: $sp-6 auto !important; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| } | ||
|
|
||
| .contantentLayoutInner { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| box-sizing: border-box; | ||
| width: 100%; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { FC, PropsWithChildren } from 'react' | ||
|
|
||
| import { ContentLayout } from '~/libs/ui' | ||
|
|
||
| import { NavTabs } from '../NavTabs' | ||
|
|
||
| import styles from './Layout.module.scss' | ||
|
|
||
| export const NullLayout: FC<PropsWithChildren> = props => ( | ||
| <>{props.children}</> | ||
| ) | ||
|
|
||
| export const Layout: FC<PropsWithChildren> = props => ( | ||
| <> | ||
| <NavTabs /> | ||
| <ContentLayout | ||
| innerClass={styles.contantentLayoutInner} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| outerClass={styles.contentLayoutOuter} | ||
| > | ||
| <div className={styles.layout}> | ||
| <div className={styles.main}>{props.children}</div> | ||
| </div> | ||
| </ContentLayout> | ||
| </> | ||
| ) | ||
|
|
||
| export default Layout | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export * from './Layout' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| export { default as Layout } from './Layout' | ||
Uh oh!
There was an error while loading. Please reload this page.