From 156421bc9b4bf8652edaddacf4a5eb7d95bc7a3e Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Thu, 1 Feb 2024 21:40:35 +0100 Subject: feat(frontend): hide search form on leaving search page --- src/frontend/tubo/events.cljs | 3 ++- src/frontend/tubo/routes.cljs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/frontend') diff --git a/src/frontend/tubo/events.cljs b/src/frontend/tubo/events.cljs index dcadf88..afabc3e 100644 --- a/src/frontend/tubo/events.cljs +++ b/src/frontend/tubo/events.cljs @@ -171,7 +171,8 @@ (rf/reg-event-db ::toggle-search-form (fn [db _] - (assoc db :show-search-form (not (:show-search-form db))))) + (when-not (= (-> db :current-match :path) "search") + (assoc db :show-search-form (not (:show-search-form db)))))) (rf/reg-event-fx ::toggle-mobile-nav diff --git a/src/frontend/tubo/routes.cljs b/src/frontend/tubo/routes.cljs index edbcb00..c089322 100644 --- a/src/frontend/tubo/routes.cljs +++ b/src/frontend/tubo/routes.cljs @@ -21,7 +21,8 @@ :name ::search :controllers [{:parameters {:query [:q :serviceId]} :start (fn [{{:keys [serviceId q]} :query}] - (rf/dispatch [::events/get-search-page serviceId q]))}]}] + (rf/dispatch [::events/get-search-page serviceId q])) + :stop #(rf/dispatch [::events/toggle-search-form])}]}] ["/stream" {:view stream/stream :name ::stream :controllers [{:parameters {:query [:url]} -- cgit v1.2.3