Skip to content

Commit 8274ac5

Browse files
committed
replay tour changes
1 parent 0d475c0 commit 8274ac5

File tree

4 files changed

+98
-22
lines changed

4 files changed

+98
-22
lines changed

src/app/common/css/theme-redis.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
--pg-sidebar-item-active-bg-clr: var(--gray-02);
7373

7474
--pg-walkthrough-txt-clr: var(--midnight-base);
75+
--pg-walkthrough-step-count-txt-clr: var(--gray-05);
7576

7677
--pg-container-bg-clr: var(--white-base);
7778
--pg-container-txt-clr: var(--midnight-base);

src/app/page-components/PgCardPanel/PgCardHeader.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
i {
2727
cursor: pointer;
2828
color: var(--pg-card-header-icon-clr);
29-
width: 16px;
29+
width: 1.25rem;
30+
height: 1.25rem;
3031
}
3132
}

src/app/page-components/PgWalkthrough/index.scss

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,8 @@
4444
opacity: 0.9;
4545
}
4646

47-
.pg-joyride-content {
48-
color: var(--pg-walkthrough-txt-clr);
49-
}
50-
51-
.pg-joyride-footer {
52-
margin-top: var(--space-16);
53-
font-size: var(--font-size-12);
54-
color: var(--color-gray);
47+
.react-joyride__tooltip button[data-action="close"] {
48+
display: none;
5549
}
5650

5751
.__floater[x-placement="top"] {
@@ -63,3 +57,33 @@
6357
/*to keep arrow closer to element*/
6458
margin-top: -15px;
6559
}
60+
61+
/*--------------------------------*/
62+
63+
.pg-joyride-tooltip {
64+
.pg-joyride-header {
65+
display: flex;
66+
justify-content: space-between;
67+
align-items: center;
68+
margin-bottom: var(--space-16);
69+
70+
.pg-joyride-title {
71+
font-size: var(--font-size-14);
72+
}
73+
74+
.pg-joyride-step-count {
75+
color: var(--pg-walkthrough-step-count-txt-clr);
76+
}
77+
}
78+
79+
.pg-joyride-content {
80+
color: var(--pg-walkthrough-txt-clr);
81+
display: flex;
82+
align-items: center;
83+
justify-content: flex-start;
84+
margin-bottom: var(--space-8);
85+
}
86+
.pg-joyride-footer {
87+
color: var(--pg-walkthrough-step-count-txt-clr);
88+
}
89+
}

src/app/page-components/PgWalkthrough/index.tsx

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const bottomCardConfig = {
3232
}
3333
};
3434

35+
const keyboardHint = '(Use ← → arrow keys to navigate steps)';
3536

3637
let steps: Step[] = [
3738
{
@@ -40,69 +41,118 @@ let steps: Step[] = [
4041
disableBeacon: true, //direct step open instead of beacon (dot)
4142
data: {
4243
//custom props
43-
performClick: true
44+
performClick: true,
45+
title: 'Select query',
46+
footer: keyboardHint
4447
}
4548
},
4649
{
4750
target: '.query-item:nth-child(1)',
4851
content: 'Click on any query to load it',
4952
data: {
50-
performClick: true
53+
performClick: true,
54+
title: 'Select query'
5155
}
5256
},
5357
{
5458
target: '.pg-query-card',
5559
content: 'View and edit your Redis query here',
56-
...topCardConfig
60+
...topCardConfig,
61+
data: {
62+
title: 'Query editor'
63+
}
5764
},
5865
{
5966
target: '.pg-db-index-card',
6067
content: 'View the corresponding index for your Redis query',
61-
...topCardConfig
68+
...topCardConfig,
69+
data: {
70+
title: 'DB Index view'
71+
}
6272
},
6373
{
6474
target: '.pg-data-source-card',
6575
content: 'View the sample source data used by your Redis query',
66-
...bottomCardConfig
76+
...bottomCardConfig,
77+
data: {
78+
title: 'Data source view'
79+
}
6780
},
6881
{
6982
target: '.header-run-btn',
7083
content: 'Execute your Redis query',
7184
data: {
72-
performClick: true
85+
performClick: true,
86+
title: 'Run'
7387
}
7488
},
7589
{
7690
target: '.pg-result-card',
7791
content: 'View the query results here',
78-
...bottomCardConfig
92+
...bottomCardConfig,
93+
data: {
94+
title: 'Results view'
95+
}
7996
},
8097
{
8198
target: '.header-share-btn',
8299
content: 'Share your Redis query using a generated URL',
100+
data: {
101+
title: 'Share'
102+
}
83103
},
84104
{
85105
target: '.header-reset-btn',
86106
content: 'Reset your modified Redis query back to its default state',
107+
data: {
108+
title: 'Reset'
109+
}
87110
},
88111
{
89112
target: '.pg-query-category .pg-list-item:last-child',
90113
content: 'Click on other related queries in the category to view them',
114+
data: {
115+
title: 'Related queries'
116+
}
91117
},
92118
{
93119
target: '.pg-replay-tour-lbl',
94120
content: 'Replay this tour anytime to review the steps',
121+
data: {
122+
title: 'Replay tour'
123+
}
95124
},
96125

97126
];
98127

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+
100145
steps = steps.map((step, index) => ({
101146
...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+
)
106156
}));
107157

108158
const PgWalkthrough = () => {
@@ -182,7 +232,7 @@ const PgWalkthrough = () => {
182232
steps={steps}
183233
run={runTour}
184234
continuous={true}
185-
showProgress={true}
235+
showProgress={false}
186236
showSkipButton={true}
187237
stepIndex={stepIndex}
188238
callback={handleJoyrideCallback}

0 commit comments

Comments
 (0)