Просмотр исходного кода

enhance(mobile): add sync button to restart rtc

so that users don't have to quit app to sync
Tienson Qin 6 месяцев назад
Родитель
Сommit
563b185a47
1 измененных файлов с 10 добавлено и 1 удалено
  1. 10 1
      src/main/frontend/components/rtc/indicator.cljs

+ 10 - 1
src/main/frontend/components/rtc/indicator.cljs

@@ -5,6 +5,7 @@
             [frontend.config :as config]
             [frontend.db :as db]
             [frontend.flows :as flows]
+            [frontend.handler.db-based.rtc :as rtc-handler]
             [frontend.handler.db-based.rtc-flows :as rtc-flows]
             [frontend.state :as state]
             [frontend.ui :as ui]
@@ -138,7 +139,15 @@
                remote-tx (assoc :remote-tx remote-tx)
                rtc-state (assoc :rtc-state rtc-state))
              pprint/pprint
-             with-out-str)]])]))
+             with-out-str)]])
+     (when-not (= rtc-state :open)
+       [:div.mt-4
+        (shui/button {:variant :default
+                      :size :sm
+                      :on-click (fn []
+                                  (rtc-handler/<rtc-start! (state/get-current-repo)
+                                                           {:stop-before-start? true}))}
+                     "Start sync")])]))
 
 (rum/defc indicator
   []