suggestions from jail
This commit is contained in:
parent
474729f230
commit
77a53cf040
|
@ -61,7 +61,8 @@
|
||||||
path
|
path
|
||||||
params
|
params
|
||||||
#(dispatch [:suggestions-handler {:command command
|
#(dispatch [:suggestions-handler {:command command
|
||||||
:content content} %]))))
|
:content content
|
||||||
|
:chat-id current-chat-id} %]))))
|
||||||
|
|
||||||
(register-handler :start-cancel-command
|
(register-handler :start-cancel-command
|
||||||
(u/side-effect!
|
(u/side-effect!
|
||||||
|
|
|
@ -106,6 +106,4 @@
|
||||||
|
|
||||||
(register-sub :get-content-suggestions
|
(register-sub :get-content-suggestions
|
||||||
(fn [db _]
|
(fn [db _]
|
||||||
(let [command (reaction (commands/get-chat-command @db))
|
(reaction (get-in @db [:suggestions (:current-chat-id @db)]))))
|
||||||
text (reaction (commands/get-chat-command-content @db))]
|
|
||||||
(reaction (get-content-suggestions @command @text)))))
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
(list-item [suggestion-list-item row]))
|
(list-item [suggestion-list-item row]))
|
||||||
|
|
||||||
(defview content-suggestions-view []
|
(defview content-suggestions-view []
|
||||||
[suggestions [:get :current-suggestion]]
|
[suggestions [:get-content-suggestions]]
|
||||||
(when (seq suggestions)
|
(when (seq suggestions)
|
||||||
[view st/container
|
[view st/container
|
||||||
[touchable-highlight {:style st/drag-down-touchable
|
[touchable-highlight {:style st/drag-down-touchable
|
||||||
|
|
|
@ -59,9 +59,9 @@
|
||||||
[touchable-highlight {:on-press (fn []
|
[touchable-highlight {:on-press (fn []
|
||||||
(reset! loop? false)
|
(reset! loop? false)
|
||||||
(set-chat-command msg-id command))
|
(set-chat-command msg-id command))
|
||||||
:style st/command-request-image-touchable
|
:style st/command-request-image-touchable}
|
||||||
;:accessibility-label (label command)
|
;:accessibility-label (label command)
|
||||||
}
|
|
||||||
[animated-view {:style (st/command-request-image-view command scale-anim-val)}
|
[animated-view {:style (st/command-request-image-view command scale-anim-val)}
|
||||||
[image {:source {:uri (:icon command)}
|
[image {:source {:uri (:icon command)}
|
||||||
:style st/command-request-image}]]])})))
|
:style st/command-request-image}]]])})))
|
||||||
|
|
|
@ -32,7 +32,4 @@
|
||||||
(defview response-suggestions-view []
|
(defview response-suggestions-view []
|
||||||
[suggestions [:get-content-suggestions]]
|
[suggestions [:get-content-suggestions]]
|
||||||
(when (seq suggestions)
|
(when (seq suggestions)
|
||||||
[view st/suggestions-container
|
suggestions))
|
||||||
[list-view {:dataSource (to-datasource suggestions)
|
|
||||||
:keyboardShouldPersistTaps true
|
|
||||||
:renderRow render-row}]]))
|
|
||||||
|
|
|
@ -36,9 +36,9 @@
|
||||||
(apply handler params))))
|
(apply handler params))))
|
||||||
|
|
||||||
(defn suggestions-handler
|
(defn suggestions-handler
|
||||||
[db [_ response-json]]
|
[db [{:keys [chat-id]} response-json]]
|
||||||
(let [response (json->cljs response-json)]
|
(let [response (json->cljs response-json)]
|
||||||
(assoc db :current-suggestion (generate-hiccup response))))
|
(assoc-in db [:suggestions chat-id] (generate-hiccup response))))
|
||||||
|
|
||||||
(defn suggestions-events-handler!
|
(defn suggestions-events-handler!
|
||||||
[db [[n data]]]
|
[db [[n data]]]
|
||||||
|
|
Loading…
Reference in New Issue