Skip to content

Commit 4d43439

Browse files
committed
TAL - update search results page
1 parent 8eb1a9d commit 4d43439

File tree

14 files changed

+161
-41
lines changed

14 files changed

+161
-41
lines changed
27.4 KB
Loading
-308 KB
Binary file not shown.
18.7 KB
Loading

src/apps/talent-search/src/components/talent-card/TalentCard.module.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
content: "";
3535
display: block;
3636
position: absolute;
37-
top: 0;
38-
left: 0;
37+
top: -10%;
38+
left: -10%;
3939
z-index: -1;
40-
width: 100%;
41-
height: 100%;
40+
width: 120%;
41+
height: 120%;
4242
background-image: var(--background-image-url);
4343
background-position: center;
4444
background-size: cover;

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

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

45
import { IconSolid } from '~/libs/ui'
5-
import { EmsiSkill } from '~/libs/shared'
6+
import { EmsiSkill, isSkillVerified } from '~/libs/shared'
67

78
import { MatchBar } from '../match-bar'
89
import { SkillPill } from '../skill-pill'
910
import { Member } from '../../lib/models'
1011

1112
import styles from './TalentCard.module.scss'
1213

14+
const getCountry = (countryCode: string): string => (
15+
codes.find(c => c.isoCode3 === countryCode || c.isoCode2 === countryCode)?.country ?? countryCode ?? ''
16+
)
17+
18+
const getAddrString = (city: string, country: string): string => (
19+
[city, country].filter(Boolean)
20+
.join(', ')
21+
)
22+
1323
interface TalentCardProps {
1424
isMatchingSkill: (skill: EmsiSkill) => boolean
1525
member: Member
1626
match?: number
1727
}
1828

