From 646f61a406de73f5464cfd251e77a403ce24bb6f Mon Sep 17 00:00:00 2001 From: Julien Eluard Date: Tue, 8 Aug 2017 12:05:51 +0200 Subject: [PATCH] Give all components a :display-name. Make sure components use :reagent-render. --- src/status_im/android/core.cljs | 3 ++- src/status_im/chat/views/api/geolocation/views.cljs | 3 ++- src/status_im/chat/views/bottom_info.cljs | 4 +++- src/status_im/chat/views/input/animations/expandable.cljs | 1 + src/status_im/chat/views/input/input.cljs | 6 ++++-- src/status_im/chat/views/message/message.cljs | 4 +++- src/status_im/chat/views/message/request_message.cljs | 3 ++- src/status_im/chats_list/views/inner_item.cljs | 3 ++- src/status_im/components/main_tabs.cljs | 1 + src/status_im/components/sync_state/gradient.cljs | 1 + src/status_im/components/sync_state/offline.cljs | 1 + src/status_im/ios/core.cljs | 3 ++- src/status_im/utils/views.clj | 3 ++- 13 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/status_im/android/core.cljs b/src/status_im/android/core.cljs index f995c27c1d..40968e9f17 100644 --- a/src/status_im/android/core.cljs +++ b/src/status_im/android/core.cljs @@ -116,7 +116,8 @@ (fn [] (.stop http-bridge) (.removeEventListener app-state "change" app-state-change-handler)) - :render + :display-name "root" + :reagent-render (fn [] (when @view-id (let [current-view (validate-current-view @view-id @signed-up?)] diff --git a/src/status_im/chat/views/api/geolocation/views.cljs b/src/status_im/chat/views/api/geolocation/views.cljs index 119ffcd284..6775737246 100644 --- a/src/status_im/chat/views/api/geolocation/views.cljs +++ b/src/status_im/chat/views/api/geolocation/views.cljs @@ -76,7 +76,8 @@ result (reaction (when @geolocation (get-places (:coords @geolocation) cur-loc-geocoded)))] (r/create-class {:component-will-mount #(dispatch [:request-geolocation-update]) - :render + :display-name "current-location-view" + :reagent-render (fn [] (let [_ @result] (when (and @cur-loc-geocoded (> (count (:features @cur-loc-geocoded)) 0)) diff --git a/src/status_im/chat/views/bottom_info.cljs b/src/status_im/chat/views/bottom_info.cljs index 59fd92c936..742238b8e9 100644 --- a/src/status_im/chat/views/bottom_info.cljs +++ b/src/status_im/chat/views/bottom_info.cljs @@ -41,6 +41,7 @@ (r/create-class {:component-did-update on-update + :display-name "container" :reagent-render (fn [height & children] [animated-view {:style (st/bottom-info-container height)} @@ -69,7 +70,8 @@ (let [bottom-info (subscribe [:chat-ui-props :bottom-info]) contacts (subscribe [:get-contacts])] (r/create-class - {:reagent-render + {:display-name "bottom-info-view" + :reagent-render (fn [] (let [{:keys [user-statuses message-status participants]} @bottom-info participants (->> participants diff --git a/src/status_im/chat/views/input/animations/expandable.cljs b/src/status_im/chat/views/input/animations/expandable.cljs index 287fb951d9..c48072c5d8 100644 --- a/src/status_im/chat/views/input/animations/expandable.cljs +++ b/src/status_im/chat/views/input/animations/expandable.cljs @@ -76,6 +76,7 @@ (if height (dispatch [:set-expandable-height key height]) (dispatch [:choose-predefined-expandable-height key :default]))) + :display-name "expandable-view" :reagent-render (fn [{:keys [draggable? custom-header]} & elements] @to-changed-height @changes-counter @max-height diff --git a/src/status_im/chat/views/input/input.cljs b/src/status_im/chat/views/input/input.cljs index 021784eb92..fe1d3bb52f 100644 --- a/src/status_im/chat/views/input/input.cljs +++ b/src/status_im/chat/views/input/input.cljs @@ -180,7 +180,8 @@ set-container-width-fn #(r/set-state component {:container-width %}) command (subscribe [:selected-chat-command])] (r/create-class - {:reagent-render + {:display-name "input-view" + :reagent-render (fn [{:keys [anim-margin single-line-input?]}] (let [{:keys [width height container-width]} (r/state component) command @command] @@ -246,7 +247,8 @@ container-anim-margin (anim/create-value 16) bottom-anim-margin (anim/create-value 14)] (r/create-class - {:component-did-mount + {:display-name "input-container" + :component-did-mount (fn [] (when-not (str/blank? @input-text) (.setValue anim-margin 0) diff --git a/src/status_im/chat/views/message/message.cljs b/src/status_im/chat/views/message/message.cljs index b8a46eae31..7da092d17b 100644 --- a/src/status_im/chat/views/message/message.cljs +++ b/src/status_im/chat/views/message/message.cljs @@ -371,6 +371,7 @@ (r/create-class {:component-did-update on-update + :display-name "message-container" :reagent-render (fn [_ & children] @layout-height @@ -387,7 +388,8 @@ status (subscribe [:get-in [:message-data :user-statuses message-id my-identity]]) preview (subscribe [:get-in [:message-data :preview message-id :markup]])] (r/create-class - {:component-will-mount + {:display-name "chat-message" + :component-will-mount (fn [] (let [{:keys [bot command] :as content} (get-in message [:content]) message' (assoc message :jail-id bot)] diff --git a/src/status_im/chat/views/message/request_message.cljs b/src/status_im/chat/views/message/request_message.cljs index 3ebbd92744..27cf84939a 100644 --- a/src/status_im/chat/views/message/request_message.cljs +++ b/src/status_im/chat/views/message/request_message.cljs @@ -50,7 +50,8 @@ :answered? answered? :loop? loop?}] (r/create-class - {:component-did-mount + {:display-name "request-button" + :component-did-mount (if @answered? (fn []) #(request-button-animation-logic context)) :component-will-unmount #(reset! loop? false) diff --git a/src/status_im/chats_list/views/inner_item.cljs b/src/status_im/chats_list/views/inner_item.cljs index 793e6cf2e2..e28d896a1d 100644 --- a/src/status_im/chats_list/views/inner_item.cljs +++ b/src/status_im/chats_list/views/inner_item.cljs @@ -21,7 +21,8 @@ (let [message (subscribe [:get-last-message chat-id]) preview (subscribe [:get-last-message-short-preview chat-id])] (r/create-class - {:component-will-mount + {:display-name "message-content-text" + :component-will-mount (fn [] (when (and (get-in @message [:content :command]) (not @preview)) diff --git a/src/status_im/components/main_tabs.cljs b/src/status_im/components/main_tabs.cljs index 03989fe7be..8a4b18ce42 100644 --- a/src/status_im/components/main_tabs.cljs +++ b/src/status_im/components/main_tabs.cljs @@ -94,6 +94,7 @@ (let [to (scroll-to @prev-view-id @view-id)] (a/put! scroll-start [@main-swiper to])))) (reset! tabs-were-hidden? @tabs-hidden?)) + :display-name "main-tabs" :reagent-render (fn [] [view common-st/flex diff --git a/src/status_im/components/sync_state/gradient.cljs b/src/status_im/components/sync_state/gradient.cljs index e49985e31a..b8a84753af 100644 --- a/src/status_im/components/sync_state/gradient.cljs +++ b/src/status_im/components/sync_state/gradient.cljs @@ -105,6 +105,7 @@ on-update :component-did-update on-update + :display-name "sync-state-gradient-view" :reagent-render (fn [] [view st/sync-style-gradient diff --git a/src/status_im/components/sync_state/offline.cljs b/src/status_im/components/sync_state/offline.cljs index d8a46edf0e..b6e156f5b6 100644 --- a/src/status_im/components/sync_state/offline.cljs +++ b/src/status_im/components/sync_state/offline.cljs @@ -31,6 +31,7 @@ on-update :component-did-update on-update + :display-name "offline-view" :reagent-render (fn [{:keys [top]}] (when (or (= @network-status :offline) (= @sync-state :offline)) diff --git a/src/status_im/ios/core.cljs b/src/status_im/ios/core.cljs index 01ce5244c3..9a28c42d8d 100644 --- a/src/status_im/ios/core.cljs +++ b/src/status_im/ios/core.cljs @@ -86,7 +86,8 @@ :component-will-unmount (fn [] (.stop http-bridge)) - :render + :display-name "root" + :reagent-render (fn [] (when @view-id (let [current-view (validate-current-view @view-id @signed-up?)] diff --git a/src/status_im/utils/views.clj b/src/status_im/utils/views.clj index bde46c0d3a..0030982faa 100644 --- a/src/status_im/utils/views.clj +++ b/src/status_im/utils/views.clj @@ -58,7 +58,8 @@ (let [~@vars-bindings] (apply ~f ~args)))]))) (into {})) - {:reagent-render + {:display-name (name '~n) + :reagent-render (fn ~params (let [~@vars-bindings] ~body))}))))))