Skip to content

Commit acdc2bf

Browse files
authored
Merge pull request #646 from topcoder-platform/accounts-app
MP-33 & MP-34 member tracks & communities -> dev
2 parents e307165 + b422607 commit acdc2bf

34 files changed

+513
-9
lines changed

src/apps/accounts/src/lib/assets/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from './security'
22
export * from './preferences'
33
export * from './payments'
44
export * from './tools'
5+
export * from './tcandyou'
Lines changed: 11 additions & 0 deletions
Loading
Lines changed: 14 additions & 0 deletions
Loading
Lines changed: 11 additions & 0 deletions
Loading
2.59 KB
Loading
3.34 KB
Loading
15.9 KB
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { ReactComponent as DevelopmentTrackIcon } from './develop.svg'
2+
import { ReactComponent as DesignTrackIcon } from './design.svg'
3+
import { ReactComponent as DataScienceTrackIcon } from './data_science.svg'
4+
import ethereumCommunityImage from './ico-ethereum.png'
5+
import ibmCommunityImage from './ico-ibmcloud.png'
6+
import veteransCommunityImage from './ico-veteran.png'
7+
8+
export {
9+
ethereumCommunityImage,
10+
ibmCommunityImage,
11+
veteransCommunityImage,
12+
DesignTrackIcon,
13+
DataScienceTrackIcon,
14+
DevelopmentTrackIcon,
15+
}

src/apps/accounts/src/settings/tabs/AccountSettingsTabs.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { AccountTab } from './account'
99
import { PreferencesTab } from './preferences'
1010
import { PaymentsTab } from './payments'
1111
import { ToolsTab } from './tools'
12+
import { TCandYouTab } from './tcandyou'
1213
import styles from './AccountSettingsTabs.module.scss'
1314

1415
interface AccountSettingsTabsProps {
@@ -23,7 +24,9 @@ const AccountSettingsTabs: FC<AccountSettingsTabsProps> = (props: AccountSetting
2324
const [activeTab, setActiveTab]: [string, Dispatch<SetStateAction<string>>]
2425
= useState<string>(activeTabHash)
2526

26-
const memberTraits: UserTraits[] | undefined = useMemberTraits(props.profile.handle)
27+
const { data: memberTraits }: {
28+
data: UserTraits[] | undefined
29+
} = useMemberTraits(props.profile.handle)
2730

2831
function handleTabChange(tabId: string): void {
2932
setActiveTab(tabId)
@@ -45,6 +48,10 @@ const AccountSettingsTabs: FC<AccountSettingsTabsProps> = (props: AccountSetting
4548
'Topcoder'].join(' | ')}
4649
</PageTitle>
4750

51+
{activeTab === AccountSettingsTabViews.tcandyou && (
52+
<TCandYouTab profile={props.profile} memberTraits={memberTraits} />
53+
)}
54+
4855
{activeTab === AccountSettingsTabViews.tools && (
4956
<ToolsTab profile={props.profile} memberTraits={memberTraits} />
5057
)}

src/apps/accounts/src/settings/tabs/account/user-and-pass/UserAndPassword.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
import { Dispatch, FC, useCallback, useEffect, useMemo, useState } from 'react'
22
import { has, trim } from 'lodash'
33
import { toast } from 'react-toastify'
4+
import { KeyedMutator } from 'swr'
45

56
import {
67
Collapsible,
78
Form,
89
FormInputModel,
910
FormToggleSwitch,
1011
} from '~/libs/ui'
11-
import { updateMemberPasswordAsync, updateMemberTraitsAsync, UserProfile, UserTrait, UserTraits } from '~/libs/core'
12+
import {
13+
updateMemberPasswordAsync,
14+
updateMemberTraitsAsync,
15+
useMemberTraits,
16+
UserProfile,
17+
UserTrait,
18+
UserTraits,
19+
} from '~/libs/core'
1220
import { SettingSection } from '~/apps/accounts/src/lib'
1321

1422
import { UserAndPassFromConfig } from './user-and-pass.form.config'
@@ -30,6 +38,8 @@ const UserAndPassword: FC<UserAndPasswordProps> = (props: UserAndPasswordProps)
3038
[props.memberTraits],
3139
)
3240

41+
const { mutate: mutateTraits }: { mutate: KeyedMutator<any> } = useMemberTraits(props.profile.handle)
42+
3343
const [userConsent, setUserConsent]: [boolean, Dispatch<boolean>] = useState(false)
3444

3545
const requestGenerator: (inputs: ReadonlyArray<FormInputModel>) => any
@@ -70,6 +80,7 @@ const UserAndPassword: FC<UserAndPasswordProps> = (props: UserAndPasswordProps)
7080
}])
7181
.then(() => {
7282
setUserConsent(!userConsent)
83+
mutateTraits()
7384
toast.success('User consent updated successfully.')
7485
})
7586
.catch(() => {

0 commit comments

Comments
 (0)