1929
const TalentCard: FC<TalentCardProps> = props => {
20-
const visibleSkills = orderBy(props.member.emsiSkills, props.isMatchingSkill, 'desc')
30+
const visibleSkills = orderBy(props.member.emsiSkills, [props.isMatchingSkill, isSkillVerified], ['desc', 'desc'])
2131
.slice(0, 6) as EmsiSkill[]
2232

2333
const hiddenSkills = props.member.emsiSkills.length - visibleSkills.length
@@ -53,7 +63,7 @@ const TalentCard: FC<TalentCardProps> = props => {
5363
>
5464
<IconSolid.LocationMarkerIcon className='icon-xxl' />
5565
<span className='body-main'>
56-
{`${addr.city}, ${addr.stateCode}`}
66+
{getAddrString(addr.city, getCountry(props.member.homeCountryCode))}
5767
</span>
5868
</div>
5969
))}
@@ -63,9 +73,9 @@ const TalentCard: FC<TalentCardProps> = props => {
6373
{visibleSkills.map(skill => (
6474
<SkillPill
6575
key={skill.skillId}
66-
theme='dark'
76+
theme={props.isMatchingSkill(skill) ? 'verified' : 'dark'}
6777
skill={skill}
68-
verified={props.isMatchingSkill(skill)}
78+
verified={isSkillVerified(skill)}
6979
/>
7080
))}
7181
{hiddenSkills > 0 && (

src/apps/talent-search/src/lib/models/Skill.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/apps/talent-search/src/lib/models/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ export type { default as Member } from './Member'
22
export type { default as MemberEmsiSkill } from './MemberEmsiSkill'
33
export type { default as MemberMaxRating } from './MemberMaxRating'
44
export type { default as MemberStats } from './MemberStats'
5-
export type { default as Skill } from './Skill'
Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1+
import { uniqBy } from 'lodash'
2+
import { useEffect, useState } from 'react'
13
import useSWR, { SWRResponse } from 'swr'
24

35
import { EnvironmentConfig } from '~/config'
4-
import { xhrGetAsync } from '~/libs/core'
6+
import { PaginatedResponse, xhrGetPaginatedAsync } from '~/libs/core'
57
import { Skill } from '~/libs/shared'
68
import Member from '@talentSearch/lib/models/Member'
79

8-
export interface TalenMatchesResponse {
10+
export interface TalentMatchesResponse {
911
error: boolean,
1012
loading: boolean,
1113
matches: Member[],
14+
page: number,
1215
ready: boolean,
16+
total: number,
17+
totalPages: number,
1318
}
1419

15-
export function useFetchTalenMatches(
20+
export function useFetchTalentMatches(
1621
skills: ReadonlyArray<Skill>,
1722
page: number,
1823
pageSize: number,
19-
): TalenMatchesResponse {
24+
): TalentMatchesResponse {
2025
const searchParams = [
2126
...skills.map(s => `skillId=${s.emsiId}`),
2227
'sortBy=skillScore',
@@ -26,14 +31,56 @@ export function useFetchTalenMatches(
2631

2732
const url = `${EnvironmentConfig.API.V5}/members/searchBySkills?${searchParams}`
2833

29-
const { data, error }: SWRResponse = useSWR(url, xhrGetAsync, {
34+
const { data, error }: SWRResponse<PaginatedResponse<Member[]>> = useSWR(url, xhrGetPaginatedAsync<Member[]>, {
3035
isPaused: () => !skills?.length,
36+
refreshInterval: 0,
37+
revalidateOnFocus: false,
3138
})
3239

40+
const matches = data?.data
41+
3342
return {
3443
error: !!error,
35-
loading: !data,
36-
matches: data ?? [],
37-
ready: !!data,
44+
loading: !matches,
45+
matches: matches ?? [],
46+
page: data?.page ?? 0,
47+
ready: !!matches,
48+
total: data?.total ?? 0,
49+
totalPages: data?.totalPages ?? 0,
50+
}
51+
}
52+
53+
export interface InfiniteTalentMatchesResposne {
54+
fetchNext: () => void
55+
hasNext: boolean
56+
matches: Member[]
57+
page: number
58+
loading: boolean
59+
total: number
60+
}
61+
62+
export function useInfiniteTalentMatches(
63+
skills: ReadonlyArray<Skill>,
64+
pageSize: number = 10,
65+
): InfiniteTalentMatchesResposne {
66+
const [matches, setMatches] = useState([] as Member[])
67+
const [page, setPage] = useState(1)
68+
const matchResponse = useFetchTalentMatches(skills, page, pageSize)
69+
70+
function fetchNext(): void {
71+
setPage(p => p + 1)
72+
}
73+
74+
useEffect(() => {
75+
setMatches(m => uniqBy([...m, ...matchResponse.matches], 'userId'))
76+
}, [matchResponse.matches])
77+
78+
return {
79+
fetchNext,
80+
hasNext: matchResponse.page < matchResponse.totalPages,
81+
loading: matchResponse.loading,
82+
matches,
83+
page,
84+
total: matchResponse.total,
3885
}
3986
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import "@libs/ui/styles/includes";
22

33
.contentLayout {
4-
background-image: url("../../assets/background.png");
4+
background-image: url("../../assets/background.webp");
55
background-size: cover;
66
background-repeat: no-repeat;
77
}

src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.module.scss

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66

77
.headerContentLayout {
88
height: 100%;
9-
background-image: url("../../assets/background.png");
9+
background-image: url("../../assets/background.jpg");
1010
background-size: cover;
1111
background-repeat: no-repeat;
12-
padding: 0 $sp-8;
12+
position: relative;
13+
z-index: 2;
14+
15+
&Inner {
16+
padding: 0 $sp-8;
17+
}
1318
}
1419

1520
.summaryText {
@@ -29,6 +34,11 @@
2934
background: $black-5;
3035
padding: $sp-2;
3136
position: relative;
37+
z-index: 1;
38+
39+
.contentLayout-inner {
40+
padding-bottom: $sp-12;
41+
}
3242
}
3343

3444
.resultsWrap {
@@ -37,3 +47,8 @@
3747
gap: $sp-9;
3848
}
3949

50+
.moreBtn {
51+
margin-top: $sp-8;
52+
display: flex;
53+
justify-content: center;
54+
}

0 commit comments

Comments
 (0)