-
Notifications
You must be signed in to change notification settings - Fork 15
[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
Conversation
fix(PM-1448): implemented client side infinite scroll
fix(PM-1468): make notes mandatory
fix(PM-1322): Redirect to requests page once copilot request is created
fix(PM-1448, PM-1322, PM-1468): QA feedbacks
fix(PM-1470): show applications count in tab
fix(PM-1469): added hover actions for application icons
@@ -50,7 +50,7 @@ const ApplyOpportunityModal: FC<ApplyOpportunityModalProps> = props => { | |||
buttons={ | |||
!success ? ( | |||
<> | |||
<Button primary onClick={onApply} label='Apply' /> | |||
<Button disabled={!notes?.trim()} primary onClick={onApply} label='Apply' /> |
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 on notes?.trim()
. Ensure that notes
is properly initialized and defined in the component to avoid potential runtime errors if notes
is undefined
or null
.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
The function getCopilotDetailsTabsConfig
now takes an additional parameter copilotApplications?.length || 0
. Ensure that this function is updated to handle the new parameter correctly and that it does not break existing functionality. Verify that the logic inside getCopilotDetailsTabsConfig
properly utilizes this parameter.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
The function getCopilotDetailsTabsConfig
now takes an additional parameter count
, but there is no validation or default value handling for this parameter. Consider adding validation to ensure count
is a non-negative integer.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding useNavigate
to the list of hooks used in this component, if not already done, to ensure consistency and clarity in the usage of hooks.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Consider specifying a more precise type for formValues
instead of using any
to improve type safety and maintainability.
@@ -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 comment
The 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.
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 comment
The 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.
const fullHeight = document.body.scrollHeight | ||
const footerElem = document.getElementById('footer-nav-el') | ||
const footerHeight = (footerElem && footerElem.offsetHeight) || 650 | ||
if (scrollY + visibleHeight >= fullHeight - (footerHeight + 100)) { |
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 condition scrollY + visibleHeight >= fullHeight - (footerHeight + 100)
could be extracted into a well-named variable for better readability and maintainability.
if (scrollY + visibleHeight >= fullHeight - (footerHeight + 100)) { | ||
// 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a check to ensure itemsPerPage
is not zero to prevent potential division by zero errors when calculating maxPages
.
Related JIRA Ticket:
https://topcoder.atlassian.net/browse/PM-1466
https://topcoder.atlassian.net/browse/PM-1448
What's in this PR?
Feedback updates and fixes for the Copilot Portal.