aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2024-02-01 21:40:35 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2024-02-01 21:40:35 +0100
commit156421bc9b4bf8652edaddacf4a5eb7d95bc7a3e (patch)
tree4e724d6b54bbbb0d38ca7f0efcf47ffaa4b3b376 /src
parent22cd895473596d49fc3ece8f4c05acb252e4db03 (diff)
feat(frontend): hide search form on leaving search page
Diffstat (limited to 'src')
-rw-r--r--src/frontend/tubo/events.cljs3
-rw-r--r--src/frontend/tubo/routes.cljs3
2 files changed, 4 insertions, 2 deletions
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]}