mirror of
https://github.com/garrytan/gstack.git
synced 2026-06-08 11:03:54 +02:00
fix: sidebar arrow hint stays visible until sidebar actually opens
Previously the welcome page arrow hid immediately when the extension's content script loaded — but extension loaded ≠ sidebar open. Now the signal flow is: sidepanel connects → tells background.js → relays to content script → dispatches gstack-extension-ready → arrow hides. Adds welcome-page.test.ts: 14 tests verifying arrow, branding, feature cards, dark theme, and auto-hide behavior via real HTTP server. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+4
-15
@@ -213,25 +213,14 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Hide sidebar prompt when the gstack extension content script fires
|
||||
// Hide sidebar prompt ONLY when the sidebar is actually opened.
|
||||
// The content script dispatches 'gstack-extension-ready' when it receives
|
||||
// a 'sidebarOpened' message from the side panel (via background.js).
|
||||
// This means the arrow stays visible until the user actually opens the sidebar.
|
||||
document.addEventListener('gstack-extension-ready', () => {
|
||||
const prompt = document.getElementById('sidebar-prompt');
|
||||
if (prompt) prompt.classList.add('hidden');
|
||||
});
|
||||
// Fallback: also check for the status pill DOM element
|
||||
function checkPill() {
|
||||
if (document.getElementById('gstack-status-pill')) {
|
||||
const prompt = document.getElementById('sidebar-prompt');
|
||||
if (prompt) prompt.classList.add('hidden');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
let checks = 0;
|
||||
const interval = setInterval(() => {
|
||||
if (checkPill() || ++checks > 15) clearInterval(interval);
|
||||
}, 2000);
|
||||
checkPill();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user