Give all components a :display-name.

Make sure components use :reagent-render.
This commit is contained in:
Julien Eluard 2017-08-08 12:05:51 +02:00 committed by Roman Volosovskyi
parent 9e73097446
commit 646f61a406
13 changed files with 26 additions and 10 deletions

View File

@ -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?)]

View File

@ -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))

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)]

View File

@ -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)

View File

@ -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))

View File

@ -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

View File

@ -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

View File

@ -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))

View File

@ -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?)]

View File

@ -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))}))))))