Skip to content

[PROD RELEASE] - Copilot Portal fixes#1137

Merged
kkartunov merged 27 commits intomasterfrom
dev
Jul 15, 2025
Merged

[PROD RELEASE] - Copilot Portal fixes#1137
kkartunov merged 27 commits intomasterfrom
dev

Conversation

@kkartunov
Copy link
Collaborator

@kkartunov kkartunov commented Jul 15, 2025

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.

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
!success ? (
<>
<Button primary onClick={onApply} label='Apply' />
<Button disabled={!notes?.trim()} primary onClick={onApply} label='Apply' />

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.

defaultActive={activeTab}
onChange={handleTabChange}
tabs={getCopilotDetailsTabsConfig(isAdminOrPM)}
tabs={getCopilotDetailsTabsConfig(isAdminOrPM, copilotApplications?.length || 0)}

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.

}

export const getCopilotDetailsTabsConfig = (isAdminOrPM: boolean): TabsNavItem[] => (isAdminOrPM ? [
export const getCopilotDetailsTabsConfig = (isAdminOrPM: boolean, count: number): TabsNavItem[] => (isAdminOrPM ? [

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.

import { FC, useContext, useMemo, useState } from 'react'
import { bind, debounce, isEmpty } from 'lodash'
import { toast } from 'react-toastify'
import { useNavigate } from 'react-router-dom'

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.

const { profile }: ProfileContextData = useContext(profileContext)
const navigate = useNavigate()

const [formValues, setFormValues] = useState<any>({})

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.

setFormErrors({})
setPaymentType('')
// Added a small timeout for the toast to be visible properly to the users
setTimeout(() => {

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

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)) {

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)

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.

@kkartunov kkartunov merged commit 7d2c9f9 into master Jul 15, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants