Skip to content

Commit c46c1a0

Browse files
PROD-3115 #comment This commit updates the uni nav user and fixes bugs in the contact support modal that wasn't passing the work id and the self service flag was getting set on all requests. #time 30m
1 parent 2b2ded6 commit c46c1a0

File tree

8 files changed

+226
-220
lines changed

8 files changed

+226
-220
lines changed

src-ts/header/Header.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ const Header: FC = () => {
8484
toolRoot: activeToolRoute,
8585
type: 'tool',
8686
user: profile ? {
87+
email: profile.email,
88+
firstName: profile.firstName,
8789
handle: profile.handle,
88-
initials: `${profile.firstName.charAt(0)}${profile.lastName.charAt(0)}`,
90+
lastName: profile.lastName,
8991
photoUrl: profile.photoURL,
9092
userId: profile.userId,
9193
} : undefined,

src-ts/lib/contact-support-form/ContactSupportForm.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import styles from './ContactSupportForm.module.scss'
1111

1212
export interface ContactSupportFormProps {
1313
formDef: FormDefinition
14+
isSelfService?: boolean
1415
onSave: () => void
1516
workId?: string
1617
}
@@ -30,7 +31,7 @@ const ContactSupportForm: FC<ContactSupportFormProps> = (props: ContactSupportFo
3031
}
3132
}, [loading, saveOnSuccess, props.onSave])
3233

33-
const generateRequest = useCallback((
34+
const generateRequest: (inputs: ReadonlyArray<FormInputModel>) => void = useCallback((
3435
inputs: ReadonlyArray<FormInputModel>,
3536
): ContactSupportRequest => {
3637
const firstName: string
@@ -45,20 +46,21 @@ const ContactSupportForm: FC<ContactSupportFormProps> = (props: ContactSupportFo
4546
challengeId: props.workId,
4647
email,
4748
firstName,
48-
isSelfService: true,
49+
isSelfService: !!props.isSelfService,
4950
lastName,
5051
question,
5152
}
5253
}, [props.workId])
5354

54-
const saveAsync = useCallback(async (request: ContactSupportRequest): Promise<void> => {
55-
setLoading(true)
56-
return contactSupportSubmitRequestAsync(request)
57-
.then(() => {
58-
setSaveOnSuccess(true)
59-
})
60-
.finally(() => setLoading(false))
61-
}, [])
55+
const saveAsync: (request: ContactSupportRequest) => Promise<void>
56+
= useCallback(async (request: ContactSupportRequest): Promise<void> => {
57+
setLoading(true)
58+
return contactSupportSubmitRequestAsync(request)
59+
.then(() => {
60+
setSaveOnSuccess(true)
61+
})
62+
.finally(() => setLoading(false))
63+
}, [])
6264

6365
const emailElement: JSX.Element | undefined = !!profile?.email
6466
? (

src-ts/lib/modals/contact-support-modal/ContactSupportModal.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { Dispatch, FC, SetStateAction, useState } from 'react'
1+
import { Dispatch, FC, SetStateAction, useCallback, useState } from 'react'
22

33
import { ContactSupportForm, contactSupportFormDef } from '../../contact-support-form'
44
import { FormDefinition, formGetInputFields, formOnReset } from '../../form'
55
import { BaseModal } from '../base-modal'
66

77
export interface ContactSupportModalProps {
88
isOpen: boolean
9+
isSelfService?: boolean
910
onClose: () => void
1011
workId?: string
1112
}
@@ -15,12 +16,12 @@ const ContactSupportModal: FC<ContactSupportModalProps> = (props: ContactSupport
1516
const [formDef, setFormDef]: [FormDefinition, Dispatch<SetStateAction<FormDefinition>>]
1617
= useState<FormDefinition>({ ...contactSupportFormDef })
1718

18-
function onClose(): void {
19+
const onClose: () => void = useCallback(() => {
1920
const updatedForm: FormDefinition = { ...formDef }
2021
formOnReset(formGetInputFields(updatedForm.groups || []))
2122
setFormDef(updatedForm)
2223
props.onClose()
23-
}
24+
}, [formDef, props])
2425

2526
return (
2627
<BaseModal
@@ -31,7 +32,9 @@ const ContactSupportModal: FC<ContactSupportModalProps> = (props: ContactSupport
3132
>
3233
<ContactSupportForm
3334
formDef={formDef}
35+
isSelfService={props.isSelfService}
3436
onSave={onClose}
37+
workId={props.workId}
3538
/>
3639
</BaseModal>
3740
)

src-ts/tools/work/work-self-service/intake-forms/support-info-card/SupportInfoCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ const SupportInfoCard: React.FC = () => {
2121
>
2222
<div>
2323
Topcoder also offers solutions for multiple other technical needs and problems.
24-
We have community members expertly skilled in Development, UX / UI Design, Data Science, Quality Assurance, and more.
24+
We have community members expertly skilled in Development, UX / UI Design, Data
25+
Science, Quality Assurance, and more.
2526
We’d love to talk with you about all of our services.
2627
</div>
2728
<div className={styles.supportButton}>

src/routes/BasicInfoLegacy/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ const BasicInfoLegacy = ({
168168
<ContactSupportModal
169169
workId={challenge?.id}
170170
isOpen={showSupportModal}
171+
isSelfService={true}
171172
onClose={onHideSupportModal}
172173
/>
173174
<Page>

src/routes/Products/components/BasicInfo/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ const BasicInfo = ({
235235
<ContactSupportModal
236236
challengeId={challenge?.id}
237237
isOpen={showSupportModal}
238+
isSelfService={true}
238239
onClose={onHideSupportModal}
239240
/>
240241
<Page>

src/routes/SelectWorkType/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ const SelectWorkType = ({
167167
<ContactSupportModal
168168
workId={challenge?.id}
169169
isOpen={showSupportModal}
170+
isSelfService={true}
170171
onClose={onHideSupportModal}
171172
/>
172173
<Breadcrumb items={breadcrumb} />

0 commit comments

Comments
 (0)