@@ -3,13 +3,16 @@ import React, { ReactNode, useState } from "react"
3
3
import { Flex , FlexProps , Heading } from "@chakra-ui/react"
4
4
// Component imports
5
5
import Button from "./Button"
6
- import Translation from "./Translation"
6
+ // TODO: add Translation when i18n is set up
7
+ // import Translation from "./Translation"
7
8
// SVG imports
8
9
import { FeedbackThumbsUpIcon } from "./icons"
9
10
// Utility imports
10
- import { trackCustomEvent } from "../utils/matomo"
11
+ // TODO: add trackCustomEvent when util is migrated
12
+ // import { trackCustomEvent } from "../utils/matomo"
11
13
// Hook imports
12
- import { useSurvey } from "../hooks/useSurvey"
14
+ // TODO: add useSurvey after hook is migrated
15
+ // import { useSurvey } from "../hooks/useSurvey"
13
16
14
17
export interface IProps extends FlexProps {
15
18
prompt ?: string
@@ -22,36 +25,46 @@ const FeedbackCard: React.FC<IProps> = ({
22
25
...props
23
26
} ) => {
24
27
const [ feedbackSubmitted , setFeedbackSubmitted ] = useState ( false )
25
- const surveyUrl = useSurvey ( feedbackSubmitted )
28
+ // const surveyUrl = useSurvey(feedbackSubmitted)
26
29
27
30
const location = typeof window !== "undefined" ? window . location . href : ""
28
31
const isTutorial = location . includes ( "tutorials" )
29
32
30
33
const getTitle = ( feedbackSubmitted : boolean ) : ReactNode => {
31
34
if ( ! feedbackSubmitted ) {
32
35
if ( prompt ) return prompt
33
- if ( isTutorial ) return < Translation id = "feedback-card-prompt-tutorial" />
34
- if ( isArticle ) return < Translation id = "feedback-card-prompt-article" />
35
- return < Translation id = "feedback-card-prompt-page" />
36
+ // TODO: add Translation when i18n is set up
37
+ // if (isTutorial) return <Translation id="feedback-card-prompt-tutorial" />
38
+ // if (isArticle) return <Translation id="feedback-card-prompt-article" />
39
+ // return <Translation id="feedback-card-prompt-page" />
40
+
41
+ if ( isTutorial ) return "Was this tutorial helpful?"
42
+ if ( isArticle ) return "Was this article helpful?"
43
+ return "Was this page helpful?"
36
44
}
37
- return < Translation id = "feedback-widget-thank-you-title" />
45
+
46
+ // TODO: add Translation when i18n is set up
47
+ // return <Translation id="feedback-widget-thank-you-title" />
48
+ return "Thank you for your feedback!"
38
49
}
39
50
40
51
const handleSubmit = ( choice : boolean ) : void => {
41
- trackCustomEvent ( {
42
- eventCategory : `Page is helpful feedback` ,
43
- eventAction : `Clicked` ,
44
- eventName : String ( choice ) ,
45
- } )
52
+ // TODO: add trackCustomEvent when util is migrated
53
+ // trackCustomEvent({
54
+ // eventCategory: `Page is helpful feedback`,
55
+ // eventAction: `Clicked`,
56
+ // eventName: String(choice),
57
+ // })
46
58
setFeedbackSubmitted ( true )
47
59
}
48
60
const handleSurveyOpen = ( ) : void => {
49
- trackCustomEvent ( {
50
- eventCategory : `Feedback survey opened` ,
51
- eventAction : `Clicked` ,
52
- eventName : "Feedback survey opened" ,
53
- } )
54
- window && surveyUrl && window . open ( surveyUrl , "_blank" )
61
+ // TODO: add trackCustomEvent when util is migrated
62
+ // trackCustomEvent({
63
+ // eventCategory: `Feedback survey opened`,
64
+ // eventAction: `Clicked`,
65
+ // eventName: "Feedback survey opened",
66
+ // })
67
+ // window && surveyUrl && window.open(surveyUrl, "_blank")
55
68
}
56
69
return (
57
70
< Flex
@@ -72,8 +85,15 @@ const FeedbackCard: React.FC<IProps> = ({
72
85
</ Heading >
73
86
{ feedbackSubmitted && (
74
87
< p >
75
- < Translation id = "feedback-widget-thank-you-subtitle" /> { " " }
76
- < Translation id = "feedback-widget-thank-you-subtitle-ext" />
88
+ { /* TODO: add Translation when i18n is set up */ }
89
+ Make this page even better by answering a few questions.
90
+ { /* <Translation id="feedback-widget-thank-you-subtitle" />{" "} */ }
91
+ { /* <Translation id="feedback-widget-thank-you-subtitle-ext" /> */ }
92
+ If you need help, you can reach out to the community on our{ " " }
93
+ < a href = "https://discord.gg/rZz26QWfCg\" target = "_blank\" >
94
+ Discord
95
+ </ a >
96
+ .
77
97
</ p >
78
98
) }
79
99
< Flex gap = { 4 } >
@@ -84,19 +104,25 @@ const FeedbackCard: React.FC<IProps> = ({
84
104
leftIcon = { < FeedbackThumbsUpIcon /> }
85
105
onClick = { ( ) => handleSubmit ( true ) }
86
106
>
87
- < Translation id = "yes" />
107
+ { /* TODO: add Translation when i18n is set up */ }
108
+ { /* <Translation id="yes" /> */ }
109
+ Yes
88
110
</ Button >
89
111
< Button
90
112
variant = "outline-color"
91
113
leftIcon = { < FeedbackThumbsUpIcon transform = "scaleY(-1)" /> }
92
114
onClick = { ( ) => handleSubmit ( false ) }
93
115
>
94
- < Translation id = "no" />
116
+ { /* TODO: add Translation when i18n is set up */ }
117
+ { /* <Translation id="no" /> */ }
118
+ No
95
119
</ Button >
96
120
</ >
97
121
) : (
98
122
< Button variant = "outline-color" onClick = { handleSurveyOpen } >
99
- < Translation id = "feedback-widget-thank-you-cta" />
123
+ { /* TODO: add Translation when i18n is set up */ }
124
+ { /* <Translation id="feedback-widget-thank-you-cta" /> */ }
125
+ Open short survey
100
126
</ Button >
101
127
) }
102
128
</ Flex >
0 commit comments