Skip to content

Commit 7d2c9f9

Browse files
authored
Merge pull request #1137 from topcoder-platform/dev
[PROD RELEASE] - Copilot Portal fixes
2 parents aeaded4 + 53accf4 commit 7d2c9f9

File tree

8 files changed

+48
-10
lines changed

8 files changed

+48
-10
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ workflows:
222222
- LVT-256
223223
- CORE-635
224224
- feat/system-admin
225-
- pm-1464
225+
- pm-1448_1
226226

227227
- deployQa:
228228
context: org-global

src/apps/copilots/src/pages/copilot-opportunity-details/apply-opportunity-modal/ApplyOpportunityModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const ApplyOpportunityModal: FC<ApplyOpportunityModalProps> = props => {
5050
buttons={
5151
!success ? (
5252
<>
53-
<Button primary onClick={onApply} label='Apply' />
53+
<Button disabled={!notes?.trim()} primary onClick={onApply} label='Apply' />
5454
<Button secondary onClick={props.onClose} label='Cancel' />
5555
</>
5656
) : (

src/apps/copilots/src/pages/copilot-opportunity-details/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ const CopilotOpportunityDetails: FC<{}> = () => {
261261
<TabsNavbar
262262
defaultActive={activeTab}
263263
onChange={handleTabChange}
264-
tabs={getCopilotDetailsTabsConfig(isAdminOrPM)}
264+
tabs={getCopilotDetailsTabsConfig(isAdminOrPM, copilotApplications?.length || 0)}
265265
/>
266266
)
267267
}

src/apps/copilots/src/pages/copilot-opportunity-details/tabs/config/copilot-details-tabs-config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ export enum CopilotDetailsTabViews {
55
applications = '1',
66
}
77

8-
export const getCopilotDetailsTabsConfig = (isAdminOrPM: boolean): TabsNavItem[] => (isAdminOrPM ? [
8+
export const getCopilotDetailsTabsConfig = (isAdminOrPM: boolean, count: number): TabsNavItem[] => (isAdminOrPM ? [
99
{
1010
id: CopilotDetailsTabViews.details,
1111
title: 'Details',
1212
},
1313
{
14+
badges: [{
15+
count,
16+
type: 'info',
17+
}],
1418
id: CopilotDetailsTabViews.applications,
1519
title: 'Applications',
1620
},

src/apps/copilots/src/pages/copilot-opportunity-details/tabs/copilot-applications/CopilotApplicationAction.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,17 @@ const CopilotApplicationAction = (
5454
!isInvited
5555
&& copilotApplication.status === CopilotApplicationStatus.PENDING
5656
&& copilotApplication.opportunityStatus === 'active' && (
57-
<IconSolid.UserAddIcon />
57+
<Tooltip content='Send Invitation'>
58+
<IconSolid.UserAddIcon />
59+
</Tooltip>
5860
)
5961
}
6062

6163
{
6264
copilotApplication.status === CopilotApplicationStatus.ACCEPTED && (
63-
<IconSolid.BadgeCheckIcon />
65+
<Tooltip content='Application Accepted'>
66+
<IconSolid.BadgeCheckIcon />
67+
</Tooltip>
6468
)
6569
}
6670
</div>

src/apps/copilots/src/pages/copilot-request-form/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { FC, useContext, useMemo, useState } from 'react'
22
import { bind, debounce, isEmpty } from 'lodash'
33
import { toast } from 'react-toastify'
4+
import { useNavigate } from 'react-router-dom'
45
import classNames from 'classnames'
56

67
import { profileContext, ProfileContextData } from '~/libs/core'
@@ -16,6 +17,7 @@ import styles from './styles.module.scss'
1617
// eslint-disable-next-line
1718
const CopilotRequestForm: FC<{}> = () => {
1819
const { profile }: ProfileContextData = useContext(profileContext)
20+
const navigate = useNavigate()
1921

2022
const [formValues, setFormValues] = useState<any>({})
2123
const [isFormChanged, setIsFormChanged] = useState(false)
@@ -217,6 +219,10 @@ const CopilotRequestForm: FC<{}> = () => {
217219
setIsFormChanged(false)
218220
setFormErrors({})
219221
setPaymentType('')
222+
// Added a small timeout for the toast to be visible properly to the users
223+
setTimeout(() => {
224+
navigate('/requests')
225+
}, 1000)
220226
})
221227
.catch(e => {
222228
toast.error(e.message)

src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FC, useCallback, useState } from 'react'
1+
import { FC, useCallback, useEffect, useState } from 'react'
22
import classNames from 'classnames'
33

44
import { Button, ContentLayout, LinkButton, LoadingCircles } from '~/libs/ui'
@@ -17,6 +17,9 @@ import styles from './SearchResultsPage.module.scss'
1717
const SearchResultsPage: FC = () => {
1818
const [showSkillsModal, setShowSkillsModal] = useState(false)
1919

20+
const [currentPage, setCurrentPage] = useState(1)
21+
const itemsPerPage = 10
22+
2023
const [skills, setSkills] = useUrlQuerySearchParms('q')
2124
const {
2225
loading,
@@ -25,6 +28,27 @@ const SearchResultsPage: FC = () => {
2528
hasNext,
2629
total,
2730
}: InfiniteTalentMatchesResposne = useInfiniteTalentMatches(skills)
31+
const paginatedMatches = matches.slice(0, currentPage * itemsPerPage)
32+
33+
useEffect(() => {
34+
const handleScroll: () => void = () => {
35+
const scrollY = window.scrollY
36+
const visibleHeight = window.innerHeight
37+
const fullHeight = document.body.scrollHeight
38+
const footerElem = document.getElementById('footer-nav-el')
39+
const footerHeight = (footerElem && footerElem.offsetHeight) || 650
40+
if (scrollY + visibleHeight >= fullHeight - (footerHeight + 100)) {
41+
// Scroll near bottom
42+
setCurrentPage(prev => {
43+
const maxPages = Math.ceil(matches.length / itemsPerPage)
44+
return prev < maxPages ? prev + 1 : prev
45+
})
46+
}
47+
}
48+
49+
window.addEventListener('scroll', handleScroll)
50+
return () => window.removeEventListener('scroll', handleScroll)
51+
}, [matches])
2852

2953
const toggleSkillsModal = useCallback(() => setShowSkillsModal(s => !s), [])
3054

@@ -100,7 +124,7 @@ const SearchResultsPage: FC = () => {
100124
)}
101125
</div>
102126
<div className={styles.resultsWrap}>
103-
{matches.map(member => (
127+
{paginatedMatches.map(member => (
104128
<TalentCard
105129
queriedSkills={skills}
106130
member={member}

src/libs/shared/lib/components/profile-picture/ProfilePicture.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ const ProfilePicture: FC<ProfilePictureProps> = props => {
2929
>
3030
{!loaded && (
3131
<span className={styles.profileInitials}>
32-
{props.member.firstName.slice(0, 1)}
33-
{props.member.lastName.slice(0, 1)}
32+
{props.member?.firstName?.slice(0, 1)}
33+
{props.member?.lastName?.slice(0, 1)}
3434
</span>
3535
)}
3636
{props.member.photoURL && !error && (

0 commit comments

Comments
 (0)