Skip to content

Commit

Permalink
Fix click-to-play piano preview region for live blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
cofinley committed Sep 14, 2023
1 parent 4ab79c2 commit bc90608
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/why_does_that_sound_good/components/live_suggestion_panel.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
(re-frame/dispatch [::events/on-chord-suggestion-hover s])
(reset! hovered? true))
:on-mouse-leave #(do (re-frame/dispatch [::events/on-chord-suggestion-hover nil])
(reset! hovered? false))
:title "Click to play"
:on-click #(re-frame/dispatch [::events/on-notes-play (:chord-notes s)])}
(reset! hovered? false))}
[:div
{:class (str/join " " [(if @hovered? "visible" "invisible") "relative right-4"])}
[button
Expand All @@ -37,6 +35,8 @@
(utils/music-structure->str s)]
[similarity-badge (:similarity s)]]
[:div
{:on-click #(re-frame/dispatch [::events/on-notes-play (:chord-notes s)])
:title "Click to play"}
[piano-preview (:notes block) :chord-notes (:chord-notes s)]]])))

(defn live-block-chord-suggestions [block suggestions & {:keys [current?]
Expand All @@ -60,8 +60,6 @@
:on-mouse-leave #(re-frame/dispatch [::events/on-block-hover-toggle nil])}
[:div
{:class " flex items-center justify-between w-full cursor-pointer py-3 px-8 dark:bg-neutral-600 rounded-t-xl"
:on-click #(re-frame/dispatch [::events/on-notes-play (:notes block)])
:title "Click to play"
:on-mouse-enter #(reset! hovered? true)
:on-mouse-leave #(reset! hovered? false)}
[:div
Expand All @@ -79,7 +77,10 @@
[:span
{:class "dark:text-neutral-100"}
"Input"]
[piano-preview (:notes block)]]
[:div
{:on-click #(re-frame/dispatch [::events/on-notes-play (:notes block)])
:title "Click to play"}
[piano-preview (:notes block)]]]
[live-block-chord-suggestions block chord-suggestions :current? current?]]))))

(defn live-section-panel []
Expand All @@ -89,11 +90,11 @@
[:<>
(when (seq live-section-blocks)
[button
{:class "flex gap-x-2 items-center self-start"
:on-click #(when (js/confirm "Are you sure you want to delete all live blocks?")
(re-frame/dispatch [::events/on-section-clear :live]))}
[delete-icon]
"Clear Live Blocks"])
{:class "flex gap-x-2 items-center self-start"
:on-click #(when (js/confirm "Are you sure you want to delete all live blocks?")
(re-frame/dispatch [::events/on-section-clear :live]))}
[delete-icon]
"Clear Live Blocks"])
[:div
{:class (str/join " " [(when (= 1 max-live-blocks) "justify-center") "flex grow gap-x-4 overflow-y-auto"])}
(when (< 1 max-live-blocks)
Expand Down

0 comments on commit bc90608

Please sign in to comment.