Skip to content

Commit e87c03e

Browse files
authored
Merge pull request #859 from topcoder-platform/dev
Member Profiles - BAU Sprint 6
2 parents 9845d56 + 58e683d commit e87c03e

File tree

41 files changed

+514
-437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+514
-437
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/accounts/src/settings/tabs/account/user-and-pass/UserAndPassword.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from '~/libs/ui'
1212
import {
1313
updateMemberPasswordAsync,
14-
updateMemberTraitsAsync,
14+
updateOrCreateMemberTraitsAsync,
1515
useMemberTraits,
1616
UserProfile,
1717
UserTrait,
@@ -69,7 +69,7 @@ const UserAndPassword: FC<UserAndPasswordProps> = (props: UserAndPasswordProps)
6969
}
7070

7171
function handleUserConsentChange(): void {
72-
updateMemberTraitsAsync(props.profile.handle, [{
72+
updateOrCreateMemberTraitsAsync(props.profile.handle, [{
7373
categoryName: 'Personalization',
7474
traitId: 'personalization',
7575
traits: {

src/apps/accounts/src/settings/tabs/tcandyou/communities/Communities.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { bind } from 'lodash'
33
import { KeyedMutator } from 'swr'
44
import { toast } from 'react-toastify'
55

6-
import { updateMemberTraitsAsync, useMemberTraits, UserProfile, UserTraits } from '~/libs/core'
6+
import { updateOrCreateMemberTraitsAsync, useMemberTraits, UserProfile, UserTraits } from '~/libs/core'
77
import { Button, Collapsible, FormToggleSwitch } from '~/libs/ui'
88
import { triggerSprigSurvey } from '~/apps/accounts/src/lib'
99

@@ -38,7 +38,7 @@ const Communities: FC<CommunitiesProps> = (props: CommunitiesProps) => {
3838
[communityId]: !memberCommunities?.[communityId],
3939
}
4040

41-
updateMemberTraitsAsync(props.profile.handle, [{
41+
updateOrCreateMemberTraitsAsync(props.profile.handle, [{
4242
categoryName: 'Communities',
4343
traitId: 'communities',
4444
traits: {

src/apps/accounts/src/settings/tabs/tools/devices/Devices.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { toast } from 'react-toastify'
55
import classNames from 'classnames'
66

77
import {
8-
createMemberTraitsAsync,
98
updateMemberTraitsAsync,
9+
updateOrCreateMemberTraitsAsync,
1010
useMemberDevicesLookup,
1111
UserProfile,
1212
UserTrait,
@@ -31,11 +31,6 @@ interface DevicesProps {
3131
profile: UserProfile
3232
}
3333

34-
const methodsMap: { [key: string]: any } = {
35-
create: createMemberTraitsAsync,
36-
update: updateMemberTraitsAsync,
37-
}
38-
3934
const Devices: FC<DevicesProps> = (props: DevicesProps) => {
4035
const formElRef: MutableRefObject<HTMLDivElement | any> = useRef()
4136

@@ -293,7 +288,7 @@ const Devices: FC<DevicesProps> = (props: DevicesProps) => {
293288
setIsEditMode(false)
294289
})
295290
} else {
296-
methodsMap[!deviceTypesData || !deviceTypesData.length ? 'create' : 'update'](
291+
updateOrCreateMemberTraitsAsync(
297292
props.profile.handle,
298293
[{
299294
categoryName: 'Device',

src/apps/accounts/src/settings/tabs/tools/service-provider/ServiceProvider.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { bind, isEmpty, reject, trim } from 'lodash'
33
import { toast } from 'react-toastify'
44
import classNames from 'classnames'
55

6-
import { createMemberTraitsAsync, updateMemberTraitsAsync, UserProfile, UserTrait } from '~/libs/core'
6+
import { updateMemberTraitsAsync, updateOrCreateMemberTraitsAsync, UserProfile, UserTrait } from '~/libs/core'
77
import { Button, Collapsible, ConfirmModal, IconOutline, InputSelect, InputText } from '~/libs/ui'
88
import {
99
FinancialInstitutionIcon,
@@ -23,11 +23,6 @@ interface ServiceProviderProps {
2323
profile: UserProfile
2424
}
2525

26-
const methodsMap: { [key: string]: any } = {
27-
create: createMemberTraitsAsync,
28-
update: updateMemberTraitsAsync,
29-
}
30-
3126
const ServiceProvider: FC<ServiceProviderProps> = (props: ServiceProviderProps) => {
3227
const formElRef: MutableRefObject<HTMLDivElement | any> = useRef()
3328

@@ -166,7 +161,7 @@ const ServiceProvider: FC<ServiceProviderProps> = (props: ServiceProviderProps)
166161
setIsEditMode(false)
167162
})
168163
} else {
169-
methodsMap[!serviceProviderTypesData || !serviceProviderTypesData.length ? 'create' : 'update'](
164+
updateOrCreateMemberTraitsAsync(
170165
props.profile.handle,
171166
[{
172167
categoryName: 'Service Provider',

src/apps/accounts/src/settings/tabs/tools/software/Software.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { bind, isEmpty, reject, trim } from 'lodash'
33
import { toast } from 'react-toastify'
44
import classNames from 'classnames'
55

6-
import { createMemberTraitsAsync, updateMemberTraitsAsync, UserProfile, UserTrait } from '~/libs/core'
6+
import { updateMemberTraitsAsync, updateOrCreateMemberTraitsAsync, UserProfile, UserTrait } from '~/libs/core'
77
import { Button, Collapsible, ConfirmModal, IconOutline, InputSelect, InputText } from '~/libs/ui'
88
import { SettingSection, SoftwareIcon, triggerSprigSurvey } from '~/apps/accounts/src/lib'
99

@@ -15,11 +15,6 @@ interface SoftwareProps {
1515
profile: UserProfile
1616
}
1717

18-
const methodsMap: { [key: string]: any } = {
19-
create: createMemberTraitsAsync,
20-
update: updateMemberTraitsAsync,
21-
}
22-
2318
const Software: FC<SoftwareProps> = (props: SoftwareProps) => {
2419
const formElRef: MutableRefObject<HTMLDivElement | any> = useRef()
2520

@@ -154,7 +149,7 @@ const Software: FC<SoftwareProps> = (props: SoftwareProps) => {
154149
setIsEditMode(false)
155150
})
156151
} else {
157-
methodsMap[!softwareTypesData || !softwareTypesData.length ? 'create' : 'update'](
152+
updateOrCreateMemberTraitsAsync(
158153
props.profile.handle,
159154
[{
160155
categoryName: 'Software',

src/apps/accounts/src/settings/tabs/tools/subscriptions/Subscriptions.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { bind, isEmpty, reject, trim } from 'lodash'
33
import { toast } from 'react-toastify'
44
import classNames from 'classnames'
55

6-
import { createMemberTraitsAsync, updateMemberTraitsAsync, UserProfile, UserTrait } from '~/libs/core'
6+
import { updateMemberTraitsAsync, updateOrCreateMemberTraitsAsync, UserProfile, UserTrait } from '~/libs/core'
77
import { Button, Collapsible, ConfirmModal, IconOutline, InputText } from '~/libs/ui'
88
import { SettingSection, SubscriptionsIcon, triggerSprigSurvey } from '~/apps/accounts/src/lib'
99

@@ -14,11 +14,6 @@ interface SubscriptionsProps {
1414
profile: UserProfile
1515
}
1616

17-
const methodsMap: { [key: string]: any } = {
18-
create: createMemberTraitsAsync,
19-
update: updateMemberTraitsAsync,
20-
}
21-
2217
const Subscriptions: FC<SubscriptionsProps> = (props: SubscriptionsProps) => {
2318
const formElRef: MutableRefObject<HTMLDivElement | any> = useRef()
2419

@@ -139,7 +134,7 @@ const Subscriptions: FC<SubscriptionsProps> = (props: SubscriptionsProps) => {
139134
setIsEditMode(false)
140135
})
141136
} else {
142-
methodsMap[!subscriptionsTypesData || !subscriptionsTypesData.length ? 'create' : 'update'](
137+
updateOrCreateMemberTraitsAsync(
143138
props.profile.handle,
144139
[{
145140
categoryName: 'Subscription',

src/apps/learn/src/tca-certificate/user-certification-view/UserCertificationViewBase.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
SetStateAction,
66
useEffect,
77
useLayoutEffect,
8+
useMemo,
89
useRef,
910
useState,
1011
} from 'react'
@@ -44,6 +45,11 @@ const UserCertificationViewBase: FC<UserCertificationViewBaseProps> = (props: Us
4445
const isOwnProfile: boolean = !!props.profile?.email
4546

4647
const isModalView: boolean = queryParams.get('view-style') === 'modal'
48+
const userName = useMemo(() => (
49+
!!(props.profile?.firstName || props.profile?.lastName)
50+
? `${props.profile.firstName} ${props.profile.lastName}`
51+
: props.enrollment?.userName
52+
), [props.profile, props.enrollment])
4753

4854
const [isMemberVerified, setIsMemberVerified]: [boolean, Dispatch<SetStateAction<boolean>>]
4955
= useState<boolean>(false)
@@ -95,7 +101,7 @@ const UserCertificationViewBase: FC<UserCertificationViewBaseProps> = (props: Us
95101
completionUuid={props.enrollment.completionUuid ?? undefined}
96102
isMemberVerified={isMemberVerified}
97103
userProfile={props.profile}
98-
userName={props.enrollment.userName}
104+
userName={userName}
99105
isOwner={isOwnProfile}
100106
validationUrl={validationUrl}
101107
isPreview={props.isPreview}

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)

0 commit comments

Comments
 (0)