Skip to content

Commit 475df25

Browse files
authored
Merge pull request #856 from topcoder-platform/release-hotfixes
Release hotfixes
2 parents eea2ed1 + c8327e2 commit 475df25

File tree

12 files changed

+54
-26
lines changed

12 files changed

+54
-26
lines changed

.environments/.env.prod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ REACT_APP_DATADOG_PUBLIC_TOKEN=puba0825671e469d16f940c5a30dc738f11
1414

1515
REACT_APP_MEMBER_VERIFY_LOOKER=3322
1616

17-
REACT_APP_SPRIG_ENV_ID=bUcousVQ0-yF
17+
REACT_APP_SPRIG_ENV_ID=a-IZBZ6-r7bU
1818

1919
# Filestack configuration for uploading Submissions
2020
REACT_APP_FILESTACK_API_KEY=

src/apps/profiles/src/lib/helpers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export function subTrackLabelToHumanName(label: string): string {
7171
return 'Development'
7272
case 'ARCHITECTURE':
7373
return 'Architecture'
74+
case 'UI_PROTOTYPE_COMPETITION':
75+
return 'UI Prototype Competition'
7476

7577
default: return label
7678
}

src/apps/profiles/src/member-profile/MemberProfilePage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const MemberProfilePage: FC<{}> = () => {
3131
if (routeParams.memberHandle) {
3232
profileGetPublicAsync(routeParams.memberHandle)
3333
.then(userProfile => {
34-
setProfile(userProfile)
34+
setProfile({ ...userProfile } as UserProfile)
3535
setProfileReady(true)
3636
})
3737
// TODO: NOT FOUND PAGE redirect/dispaly
@@ -41,7 +41,7 @@ const MemberProfilePage: FC<{}> = () => {
4141
const refreshProfile = useCallback((handle: string) => (
4242
profileGetPublicAsync(handle)
4343
.then(userProfile => {
44-
setProfile(userProfile)
44+
setProfile({ ...userProfile } as UserProfile)
4545
if (userProfile) {
4646
notifyUniNavi(userProfile)
4747
triggerSprigSurvey(userProfile)

src/apps/profiles/src/member-profile/education-and-certifications/EducationAndCertifications.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { EDIT_MODE_QUERY_PARAM, profileEditModes } from '../../config'
1515
import { AddButton, EditMemberPropertyBtn, EmptySection } from '../../components'
1616
import { MemberTCAInfo } from '../tca-info'
17-
import { notifyUniNavi, triggerSprigSurvey } from '../../lib'
17+
import { triggerSprigSurvey } from '../../lib'
1818

1919
import { ModifyEducationModal } from './ModifyEducationModal'
2020
import { EducationCard } from './EducationCard'
@@ -23,6 +23,7 @@ import styles from './EducationAndCertifications.module.scss'
2323
interface EducationAndCertificationsProps {
2424
profile: UserProfile
2525
authProfile: UserProfile | undefined
26+
refreshProfile: (handle: string) => void
2627
}
2728

2829
const EducationAndCertifications: FC<EducationAndCertificationsProps> = (props: EducationAndCertificationsProps) => {
@@ -70,7 +71,7 @@ const EducationAndCertifications: FC<EducationAndCertificationsProps> = (props:
7071
setTimeout(() => {
7172
setIsEditMode(false)
7273
mutateTraits()
73-
notifyUniNavi(props.profile)
74+
props.refreshProfile(props.profile.handle)
7475
triggerSprigSurvey(props.profile)
7576
}, 1000)
7677
}

src/apps/profiles/src/member-profile/page-layout/ProfilePageLayout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ interface ProfilePageLayoutProps {
2727
}
2828

2929
const ProfilePageLayout: FC<ProfilePageLayoutProps> = (props: ProfilePageLayoutProps) => (
30-
3130
<div className={styles.container}>
3231

3332
<PageTitle>{`${props.profile.handle} | Community Profile | Topcoder`}</PageTitle>
@@ -81,7 +80,7 @@ const ProfilePageLayout: FC<ProfilePageLayoutProps> = (props: ProfilePageLayoutP
8180
</div>
8281
<div className={styles.profileInfoRight}>
8382
{props.authProfile?.handle === props.profile.handle && (
84-
<ProfileCompleteness profile={props.authProfile} />
83+
<ProfileCompleteness profile={props.profile} authProfile={props.authProfile} />
8584
)}
8685
<div className={styles.sectionWrap}>
8786
<div className={styles.skillsWrap}>
@@ -101,13 +100,15 @@ const ProfilePageLayout: FC<ProfilePageLayoutProps> = (props: ProfilePageLayoutP
101100
<WorkExpirence
102101
profile={props.profile}
103102
authProfile={props.authProfile}
103+
refreshProfile={props.refreshProfile}
104104
/>
105105
</div>
106106
</div>
107107
<div className={styles.sectionWrap}>
108108
<EducationAndCertifications
109109
profile={props.profile}
110110
authProfile={props.authProfile}
111+
refreshProfile={props.refreshProfile}
111112
/>
112113
</div>
113114
</div>

src/apps/profiles/src/member-profile/profile-completeness/ProfileCompleteness.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
import { FC } from 'react'
1+
import { FC, useEffect } from 'react'
22

33
import { useProfileCompleteness, UserProfile } from '~/libs/core'
44

55
import styles from './ProfileCompleteness.module.scss'
66

77
interface ProfileCompletenessProps {
88
profile: UserProfile
9+
authProfile: UserProfile
910
}
1011

1112
const ProfileCompleteness: FC<ProfileCompletenessProps> = props => {
12-
const completed = useProfileCompleteness(props.profile.handle)
13-
const isLoading = completed === undefined
13+
const completeness = useProfileCompleteness(props.profile.handle)
14+
const completed = completeness.percent
15+
const isLoading = completeness.isLoading
1416
const isCompleted = completed === 100
1517

16-
const isCustomer = props.profile.roles.some(r => r.indexOf(' Customer') > -1)
18+
const isCustomer = props.authProfile.roles.some(r => r.indexOf(' Customer') > -1)
1719

1820
const hideCompletenessMeter = isLoading || isCompleted || isCustomer
1921

22+
useEffect(() => { completeness?.mutate() }, [props.profile])
23+
2024
return hideCompletenessMeter ? <></> : (
2125
<div className={styles.wrap}>
2226
<strong>Profile: </strong>

src/apps/profiles/src/member-profile/skills/MemberSkillsInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const MemberSkillsInfo: FC<MemberSkillsInfoProps> = (props: MemberSkillsInfoProp
8686
</div>
8787
<Button
8888
link
89-
label='How skills work?'
89+
label='How skills work'
9090
onClick={handleHowSkillsWorkClick}
9191
variant='linkblue'
9292
/>

src/apps/profiles/src/member-profile/work-expirence/WorkExpirence.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useSearchParams } from 'react-router-dom'
44
import { MemberTraitsAPI, useMemberTraits, UserProfile, UserTrait, UserTraitIds } from '~/libs/core'
55

66
import { EDIT_MODE_QUERY_PARAM, profileEditModes } from '../../config'
7-
import { notifyUniNavi, triggerSprigSurvey } from '../../lib'
7+
import { triggerSprigSurvey } from '../../lib'
88
import { AddButton, EditMemberPropertyBtn, EmptySection } from '../../components'
99

1010
import { ModifyWorkExpirenceModal } from './ModifyWorkExpirenceModal'
@@ -14,6 +14,7 @@ import styles from './WorkExpirence.module.scss'
1414
interface WorkExpirenceProps {
1515
profile: UserProfile
1616
authProfile: UserProfile | undefined
17+
refreshProfile: (handle: string) => void
1718
}
1819

1920
const WorkExpirence: FC<WorkExpirenceProps> = (props: WorkExpirenceProps) => {
@@ -50,7 +51,7 @@ const WorkExpirence: FC<WorkExpirenceProps> = (props: WorkExpirenceProps) => {
5051
setTimeout(() => {
5152
setIsEditMode(false)
5253
mutateTraits()
53-
notifyUniNavi(props.profile)
54+
props.refreshProfile(props.profile.handle)
5455
triggerSprigSurvey(props.profile)
5556
}, 1000)
5657
}

src/config/environments/default.env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const URLS = {
5454

5555
export const MEMBER_VERIFY_LOOKER = getReactEnv<number>('MEMBER_VERIFY_LOOKER', 3322)
5656

57-
export const ENABLE_TCA_CERT_MONETIZATION = getReactEnv<boolean>('ENABLE_TCA_CERT_MONETIZATION', false)
57+
export const ENABLE_TCA_CERT_MONETIZATION = false
5858
export const ENABLE_EMSI_SKILLS = getReactEnv<boolean>('ENABLE_EMSI_SKILLS', false)
5959

6060
export const TERMS_URL = 'https://www.topcoder-dev.com/challenges/terms/detail/317cd8f9-d66c-4f2a-8774-63c612d99cd4'
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
import useSWR, { SWRResponse } from 'swr'
1+
import useSWR, { KeyedMutator, SWRResponse } from 'swr'
22

33
import { getProfileUrl } from '../profile-functions'
44

5-
export function useProfileCompleteness(memberHandle?: string): number | undefined {
6-
const { data }: SWRResponse = useSWR(`${getProfileUrl(memberHandle ?? '')}/profileCompleteness`, {
5+
export function useProfileCompleteness(memberHandle?: string): {
6+
isLoading: boolean,
7+
mutate: KeyedMutator<any>,
8+
percent: number | undefined,
9+
} {
10+
const { data, mutate }: SWRResponse = useSWR(`${getProfileUrl(memberHandle ?? '')}/profileCompleteness`, {
711
isPaused: () => !memberHandle,
812
})
913

1014
const percentComplete = data?.data?.percentComplete
11-
return percentComplete === undefined ? percentComplete : (percentComplete ?? 0) * 100
15+
return {
16+
isLoading: percentComplete === undefined,
17+
mutate,
18+
percent: (percentComplete ?? 0) * 100,
19+
}
1220
}

src/libs/shared/lib/components/expandable-list/ExpandableList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const ExpandableList: FC<ExpandableListProps> = props => {
5454
return (
5555
<>
5656
{renderList()}
57-
{listCount >= props.visible && renderToggleBtn()}
57+
{listCount > props.visible && renderToggleBtn()}
5858
</>
5959
)
6060
}

src/libs/ui/lib/components/form/form-groups/form-input/input-select/InputSelect.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
MutableRefObject,
99
ReactNode,
1010
SetStateAction,
11+
useEffect,
1112
useRef,
1213
useState,
1314
} from 'react'
@@ -76,7 +77,11 @@ const InputSelect: FC<InputSelectProps> = (props: InputSelectProps) => {
7677
option ? option.label ?? option.value : ''
7778
)
7879

79-
const toggleMenu: () => void = () => setMenuIsVisible(wasVisible => !wasVisible)
80+
const toggleMenu = (toggle?: boolean): void => {
81+
setTimeout(setMenuIsVisible, 150, wasVisible => (
82+
typeof toggle === 'boolean' ? toggle : !wasVisible
83+
))
84+
}
8085

8186
const select: (option: InputSelectOption) => (event: MouseEvent<HTMLDivElement>) => void
8287
= (option: InputSelectOption) => (
@@ -87,32 +92,38 @@ const InputSelect: FC<InputSelectProps> = (props: InputSelectProps) => {
8792
props.onChange({
8893
target: { value: option.value },
8994
} as unknown as ChangeEvent<HTMLInputElement>)
90-
buttonRef.current?.focus() // this will close the dropdown menu
95+
toggleMenu(false)
9196
}
9297

9398
function toggleIfNotDisabled(event:
9499
MouseEvent<HTMLButtonElement>
95100
| FocusEvent<HTMLButtonElement>
96101
| KeyboardEvent<HTMLButtonElement>
97-
| undefined)
102+
| undefined, toggle?: boolean)
98103
: void {
99104
event?.stopPropagation()
100105
event?.preventDefault()
101106
if (props.disabled) {
102107
return
103108
}
104109

105-
toggleMenu()
110+
toggleMenu(toggle)
106111
}
107112

108-
useClickOutside(triggerRef.current, () => setMenuIsVisible(false))
113+
useClickOutside(triggerRef.current, () => setMenuIsVisible(false), menuIsVisible)
109114

110115
function handleKeyDown(event: KeyboardEvent<HTMLButtonElement> | undefined): void {
111116
if (event?.key === 'Enter') {
112117
toggleIfNotDisabled(event)
113118
}
114119
}
115120

121+
useEffect(() => {
122+
if (menuIsVisible) {
123+
popper.update?.()
124+
}
125+
}, [menuIsVisible])
126+
116127
return (
117128
<InputWrapper
118129
{...props}
@@ -135,7 +146,7 @@ const InputSelect: FC<InputSelectProps> = (props: InputSelectProps) => {
135146
disabled={!!props.disabled}
136147
onFocus={function onFocus(event: FocusEvent<HTMLButtonElement> | undefined) {
137148
setIsFocus(true)
138-
toggleIfNotDisabled(event)
149+
toggleIfNotDisabled(event, true)
139150
}}
140151
onBlur={function onBlur() {
141152
setIsFocus(false)

0 commit comments

Comments
 (0)