Skip to content

Commit 4b19804

Browse files
authored
Merge pull request #123 from keyxmakerx/claude/fix-backdrop-customizer-uAn3g
fix: drill panel reorg button now uses custom event dispatch
2 parents c2b5d7f + c88d2ff commit 4b19804

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

internal/templates/layouts/app.templ

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,13 +659,14 @@ templ SidebarDrillPanel(campaignID string, et SidebarEntityType, count int) {
659659
>{ strconv.Itoa(count) }</span>
660660
}
661661
</a>
662-
<!-- Reorg toggle for owners (delegates to main sidebar-reorg-toggle) -->
662+
<!-- Reorg toggle for owners (dispatches custom event to sidebar_reorg.js) -->
663663
if GetCampaignRole(ctx) >= 3 {
664664
<button
665665
type="button"
666666
class="w-5 h-5 flex items-center justify-center rounded text-gray-500 hover:text-gray-300 hover:bg-white/10 transition-colors shrink-0"
667667
title="Reorder pages"
668-
onclick="var t=document.getElementById('sidebar-reorg-toggle');if(t)t.click();"
668+
data-reorg-toggle
669+
onclick="document.dispatchEvent(new CustomEvent('chronicle:toggle-reorg'))"
669670
>
670671
<i class="fa-solid fa-grip-vertical text-[10px]"></i>
671672
</button>

static/js/sidebar_reorg.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@
7676
if (icon) icon.className = 'fa-solid fa-check text-[10px]';
7777
}
7878

79+
// Sync visual state on any secondary reorg toggle buttons (e.g. drill panel).
80+
document.querySelectorAll('[data-reorg-toggle]').forEach(function (b) {
81+
b.classList.add('bg-accent/20', 'text-accent');
82+
b.title = 'Done reordering';
83+
var i = b.querySelector('i');
84+
if (i) i.className = 'fa-solid fa-check text-[10px]';
85+
});
86+
7987
if (level === 'categories') {
8088
activateCategoryReorg();
8189
} else {
@@ -105,6 +113,14 @@
105113
if (icon) icon.className = 'fa-solid fa-grip-vertical text-[10px]';
106114
}
107115

116+
// Reset visual state on any secondary reorg toggle buttons.
117+
document.querySelectorAll('[data-reorg-toggle]').forEach(function (b) {
118+
b.classList.remove('bg-accent/20', 'text-accent');
119+
b.title = 'Reorder pages';
120+
var i = b.querySelector('i');
121+
if (i) i.className = 'fa-solid fa-grip-vertical text-[10px]';
122+
});
123+
108124
cleanupTouchDrag();
109125
}
110126

@@ -515,6 +531,11 @@
515531
toggle();
516532
});
517533

534+
// Allow other buttons (e.g. drill panel) to toggle reorg via custom event.
535+
document.addEventListener('chronicle:toggle-reorg', function () {
536+
toggle();
537+
});
538+
518539
// Exit reorg mode on navigation.
519540
window.addEventListener('chronicle:navigated', function () {
520541
if (active) deactivate();

0 commit comments

Comments
 (0)