diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea7..4abcc5e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,10 +1,9 @@ --- name: Bug report about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - +title: "" +labels: "" +assignees: "" --- **Describe the bug** @@ -12,6 +11,7 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' @@ -21,18 +21,20 @@ Steps to reproduce the behavior: A clear and concise description of what you expected to happen. **Screenshots** -If applicable, add screenshots to help explain your problem. +If applicable, add screenshots, or a screen record to help explain your problem. **Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] + +- OS: [e.g. Linux, FreeBSD, Windows, macOS] +- Browser [e.g. Firefox, Chrome, Edge, Safari] +- Version [e.g. 120] **Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] + +- Device: [e.g. Google Pixel 3, Apple iPhone 12] +- OS: [e.g. Android 14, iOS 17] +- Browser [e.g. stock browser, Firefox, Chrome, Safari] +- Version [e.g. 121] **Additional context** Add any other context about the problem here. diff --git a/app/static/js/player_shortcuts.js b/app/static/js/player_shortcuts.js index e5f915d..5c522ee 100644 --- a/app/static/js/player_shortcuts.js +++ b/app/static/js/player_shortcuts.js @@ -44,7 +44,9 @@ const shortcuts = { document.addEventListener("keyup", (e) => { if ( document.activeElement.tagName === "INPUT" || - document.activeElement.id.startsWith("search-suggestion") + document.activeElement.id.startsWith("search-suggestion") || + e.ctrlKey || + e.altKey ) { return; } @@ -60,7 +62,12 @@ document.addEventListener("keyup", (e) => { * @param {KeyboardEvent} e */ document.addEventListener("keydown", (e) => { - if (document.activeElement.tagName === "INPUT") { + if ( + document.activeElement.tagName === "INPUT" || + document.activeElement.id.startsWith("search-suggestion") || + e.ctrlKey || + e.altKey + ) { return; } const action = shortcuts[e.key]; diff --git a/app/static/js/utils.js b/app/static/js/utils.js index 13acd25..b16eb64 100644 --- a/app/static/js/utils.js +++ b/app/static/js/utils.js @@ -54,37 +54,54 @@ function copyTextToClipboard(text) { } function menuer() { - const menus = []; + /** + * @type {HTMLDivElement} + */ + let lastEl = null; /** * @param {string} id */ const __registerPopover = (id) => { - menus.push(id); - document.body.addEventListener("click", __remove); + if (!id) { + return; + } + if (!!lastEl) { + lastEl.style.display = "none"; + document.body.removeEventListener("click", __removePopover); + } + lastEl = document.getElementById(id); + if (!lastEl) { + return; + } + document.body.addEventListener("click", __removePopover); }; /** * @param {MouseEvent} e */ - const __remove = (e) => { - for (let i = 0; i < menus.length; i++) { - const el = document.getElementById(menus[i]); - if (!el) { - continue; - } - const rect = el.getBoundingClientRect(); - const parentRect = el.parentElement.getBoundingClientRect(); - if ( - e.clientX < rect.left || - e.clientX > rect.right || - e.clientY + parentRect.height + 5 < rect.top || - e.clientY > rect.bottom - ) { - menus.splice(i, 1); - el.style.display = "none"; + const __removePopover = (e) => { + const rect = lastEl.getBoundingClientRect(); + const parentRect = lastEl.parentElement.getBoundingClientRect(); + let popupChild = null; + for (const c of lastEl.children.item(0)?.children) { + if (c.tagName === "DIALOG") { + popupChild = c; } } + if (document.activeElement === popupChild) { + return; + } + if ( + e.clientX < rect.left || + e.clientX > rect.right || + e.clientY + parentRect.height + 5 < rect.top || + e.clientY > rect.bottom + ) { + lastEl.style.display = "none"; + lastEl = null; + document.body.removeEventListener("click", __removePopover); + } }; return [__registerPopover]; diff --git a/app/views/pages/song.templ b/app/views/pages/song.templ index fd686d3..a1037c5 100644 --- a/app/views/pages/song.templ +++ b/app/views/pages/song.templ @@ -7,6 +7,7 @@ import ( "dankmuzikk/views/icons" "dankmuzikk/views/components/menus" "math/rand" + "dankmuzikk/views/components/playlist" ) templ Song(song entities.Song) { @@ -53,6 +54,7 @@ templ options(song entities.Song) { "bg-secondary-trans-20", "backdrop-blur-lg", "shadow-sm", "shadow-accent", } > + @playlist.PlaylistsPopup(0, song.YtId)