fix #476
This commit is contained in:
parent
3efb8a7bb8
commit
ae856a9269
|
@ -187,6 +187,11 @@
|
|||
(map #(vector (:message-id %) %))
|
||||
(into {}))))))
|
||||
|
||||
(register-sub :get-request
|
||||
(fn [_ [_ message-id]]
|
||||
(let [requests (subscribe [:get-requests-map])]
|
||||
(reaction (get @requests message-id)))))
|
||||
|
||||
(register-sub :get-current-request
|
||||
(fn []
|
||||
(let [requests (subscribe [:get-requests-map])
|
||||
|
|
|
@ -38,6 +38,15 @@
|
|||
(when icon-path
|
||||
[icon icon-path (st/command-icon color)])])
|
||||
|
||||
(defn request-info-text [name chat-id added]
|
||||
(let [name' (shortened-name (or name chat-id) 20)]
|
||||
(str "By " name' ", "
|
||||
(dt/format-date "MMM" added)
|
||||
" "
|
||||
(dt/get-ordinal-date added)
|
||||
" at "
|
||||
(dt/format-date "HH:mm" added))))
|
||||
|
||||
(defview info-container
|
||||
[command]
|
||||
[{:keys [name chat-id]} [:get-current-chat]
|
||||
|
@ -46,14 +55,7 @@
|
|||
[text {:style st/command-name}
|
||||
(str (:description command) " " (label :t/request))]
|
||||
(when added
|
||||
(let [name' (shortened-name (or name chat-id) 20)]
|
||||
[text {:style st/message-info}
|
||||
(str "By " name' ", "
|
||||
(dt/format-date "MMM" added)
|
||||
" "
|
||||
(dt/get-ordinal-date added)
|
||||
" at "
|
||||
(dt/format-date "HH:mm" added))]))])
|
||||
[text {:style st/message-info} (request-info-text name chat-id added)])])
|
||||
|
||||
(defn request-info [response-height]
|
||||
(let [layout-height (subscribe [:max-layout-height :default])
|
||||
|
|
|
@ -19,26 +19,30 @@
|
|||
[status-im.utils.platform :refer [ios?]]
|
||||
[status-im.chat.suggestions-responder :as resp]
|
||||
[status-im.chat.constants :as c]
|
||||
[status-im.i18n :refer [label]]))
|
||||
[status-im.i18n :refer [label]]
|
||||
[status-im.chat.views.response :as response]))
|
||||
|
||||
(defn set-command-input [command]
|
||||
(dispatch [:set-chat-command command]))
|
||||
|
||||
(defview request-item [{:keys [type message-id]}]
|
||||
[{:keys [color icon description] :as response} [:get-response type]]
|
||||
[{:keys [color description]
|
||||
icon-path :icon
|
||||
:as response} [:get-response type]
|
||||
{:keys [name chat-id]} [:get-current-chat]
|
||||
{:keys [added]} [:get-request message-id]]
|
||||
[touchable-highlight
|
||||
{:on-press #(dispatch [:set-response-chat-command message-id type])}
|
||||
[view st/request-container
|
||||
[view st/request-icon-container
|
||||
[view (st/request-icon-background color)
|
||||
(if icon
|
||||
[image {:source {:uri icon}
|
||||
:style st/request-icon}])]]
|
||||
(when icon-path
|
||||
[icon icon-path st/request-icon])]]
|
||||
[view st/request-info-container
|
||||
[text {:style st/request-info-description} description]
|
||||
;; todo stub
|
||||
[text {:style st/request-message-info}
|
||||
"By console, today at 14:50"]]]])
|
||||
(when added
|
||||
[text {:style st/request-message-info}
|
||||
(response/request-info-text name chat-id added)])]]])
|
||||
|
||||
(defn suggestion-list-item
|
||||
[[command {:keys [title description]
|
||||
|
|
Loading…
Reference in New Issue