From 238519cb69ac43028507fc47489db3f1090517c9 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Thu, 29 Feb 2024 13:59:43 +0100 Subject: [PATCH] :bug: Fix In history panel, If I click on the arrow to see more, it undoes until that change --- .../app/main/ui/workspace/sidebar/history.cljs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/history.cljs b/frontend/src/app/main/ui/workspace/sidebar/history.cljs index b124e6215..d592efe4f 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/history.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/history.cljs @@ -8,12 +8,14 @@ (:require-macros [app.main.style :as stl]) (:require [app.common.data :as d] + [app.common.data.macros :as dm] [app.main.data.events :as ev] [app.main.data.workspace :as dw] [app.main.data.workspace.common :as dwc] [app.main.refs :as refs] [app.main.store :as st] [app.main.ui.icons :as i] + [app.util.dom :as dom] [app.util.i18n :refer [t] :as i18n] [cuerdas.core :as str] [okulary.core :as l] @@ -283,8 +285,18 @@ nil)])) (mf/defc history-entry [{:keys [locale entry idx-entry disabled? current?]}] + {::mf/props :obj} (let [hover? (mf/use-state false) - show-detail? (mf/use-state false)] + show-detail? (mf/use-state false) + toggle-show-detail + (mf/use-fn + (fn [event] + (let [has-entry? (-> (dom/get-current-target event) + (dom/get-data "has-entry") + (parse-boolean))] + (dom/stop-propagation event) + (when has-entry? + (swap! show-detail? not)))))] [:div {:class (stl/css-case :history-entry true :disabled disabled? :current current? @@ -301,8 +313,8 @@ (when (:detail entry) [:div {:class (stl/css-case :history-entry-summary-button true :button-opened @show-detail?) - :on-click #(when (:detail entry) - (swap! show-detail? not))} + :on-click toggle-show-detail + :data-has-entry (dm/str (not (nil? (:detail entry))))} i/arrow-refactor])] (when @show-detail?