Skip to content

Commit

Permalink
Merge pull request #81 from mbaraa/dev
Browse files Browse the repository at this point in the history
release v0.1.4
  • Loading branch information
mbaraa authored Jun 13, 2024
2 parents 28ecf27 + c71783d commit 908db83
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 33 deletions.
26 changes: 14 additions & 12 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Describe the bug**
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 '....'
Expand All @@ -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.
11 changes: 9 additions & 2 deletions app/static/js/player_shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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];
Expand Down
55 changes: 36 additions & 19 deletions app/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 2 additions & 0 deletions app/views/pages/song.templ
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"dankmuzikk/views/icons"
"dankmuzikk/views/components/menus"
"math/rand"
"dankmuzikk/views/components/playlist"
)

templ Song(song entities.Song) {
Expand Down Expand Up @@ -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)
<button
class={
"popover-trigger", "p-2", "rounded-md", "hover:bg-accent-trans-20",
Expand Down

0 comments on commit 908db83

Please sign in to comment.