-
Notifications
You must be signed in to change notification settings - Fork 16
[PROD RELEASE] - Copilot Portal fixes #1137
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
8d20c30
258c6da
2df6c37
a818130
51634fb
fa09b18
9f88d4a
3c10762
fd517ed
e621c94
d565783
75aa8cb
248914c
d67e5ae
f4cee24
80720e7
4da42fa
bcf7098
429f44b
1bc239f
bb10a8f
01975d5
1d6825c
e929c29
343ff82
b546384
53accf4
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 |
---|---|---|
|
@@ -261,7 +261,7 @@ const CopilotOpportunityDetails: FC<{}> = () => { | |
<TabsNavbar | ||
defaultActive={activeTab} | ||
onChange={handleTabChange} | ||
tabs={getCopilotDetailsTabsConfig(isAdminOrPM)} | ||
tabs={getCopilotDetailsTabsConfig(isAdminOrPM, copilotApplications?.length || 0)} | ||
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. The function |
||
/> | ||
) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,16 @@ export enum CopilotDetailsTabViews { | |
applications = '1', | ||
} | ||
|
||
export const getCopilotDetailsTabsConfig = (isAdminOrPM: boolean): TabsNavItem[] => (isAdminOrPM ? [ | ||
export const getCopilotDetailsTabsConfig = (isAdminOrPM: boolean, count: number): TabsNavItem[] => (isAdminOrPM ? [ | ||
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. The function |
||
{ | ||
id: CopilotDetailsTabViews.details, | ||
title: 'Details', | ||
}, | ||
{ | ||
badges: [{ | ||
count, | ||
type: 'info', | ||
}], | ||
id: CopilotDetailsTabViews.applications, | ||
title: 'Applications', | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { FC, useContext, useMemo, useState } from 'react' | ||
import { bind, debounce, isEmpty } from 'lodash' | ||
import { toast } from 'react-toastify' | ||
import { useNavigate } from 'react-router-dom' | ||
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. Consider adding |
||
import classNames from 'classnames' | ||
|
||
import { profileContext, ProfileContextData } from '~/libs/core' | ||
|
@@ -16,6 +17,7 @@ import styles from './styles.module.scss' | |
// eslint-disable-next-line | ||
const CopilotRequestForm: FC<{}> = () => { | ||
const { profile }: ProfileContextData = useContext(profileContext) | ||
const navigate = useNavigate() | ||
|
||
const [formValues, setFormValues] = useState<any>({}) | ||
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. Consider specifying a more precise type for |
||
const [isFormChanged, setIsFormChanged] = useState(false) | ||
|
@@ -217,6 +219,10 @@ const CopilotRequestForm: FC<{}> = () => { | |
setIsFormChanged(false) | ||
setFormErrors({}) | ||
setPaymentType('') | ||
// Added a small timeout for the toast to be visible properly to the users | ||
setTimeout(() => { | ||
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. Consider extracting the timeout duration (1000 ms) into a constant with a descriptive name to improve code readability and maintainability. |
||
navigate('/requests') | ||
}, 1000) | ||
}) | ||
.catch(e => { | ||
toast.error(e.message) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { FC, useCallback, useState } from 'react' | ||
import { FC, useCallback, useEffect, useState } from 'react' | ||
import classNames from 'classnames' | ||
|
||
import { Button, ContentLayout, LinkButton, LoadingCircles } from '~/libs/ui' | ||
|
@@ -17,6 +17,9 @@ import styles from './SearchResultsPage.module.scss' | |
const SearchResultsPage: FC = () => { | ||
const [showSkillsModal, setShowSkillsModal] = useState(false) | ||
|
||
const [currentPage, setCurrentPage] = useState(1) | ||
const itemsPerPage = 10 | ||
|
||
const [skills, setSkills] = useUrlQuerySearchParms('q') | ||
const { | ||
loading, | ||
|
@@ -25,6 +28,27 @@ const SearchResultsPage: FC = () => { | |
hasNext, | ||
total, | ||
}: InfiniteTalentMatchesResposne = useInfiniteTalentMatches(skills) | ||
const paginatedMatches = matches.slice(0, currentPage * itemsPerPage) | ||
|
||
useEffect(() => { | ||
const handleScroll: () => void = () => { | ||
const scrollY = window.scrollY | ||
const visibleHeight = window.innerHeight | ||
const fullHeight = document.body.scrollHeight | ||
const footerElem = document.getElementById('footer-nav-el') | ||
const footerHeight = (footerElem && footerElem.offsetHeight) || 650 | ||
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. Consider using a more reliable method to get the footer height, as relying on a default value of 650 may not be accurate across different screen sizes or if the footer content changes. |
||
if (scrollY + visibleHeight >= fullHeight - (footerHeight + 100)) { | ||
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. The condition |
||
// Scroll near bottom | ||
setCurrentPage(prev => { | ||
const maxPages = Math.ceil(matches.length / itemsPerPage) | ||
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. Consider adding a check to ensure |
||
return prev < maxPages ? prev + 1 : prev | ||
}) | ||
} | ||
} | ||
|
||
window.addEventListener('scroll', handleScroll) | ||
return () => window.removeEventListener('scroll', handleScroll) | ||
}, [matches]) | ||
|
||
const toggleSkillsModal = useCallback(() => setShowSkillsModal(s => !s), []) | ||
|
||
|
@@ -100,7 +124,7 @@ const SearchResultsPage: FC = () => { | |
)} | ||
</div> | ||
<div className={styles.resultsWrap}> | ||
{matches.map(member => ( | ||
{paginatedMatches.map(member => ( | ||
<TalentCard | ||
queriedSkills={skills} | ||
member={member} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
disabled
attribute is conditionally set based onnotes?.trim()
. Ensure thatnotes
is properly initialized and defined in the component to avoid potential runtime errors ifnotes
isundefined
ornull
.