Skip to content

Commit b5e582b

Browse files
committed
TAL - import profiles page into talent search app, render as new route, move shared swr config to @shared library
1 parent 1be6ad5 commit b5e582b

File tree

14 files changed

+45
-13
lines changed

14 files changed

+45
-13
lines changed

craco.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = {
4242
'@devCenter': resolve('src/apps/dev-center/src'),
4343
'@gamificationAdmin': resolve('src/apps/gamification-admin/src'),
4444
'@talentSearch': resolve('src/apps/talent-search/src'),
45+
'@profiles': resolve('src/apps/profiles/src'),
4546

4647
'@platform': resolve('src/apps/platform/src'),
4748
// aliases used in SCSS files

src/apps/profiles/src/ProfilesApp.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ import { FC, useContext } from 'react'
22
import { Outlet, Routes } from 'react-router-dom'
33

44
import { routerContext, RouterContextData } from '~/libs/core'
5+
import { SharedSwrConfig } from '~/libs/shared'
56

67
import { toolTitle } from './profiles.routes'
7-
import { ProfileSwr } from './lib'
88

99
const ProfilesApp: FC<{}> = () => {
1010
const { getChildRoutes }: RouterContextData = useContext(routerContext)
1111

1212
return (
13-
<ProfileSwr>
13+
<SharedSwrConfig>
1414
<Outlet />
1515
<Routes>
1616
{getChildRoutes(toolTitle)}
1717
</Routes>
18-
</ProfileSwr>
18+
</SharedSwrConfig>
1919
)
2020
}
2121

src/apps/profiles/src/lib/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export * from './profile-swr'
21
export * from './helpers'

src/apps/profiles/src/lib/profile-swr/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/apps/talent-search/src/TalentSearchApp.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { FC, useContext } from 'react'
22
import { Outlet, Routes } from 'react-router-dom'
33

44
import { routerContext, RouterContextData } from '~/libs/core'
5+
import { SharedSwrConfig } from '~/libs/shared'
56

67
import { toolTitle } from './talent-search.routes'
78

@@ -10,12 +11,12 @@ const TalentSearchApp: FC<{}> = () => {
1011
const { getChildRoutes }: RouterContextData = useContext(routerContext)
1112

1213
return (
13-
<>
14+
<SharedSwrConfig>
1415
<Outlet />
1516
<Routes>
1617
{getChildRoutes(toolTitle)}
1718
</Routes>
18-
</>
19+
</SharedSwrConfig>
1920
)
2021
}
2122

src/apps/talent-search/src/components/talent-card/TalentCard.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { CSSProperties, FC } from 'react'
22
import { orderBy } from 'lodash'
3+
import { Link } from 'react-router-dom'
34
import codes from 'country-calling-code'
45

56
import { IconSolid } from '~/libs/ui'
@@ -8,6 +9,7 @@ import { EmsiSkill, isSkillVerified } from '~/libs/shared'
89
import { MatchBar } from '../match-bar'
910
import { SkillPill } from '../skill-pill'
1011
import { Member } from '../../lib/models'
12+
import { TALENT_SEARCH_PATHS } from '../../talent-search.routes'
1113

1214
import styles from './TalentCard.module.scss'
1315

@@ -27,13 +29,19 @@ interface TalentCardProps {
2729
}
2830

2931
const TalentCard: FC<TalentCardProps> = props => {
30-
const visibleSkills = orderBy(props.member.emsiSkills, [props.isMatchingSkill, isSkillVerified], ['desc', 'desc'])
32+
const talentRoute = `${TALENT_SEARCH_PATHS.talent}/${props.member.handle}`
33+
34+
const visibleSkills = orderBy(
35+
props.member.emsiSkills,
36+
[props.isMatchingSkill, isSkillVerified],
37+
['desc', 'desc'],
38+
)
3139
.slice(0, 6) as EmsiSkill[]
3240

3341
const hiddenSkills = props.member.emsiSkills.length - visibleSkills.length
3442

3543
return (
36-
<div className={styles.wrap}>
44+
<Link to={talentRoute} className={styles.wrap}>
3745
<div
3846
className={styles.profilePic}
3947
style={{ '--background-image-url': `url(${props.member.photoURL})` } as CSSProperties}
@@ -83,7 +91,7 @@ const TalentCard: FC<TalentCardProps> = props => {
8391
)}
8492
</div>
8593
</div>
86-
</div>
94+
</Link>
8795
)
8896
}
8997

src/apps/talent-search/src/routes/talent-page/TalentPage.module.scss

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { FC } from 'react'
2+
3+
import { MemberProfilePage } from '@profiles/member-profile'
4+
5+
const TalentPage: FC = () => (
6+
<MemberProfilePage />
7+
)
8+
9+
export default TalentPage
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as TalentPage } from './TalentPage'

src/apps/talent-search/src/talent-search.routes.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ const SearchResultsPage: LazyLoadedComponent = lazyLoad(
99
() => import('./routes/search-results-page'),
1010
'SearchResultsPage',
1111
)
12+
const TalentPage: LazyLoadedComponent = lazyLoad(
13+
() => import('./routes/talent-page'),
14+
'TalentPage',
15+
)
1216

1317
export const rootRoute: string = (
1418
EnvironmentConfig.SUBDOMAIN === AppSubdomain.talentSearch ? '' : `/${AppSubdomain.talentSearch}`
@@ -17,6 +21,7 @@ export const rootRoute: string = (
1721
export const TALENT_SEARCH_PATHS = {
1822
results: `${rootRoute}/results`,
1923
root: rootRoute,
24+
talent: `${rootRoute}/talent`,
2025
}
2126

2227
export const toolTitle: string = ToolTitle.talentSearch
@@ -33,6 +38,10 @@ export const talentSearchRoutes: ReadonlyArray<PlatformRoute> = [
3338
element: <SearchResultsPage />,
3439
route: '/results',
3540
},
41+
{
42+
element: <TalentPage />,
43+
route: '/talent/:memberHandle',
44+
},
3645
],
3746
domain: AppSubdomain.talentSearch,
3847
element: <TalentSearchAppRoot />,

src/libs/shared/lib/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ export * from './components'
22
export * from './containers'
33
export * from './hooks'
44
export * from './services'
5+
export * from './swr-config'
56
export * from './utils'

src/apps/profiles/src/lib/profile-swr/ProfileSwr.tsx renamed to src/libs/shared/lib/swr-config/SwrConfig.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { SWRConfig } from 'swr'
33

44
import { xhrGetAsync } from '~/libs/core'
55

6-
interface ProfileSwrProps {
6+
interface SwrConfigProps {
77
children: ReactNode
88
}
99

10-
const ProfileSwr: FC<ProfileSwrProps> = (props: ProfileSwrProps) => (
10+
const SwrConfig: FC<SwrConfigProps> = (props: SwrConfigProps) => (
1111
<SWRConfig
1212
value={{
1313
fetcher: resource => xhrGetAsync(resource),
@@ -20,4 +20,4 @@ const ProfileSwr: FC<ProfileSwrProps> = (props: ProfileSwrProps) => (
2020
</SWRConfig>
2121
)
2222

23-
export default ProfileSwr
23+
export default SwrConfig
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as SharedSwrConfig } from './SwrConfig'

tsconfig.paths.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
"@talentSearch/*": [
2525
"./src/apps/talent-search/src/*"
2626
],
27+
"@profiles/*": [
28+
"./src/apps/profiles/src/*"
29+
],
2730
"@libs/ui/styles/*": [
2831
"./src/libs/ui/lib/styles/*"
2932
]

0 commit comments

Comments
 (0)