@@ -32,6 +32,7 @@ const bottomCardConfig = {
32
32
}
33
33
} ;
34
34
35
+ const keyboardHint = '(Use ← → arrow keys to navigate steps)' ;
35
36
36
37
let steps : Step [ ] = [
37
38
{
@@ -40,69 +41,118 @@ let steps: Step[] = [
40
41
disableBeacon : true , //direct step open instead of beacon (dot)
41
42
data : {
42
43
//custom props
43
- performClick : true
44
+ performClick : true ,
45
+ title : 'Select query' ,
46
+ footer : keyboardHint
44
47
}
45
48
} ,
46
49
{
47
50
target : '.query-item:nth-child(1)' ,
48
51
content : 'Click on any query to load it' ,
49
52
data : {
50
- performClick : true
53
+ performClick : true ,
54
+ title : 'Select query'
51
55
}
52
56
} ,
53
57
{
54
58
target : '.pg-query-card' ,
55
59
content : 'View and edit your Redis query here' ,
56
- ...topCardConfig
60
+ ...topCardConfig ,
61
+ data : {
62
+ title : 'Query editor'
63
+ }
57
64
} ,
58
65
{
59
66
target : '.pg-db-index-card' ,
60
67
content : 'View the corresponding index for your Redis query' ,
61
- ...topCardConfig
68
+ ...topCardConfig ,
69
+ data : {
70
+ title : 'DB Index view'
71
+ }
62
72
} ,
63
73
{
64
74
target : '.pg-data-source-card' ,
65
75
content : 'View the sample source data used by your Redis query' ,
66
- ...bottomCardConfig
76
+ ...bottomCardConfig ,
77
+ data : {
78
+ title : 'Data source view'
79
+ }
67
80
} ,
68
81
{
69
82
target : '.header-run-btn' ,
70
83
content : 'Execute your Redis query' ,
71
84
data : {
72
- performClick : true
85
+ performClick : true ,
86
+ title : 'Run'
73
87
}
74
88
} ,
75
89
{
76
90
target : '.pg-result-card' ,
77
91
content : 'View the query results here' ,
78
- ...bottomCardConfig
92
+ ...bottomCardConfig ,
93
+ data : {
94
+ title : 'Results view'
95
+ }
79
96
} ,
80
97
{
81
98
target : '.header-share-btn' ,
82
99
content : 'Share your Redis query using a generated URL' ,
100
+ data : {
101
+ title : 'Share'
102
+ }
83
103
} ,
84
104
{
85
105
target : '.header-reset-btn' ,
86
106
content : 'Reset your modified Redis query back to its default state' ,
107
+ data : {
108
+ title : 'Reset'
109
+ }
87
110
} ,
88
111
{
89
112
target : '.pg-query-category .pg-list-item:last-child' ,
90
113
content : 'Click on other related queries in the category to view them' ,
114
+ data : {
115
+ title : 'Related queries'
116
+ }
91
117
} ,
92
118
{
93
119
target : '.pg-replay-tour-lbl' ,
94
120
content : 'Replay this tour anytime to review the steps' ,
121
+ data : {
122
+ title : 'Replay tour'
123
+ }
95
124
} ,
96
125
97
126
] ;
98
127
99
- const keyboardHint = '(Use ← → arrow keys to navigate steps)' ;
128
+ const CustomTooltip = ( { title, content, footer, index, total } : { title : string , content : string , footer ?: string , index : number , total : number } ) => (
129
+ < div className = 'pg-joyride-tooltip' >
130
+ < div className = 'pg-joyride-header' >
131
+ < span className = 'pg-joyride-title font-medium' > { title } </ span >
132
+
133
+ < span className = 'pg-joyride-step-count' > (Step { index } of { total } )</ span >
134
+
135
+ </ div >
136
+ < div className = 'pg-joyride-content' >
137
+ { content }
138
+ </ div >
139
+ < div className = 'pg-joyride-footer' >
140
+ { footer }
141
+ </ div >
142
+ </ div >
143
+ ) ;
144
+
100
145
steps = steps . map ( ( step , index ) => ( {
101
146
...step ,
102
- content : ( < div className = 'pg-joyride-content' >
103
- { step . content }
104
- { index === 0 && < div className = 'pg-joyride-footer' dangerouslySetInnerHTML = { { __html : keyboardHint } } /> }
105
- </ div > )
147
+ content : (
148
+ < CustomTooltip
149
+ title = { step . data ?. title || '' }
150
+ content = { step . content as string }
151
+ footer = { step . data ?. footer || "" }
152
+ index = { index + 1 }
153
+ total = { steps . length }
154
+ />
155
+ )
106
156
} ) ) ;
107
157
108
158
const PgWalkthrough = ( ) => {
@@ -182,7 +232,7 @@ const PgWalkthrough = () => {
182
232
steps = { steps }
183
233
run = { runTour }
184
234
continuous = { true }
185
- showProgress = { true }
235
+ showProgress = { false }
186
236
showSkipButton = { true }
187
237
stepIndex = { stepIndex }
188
238
callback = { handleJoyrideCallback }
0 commit comments