Skip to content

Commit 253f80d

Browse files
committed
Implement critical sidebar handling improvements in huntarr-dev.mdc
- Addressed the issue of multiple sidebars displaying simultaneously, causing navigation confusion. - Updated the flash prevention script in new-main.js to ensure only the relevant sidebar is shown based on the current section. - Added detailed implementation requirements and testing instructions to ensure proper functionality across devices.
1 parent 2635636 commit 253f80d

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.cursor/rules/huntarr-dev.mdc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,45 @@ echo "13. Synology optimization bypass violations: $(grep -r "sqlite3.connect\|P
348348
- **Debug Logging**: Always add comprehensive console.log statements to track initialization flow
349349
- **Testing**: Refresh page, navigate to section, check browser console for proper initialization sequence
350350

351+
### Sidebar Implementation Pattern (Critical)
352+
- **Problem**: Multiple sidebars showing simultaneously causing visual clutter and navigation confusion
353+
- **Root Cause**: Flash prevention script in `new-main.js` showing main sidebar on page load before specialized sidebar logic runs
354+
- **Pattern**: Flash prevention checks localStorage but doesn't account for specialized sidebars (Requestarr, Settings)
355+
- **Symptom**: Both main sidebar and specialized sidebar visible at same time, especially on mobile
356+
- **Critical Fix**: Update flash prevention to hide main sidebar when specialized sidebar should be active
357+
- **Solution Pattern**:
358+
```javascript
359+
// In flash prevention script (around line 90-120 in new-main.js)
360+
// Check if we should show a specialized sidebar instead of main sidebar
361+
const currentSection = localStorage.getItem('huntarrCurrentSection') || 'home';
362+
const requestarrSections = ['requestarr-home', 'requestarr-history'];
363+
const settingsSections = ['settings', 'scheduling'];
364+
365+
if (requestarrSections.includes(currentSection)) {
366+
// Show Requestarr sidebar, hide main sidebar
367+
document.getElementById('sidebar').style.display = 'none';
368+
document.getElementById('requestarrSidebar').style.display = 'block';
369+
} else if (settingsSections.includes(currentSection)) {
370+
// Show Settings sidebar, hide main sidebar
371+
document.getElementById('sidebar').style.display = 'none';
372+
document.getElementById('settingsSidebar').style.display = 'block';
373+
} else {
374+
// Show main sidebar, hide specialized sidebars
375+
document.getElementById('sidebar').style.display = 'block';
376+
document.getElementById('requestarrSidebar').style.display = 'none';
377+
document.getElementById('settingsSidebar').style.display = 'none';
378+
}
379+
```
380+
- **Files Affected**: `/frontend/static/js/new-main.js` (flash prevention script)
381+
- **Implementation Requirements**:
382+
1. Always check localStorage section before showing any sidebar
383+
2. Hide all other sidebars when showing one specific sidebar
384+
3. Use consistent section naming: `requestarr-home`, `requestarr-history`, `settings`, `scheduling`
385+
4. Test on both desktop and mobile to ensure no double sidebars
386+
5. Ensure return buttons properly switch back to main sidebar
387+
- **Mobile Compatibility**: Flash prevention must work on mobile where sidebar space is limited
388+
- **Testing**: Navigate between sections, refresh page, check that only one sidebar shows at a time
389+
351390
## 🎯 DEBUGGING APPROACH
352391

353392
### Systematic Issue Discovery

0 commit comments

Comments
 (0)