Skip to content

Commit 6359f60

Browse files
committed
feat: Enhance guided tour functionality with step navigation and visual indicators
1 parent bcb923f commit 6359f60

File tree

3 files changed

+81
-11
lines changed

3 files changed

+81
-11
lines changed

data/secure_proxy.db

0 Bytes
Binary file not shown.

ui/static/js/user-guidance.js

Lines changed: 76 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,42 @@ function startGuidedTour() {
4646
// Show the tour indicator
4747
$('#tour-indicator').fadeIn();
4848

49-
// Handle exit tour button click
50-
$('#end-tour-btn').off('click').on('click', function() {
51-
endTour();
52-
showToast('Tour ended. You can restart it anytime from the Help menu.', 'info');
53-
});
49+
// Add CSS for step dots if not already added
50+
if (!$('#tour-dot-styles').length) {
51+
$('head').append(`
52+
<style id="tour-dot-styles">
53+
.step-counter-container {
54+
display: flex;
55+
align-items: center;
56+
gap: 5px;
57+
}
58+
59+
.step-dot {
60+
width: 8px;
61+
height: 8px;
62+
border-radius: 50%;
63+
background-color: rgba(0, 0, 0, 0.2);
64+
cursor: pointer;
65+
transition: all 0.2s ease;
66+
display: inline-block;
67+
}
68+
69+
[data-bs-theme="dark"] .step-dot {
70+
background-color: rgba(255, 255, 255, 0.2);
71+
}
72+
73+
.step-dot.active {
74+
background-color: var(--primary-color, #3a86ff);
75+
transform: scale(1.3);
76+
}
77+
78+
.step-dot:hover {
79+
transform: scale(1.2);
80+
background-color: var(--primary-hover, #2667cc);
81+
}
82+
</style>
83+
`);
84+
}
5485

5586
// Define tour steps
5687
const tourSteps = [
@@ -97,7 +128,7 @@ function startGuidedTour() {
97128
let currentStep = 0;
98129
showTourStep(currentStep, tourSteps);
99130

100-
// Handle "Next" button click
131+
// Handle "Next" button click from popover
101132
$(document).on('click', '.tour-next', function() {
102133
currentStep++;
103134
if (currentStep < tourSteps.length) {
@@ -108,19 +139,44 @@ function startGuidedTour() {
108139
}
109140
});
110141

111-
// Handle "Previous" button click
142+
// Handle "Previous" button click from popover
112143
$(document).on('click', '.tour-prev', function() {
113144
if (currentStep > 0) {
114145
currentStep--;
115146
showTourStep(currentStep, tourSteps);
116147
}
117148
});
118149

119-
// Handle "Skip" button click
150+
// Handle "Skip" button click from popover
120151
$(document).on('click', '.tour-skip', function() {
121152
endTour();
122153
showToast('Tour skipped. You can access help anytime from the menu.', 'info');
123154
});
155+
156+
// Handle next button click from tour indicator
157+
$('#next-tour-step').off('click').on('click', function() {
158+
currentStep++;
159+
if (currentStep < tourSteps.length) {
160+
showTourStep(currentStep, tourSteps);
161+
} else {
162+
endTour();
163+
showToast('Tour completed! Explore the interface at your own pace.', 'success');
164+
}
165+
});
166+
167+
// Handle previous button click from tour indicator
168+
$('#prev-tour-step').off('click').on('click', function() {
169+
if (currentStep > 0) {
170+
currentStep--;
171+
showTourStep(currentStep, tourSteps);
172+
}
173+
});
174+
175+
// Handle exit tour button click
176+
$('#end-tour-btn').off('click').on('click', function() {
177+
endTour();
178+
showToast('Tour ended. You can restart it anytime from the Help menu.', 'info');
179+
});
124180
} else {
125181
showToast('Tour functionality not available. Please upgrade your browser.', 'warning');
126182
}
@@ -160,8 +216,12 @@ function showTourStep(stepIndex, steps) {
160216
${prevButton}
161217
<button class="btn btn-sm btn-link text-muted tour-skip">Skip Tour</button>
162218
</div>
163-
<div>
164-
<span class="badge bg-light text-dark me-2">${stepIndex + 1}/${steps.length}</span>
219+
<div class="d-flex align-items-center">
220+
<div class="step-counter-container me-2">
221+
${Array.from({length: steps.length}, (_, i) =>
222+
`<span class="step-dot ${i === stepIndex ? 'active' : ''}" data-step="${i}"></span>`
223+
).join('')}
224+
</div>
165225
${nextButton}
166226
</div>
167227
</div>
@@ -181,6 +241,12 @@ function showTourStep(stepIndex, steps) {
181241
});
182242

183243
popover.show();
244+
245+
// Add click handlers for the step dots
246+
$('.step-dot').click(function() {
247+
const targetStep = parseInt($(this).data('step'));
248+
showTourStep(targetStep, steps);
249+
});
184250
} catch (e) {
185251
console.error('Error showing popover:', e);
186252
// Fallback method

ui/templates/base.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,11 @@
730730
<div class="d-flex align-items-center">
731731
<i class="fas fa-map-signs me-2"></i>
732732
<span>Guided Tour</span>
733-
<button id="end-tour-btn" class="btn btn-sm btn-light ms-3 py-0 px-2">Exit</button>
733+
<div class="ms-3 d-flex">
734+
<button id="prev-tour-step" class="btn btn-sm btn-light me-1" title="Previous Step"><i class="fas fa-chevron-left"></i></button>
735+
<button id="next-tour-step" class="btn btn-sm btn-light me-1" title="Next Step"><i class="fas fa-chevron-right"></i></button>
736+
<button id="end-tour-btn" class="btn btn-sm btn-light" title="Exit Tour"><i class="fas fa-times"></i></button>
737+
</div>
734738
</div>
735739
</div>
736740

0 commit comments

Comments
 (0)