From 7846682223b9a0eccd6d19135103f21cb55bf946 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 11 Feb 2021 11:34:24 +0100 Subject: [PATCH] :bug: Fixes logo icon navigation in viewer --- CHANGES.md | 1 + frontend/src/app/main/data/viewer.cljs | 9 +++++++++ frontend/src/app/main/ui/viewer/header.cljs | 11 +++-------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 3eef0a134..1fe83c1b6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -24,6 +24,7 @@ - Fix 404 when acces shared link [#615](https://github.com/penpot/penpot/issues/615) - Fix show correct error when google auth is disabled - Fix apply a color to a text selection from color palette was not working +- Fix logo icon in viewer should go to dashboard ### Community contributions by (Thank you! :heart:) diff --git a/frontend/src/app/main/data/viewer.cljs b/frontend/src/app/main/data/viewer.cljs index 550b5ddb9..cc2a09ea6 100644 --- a/frontend/src/app/main/data/viewer.cljs +++ b/frontend/src/app/main/data/viewer.cljs @@ -417,3 +417,12 @@ (update [_ state] (assoc-in state [:viewer-local :hover] (when hover? id))))) + +(defn go-to-dashboard + ([] (go-to-dashboard nil)) + ([{:keys [team-id]}] + (ptk/reify ::go-to-dashboard + ptk/WatchEvent + (watch [_ state stream] + (let [team-id (or team-id (get-in state [:viewer-data :project :team-id]))] + (rx/of (rt/nav :dashboard-projects {:team-id team-id}))))))) diff --git a/frontend/src/app/main/ui/viewer/header.cljs b/frontend/src/app/main/ui/viewer/header.cljs index 59310a1de..c97025f13 100644 --- a/frontend/src/app/main/ui/viewer/header.cljs +++ b/frontend/src/app/main/ui/viewer/header.cljs @@ -196,14 +196,9 @@ on-goback (mf/use-callback - (mf/deps project-id file-id page-id anonymous?) - (fn [] - (if anonymous? - (st/emit! (rt/nav :login)) - (st/emit! (rt/nav :workspace - {:project-id project-id - :file-id file-id} - {:page-id page-id}))))) + (mf/deps project) + (st/emitf (dv/go-to-dashboard project))) + on-edit (mf/use-callback (mf/deps project-id file-id page-id)