Skip to content

Commit f14f41e

Browse files
authored
feat(HelpBar): add confirmation overlay (#4648)
* feat: add confirmation page for support * chore: update confirmation text * chore: clean up * feat: success confirmation page * fix: prettier * chore: clean up * fix: prettier * chore: clean up * feat: add a type for feedback overlay param * fix: prettier * chore: rebase and clean up * fix: prettier * fix: prettier * chore: use useDispatch instead of connect * fix: prettier
1 parent 09ff413 commit f14f41e

File tree

6 files changed

+131
-31
lines changed

6 files changed

+131
-31
lines changed

src/overlays/components/OverlayController.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import ShareOverlay from 'src/flows/components/ShareOverlay'
4242
import PayGSupportOverlay from 'src/support/components/PayGSupportOverlay'
4343
import FreeAccountSupportOverlay from 'src/support/components/FreeAccountSupportOverlay'
4444
import FeedbackQuestionsOverlay from 'src/support/components/FeedbackQuestionsOverlay'
45+
import ConfirmationOverlay from 'src/support/components/ConfirmationOverlay'
4546

4647
// Actions
4748
import {dismissOverlay} from 'src/overlays/actions/overlays'
@@ -159,6 +160,9 @@ export const OverlayController: FunctionComponent = () => {
159160
case 'feedback-questions':
160161
activeOverlay.current = <FeedbackQuestionsOverlay onClose={onClose} />
161162
break
163+
case 'help-bar-confirmation':
164+
activeOverlay.current = <ConfirmationOverlay onClose={onClose} />
165+
break
162166
default:
163167
activeOverlay.current = null
164168
break

src/overlays/components/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,11 @@ export const FeedbackQuestionsOverlay = RouteOverlay(
163163
history.push(`/orgs/${params.orgID}/support`)
164164
}
165165
)
166+
167+
export const ConfirmationOverlay = RouteOverlay(
168+
OverlayHandler,
169+
'help-bar-confirmation',
170+
(history, params) => {
171+
history.push(`/orgs/${params.orgID}/support`)
172+
}
173+
)

src/overlays/reducers/overlays.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export type OverlayID =
3333
| 'payg-support'
3434
| 'free-account-support'
3535
| 'feedback-questions'
36+
| 'help-bar-confirmation'
3637

3738
export interface OverlayState {
3839
id: OverlayID | null
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import React, {FC, useContext} from 'react'
2+
3+
// Components
4+
import {
5+
Button,
6+
ButtonType,
7+
ComponentColor,
8+
Overlay,
9+
} from '@influxdata/clockface'
10+
import {SafeBlankLink} from 'src/utils/SafeBlankLink'
11+
12+
// Contexts
13+
import {OverlayContext} from 'src/overlays/components/OverlayController'
14+
15+
interface OwnProps {
16+
onClose: () => void
17+
}
18+
19+
const ConfirmationOverlay: FC<OwnProps> = () => {
20+
const {onClose, params} = useContext(OverlayContext)
21+
22+
const feedbackAndQuestions = (
23+
<p>
24+
Thank you for your submission! Please keep a lookout in your account email
25+
for confirmation and follow-up.
26+
</p>
27+
)
28+
29+
const paygSupport = (
30+
<>
31+
<p>
32+
Your support ticket has been submitted. A Support Engineer will
33+
investigate the issue and get back to you shortly. Please check your
34+
account email for a confirmation and follow-up.
35+
</p>
36+
<p>
37+
For more resources, check out{' '}
38+
<SafeBlankLink href="https://support.influxdata.com">
39+
{' '}
40+
support.influxdata.com{' '}
41+
</SafeBlankLink>
42+
</p>
43+
</>
44+
)
45+
46+
return (
47+
<Overlay.Container maxWidth={500}>
48+
<Overlay.Header
49+
testID="confirmation-overlay-header"
50+
title={
51+
params.type === 'PAYG' ? 'Contact Support' : 'Feedback & Questions'
52+
}
53+
onDismiss={onClose}
54+
/>
55+
<Overlay.Body>
56+
{params.type === 'PAYG' ? paygSupport : feedbackAndQuestions}
57+
</Overlay.Body>
58+
<Overlay.Footer>
59+
<Button
60+
text="OK"
61+
color={ComponentColor.Success}
62+
onClick={onClose}
63+
type={ButtonType.Button}
64+
/>
65+
</Overlay.Footer>
66+
</Overlay.Container>
67+
)
68+
}
69+
70+
export default ConfirmationOverlay

src/support/components/FeedbackQuestionsOverlay.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {FC, ChangeEvent, useContext, useState} from 'react'
2-
import {useSelector} from 'react-redux'
2+
import {useDispatch, useSelector} from 'react-redux'
33

44
// Components
55
import {
@@ -12,6 +12,9 @@ import {
1212
TextArea,
1313
} from '@influxdata/clockface'
1414

15+
// Actions
16+
import {dismissOverlay, showOverlay} from 'src/overlays/actions/overlays'
17+
1518
// Contexts
1619
import {OverlayContext} from 'src/overlays/components/OverlayController'
1720

@@ -30,18 +33,25 @@ interface OwnProps {
3033
}
3134

3235
const FeedbackQuestionsOverlay: FC<OwnProps> = () => {
36+
const [feedbackText, setFeedbackText] = useState('')
3337
const {onClose} = useContext(OverlayContext)
3438
const {id: orgID} = useSelector(getOrg)
3539
const {id: meID} = useSelector(getMe)
36-
const [feedbackText, setFeedbackText] = useState('')
3740

38-
const handleSubmit = () => {
39-
// handle form submit
41+
const dispatch = useDispatch()
42+
43+
const handleSubmit = (evt): void => {
44+
evt.preventDefault()
4045
event(
4146
'helpBar.feedbackAndQuestions.submitted',
4247
{},
4348
{userID: meID, orgID: orgID}
4449
)
50+
dispatch(
51+
showOverlay('help-bar-confirmation', {type: 'feedback'}, () =>
52+
dispatch(dismissOverlay)
53+
)
54+
)
4555
}
4656

4757
const handleInputChange = (e: ChangeEvent<HTMLTextAreaElement>) => {

src/support/components/PayGSupportOverlay.tsx

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {FC, ChangeEvent, useContext, useState} from 'react'
2-
import {useSelector} from 'react-redux'
2+
import {useDispatch, useSelector} from 'react-redux'
33

44
// Components
55
import {
@@ -12,14 +12,16 @@ import {
1212
Icon,
1313
IconFont,
1414
Input,
15-
Method,
1615
Overlay,
1716
QuestionMarkTooltip,
1817
SelectDropdown,
1918
TextArea,
2019
} from '@influxdata/clockface'
2120
import {SafeBlankLink} from 'src/utils/SafeBlankLink'
2221

22+
// Actions
23+
import {showOverlay, dismissOverlay} from 'src/overlays/actions/overlays'
24+
2325
// Contexts
2426
import {OverlayContext} from 'src/overlays/components/OverlayController'
2527

@@ -46,6 +48,8 @@ const PayGSupportOverlay: FC<OwnProps> = () => {
4648
const [textInput, setTextInput] = useState('')
4749
const {onClose} = useContext(OverlayContext)
4850

51+
const dispatch = useDispatch()
52+
4953
const severityLevel = [
5054
'1 - Critical',
5155
'2 - High',
@@ -58,13 +62,19 @@ const PayGSupportOverlay: FC<OwnProps> = () => {
5862
? ComponentStatus.Default
5963
: ComponentStatus.Disabled
6064

65+
const handleSubmit = (evt): void => {
66+
evt.preventDefault()
67+
event('helpBar.supportRequest.submitted', {}, {userID: meID, orgID: orgID})
68+
dispatch(
69+
showOverlay('help-bar-confirmation', {type: 'PAYG'}, () =>
70+
dispatch(dismissOverlay)
71+
)
72+
)
73+
}
74+
6175
const handleInputChange = (event: ChangeEvent<HTMLTextAreaElement>) => {
6276
setTextInput(event.target.value)
6377
}
64-
const handleSubmit = (): void => {
65-
// submit support form
66-
event('helpBar.supportRequest.submitted', {}, {userID: meID, orgID: orgID})
67-
}
6878

6979
const handleSubjectChange = (event: ChangeEvent<HTMLInputElement>) => {
7080
setSubject(event.target.value)
@@ -113,11 +123,7 @@ const PayGSupportOverlay: FC<OwnProps> = () => {
113123
onDismiss={onClose}
114124
/>
115125
<ErrorBoundary>
116-
<Form
117-
onSubmit={handleSubmit}
118-
action="https://influxdata--full.my.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8"
119-
method={Method.Post}
120-
>
126+
<Form>
121127
<Overlay.Body>
122128
<p className="status-page-text">
123129
<span>
@@ -168,24 +174,25 @@ const PayGSupportOverlay: FC<OwnProps> = () => {
168174
)}
169175
</Form.ValidationElement>
170176
</Overlay.Body>
171-
<Overlay.Footer>
172-
<Button
173-
text="Cancel"
174-
color={ComponentColor.Tertiary}
175-
onClick={onClose}
176-
type={ButtonType.Button}
177-
testID="payg-contact-support--cancel"
178-
/>
179-
<Button
180-
text="Submit"
181-
color={ComponentColor.Success}
182-
type={ButtonType.Submit}
183-
testID="payg-contact-support--submit"
184-
status={submitButtonStatus}
185-
/>
186-
</Overlay.Footer>
187177
</Form>
188178
</ErrorBoundary>
179+
<Overlay.Footer>
180+
<Button
181+
text="Cancel"
182+
color={ComponentColor.Tertiary}
183+
onClick={onClose}
184+
type={ButtonType.Button}
185+
testID="payg-contact-support--cancel"
186+
/>
187+
<Button
188+
text="Submit"
189+
color={ComponentColor.Success}
190+
type={ButtonType.Submit}
191+
testID="payg-contact-support--submit"
192+
status={submitButtonStatus}
193+
onClick={handleSubmit}
194+
/>
195+
</Overlay.Footer>
189196
</Overlay.Container>
190197
)
191198
}

0 commit comments

Comments
 (0)