chat inputs/suggestions/commands
This commit is contained in:
parent
410a06c07c
commit
4b1b5a9449
|
@ -11,7 +11,7 @@
|
||||||
[syng-im.chat.screen :refer [chat]]
|
[syng-im.chat.screen :refer [chat]]
|
||||||
[syng-im.components.chats.chats-list :refer [chats-list]]
|
[syng-im.components.chats.chats-list :refer [chats-list]]
|
||||||
[syng-im.components.chats.new-group :refer [new-group]]
|
[syng-im.components.chats.new-group :refer [new-group]]
|
||||||
[syng-im.participants.views.new :refer [new-participants]]
|
[syng-im.participants.views.create :refer [new-participants]]
|
||||||
[syng-im.participants.views.remove :refer [remove-participants]]
|
[syng-im.participants.views.remove :refer [remove-participants]]
|
||||||
[syng-im.utils.logging :as log]
|
[syng-im.utils.logging :as log]
|
||||||
[syng-im.utils.utils :refer [toast]]
|
[syng-im.utils.utils :refer [toast]]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(ns syng-im.components.chat.input.input-styles
|
(ns syng-im.chat.styles.input
|
||||||
(:require [syng-im.components.styles :refer [font
|
(:require [syng-im.components.styles :refer [font
|
||||||
color-white
|
color-white
|
||||||
color-blue
|
color-blue
|
|
@ -1,4 +1,4 @@
|
||||||
(ns syng-im.components.chat.plain-message-input-styles
|
(ns syng-im.chat.styles.plain-input
|
||||||
(:require [syng-im.components.styles :refer [font
|
(:require [syng-im.components.styles :refer [font
|
||||||
text2-color
|
text2-color
|
||||||
color-white
|
color-white
|
|
@ -1,4 +1,4 @@
|
||||||
(ns syng-im.components.chat.suggestions-styles
|
(ns syng-im.chat.styles.suggestions
|
||||||
(:require [syng-im.components.styles :refer [font color-white]]))
|
(:require [syng-im.components.styles :refer [font color-white]]))
|
||||||
|
|
||||||
(def suggestion-item-container
|
(def suggestion-item-container
|
|
@ -1,4 +1,4 @@
|
||||||
(ns syng-im.components.chat.input.simple-command
|
(ns syng-im.chat.views.command
|
||||||
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||||
[syng-im.components.react :refer [view
|
[syng-im.components.react :refer [view
|
||||||
image
|
image
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
text-input
|
text-input
|
||||||
touchable-highlight]]
|
touchable-highlight]]
|
||||||
[syng-im.resources :as res]
|
[syng-im.resources :as res]
|
||||||
[syng-im.components.chat.input.input-styles :as st]))
|
[syng-im.chat.styles.input :as st]))
|
||||||
|
|
||||||
(defn cancel-command-input []
|
(defn cancel-command-input []
|
||||||
(dispatch [:cancel-command]))
|
(dispatch [:cancel-command]))
|
|
@ -0,0 +1,6 @@
|
||||||
|
(ns syng-im.chat.views.confirmation-code
|
||||||
|
(:require
|
||||||
|
[syng-im.chat.views.command :refer [simple-command-input-view]]))
|
||||||
|
|
||||||
|
(defn confirmation-code-input-view [command]
|
||||||
|
[simple-command-input-view command {:keyboardType :numeric}])
|
|
@ -0,0 +1,9 @@
|
||||||
|
(ns syng-im.chat.views.money
|
||||||
|
(:require
|
||||||
|
[syng-im.chat.views.command :refer [simple-command-input-view]]
|
||||||
|
[syng-im.chat.styles.input :as st]))
|
||||||
|
|
||||||
|
(defn money-input-view [command]
|
||||||
|
[simple-command-input-view command
|
||||||
|
{:keyboardType :numeric
|
||||||
|
:style st/money-input}])
|
|
@ -2,13 +2,13 @@
|
||||||
(:require
|
(:require
|
||||||
[re-frame.core :refer [subscribe]]
|
[re-frame.core :refer [subscribe]]
|
||||||
[syng-im.components.react :refer [view]]
|
[syng-im.components.react :refer [view]]
|
||||||
[syng-im.components.chat.plain-message-input :refer [plain-message-input-view]]
|
[syng-im.chat.views.plain-input :refer [plain-message-input-view]]
|
||||||
[syng-im.components.chat.input.simple-command :refer [simple-command-input-view]]
|
[syng-im.chat.views.command :refer [simple-command-input-view]]
|
||||||
[syng-im.components.chat.input.phone :refer [phone-input-view]]
|
[syng-im.chat.views.phone :refer [phone-input-view]]
|
||||||
[syng-im.components.chat.input.password :refer [password-input-view]]
|
[syng-im.chat.views.password :refer [password-input-view]]
|
||||||
[syng-im.components.chat.input.confirmation-code :refer [confirmation-code-input-view]]
|
[syng-im.chat.views.confirmation-code :refer [confirmation-code-input-view]]
|
||||||
[syng-im.components.chat.input.money :refer [money-input-view]]
|
[syng-im.chat.views.money :refer [money-input-view]]
|
||||||
[syng-im.components.chat.input.simple-command-staged :refer [simple-command-staged-view]]
|
[syng-im.chat.views.staged-command :refer [simple-command-staged-view]]
|
||||||
[syng-im.chat.styles.message :as st]))
|
[syng-im.chat.styles.message :as st]))
|
||||||
|
|
||||||
(defn staged-command-view [stage-command]
|
(defn staged-command-view [stage-command]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns syng-im.components.chat.input.password
|
(ns syng-im.chat.views.password
|
||||||
(:require
|
(:require
|
||||||
[syng-im.components.chat.input.simple-command
|
[syng-im.chat.views.command
|
||||||
:refer [simple-command-input-view]]))
|
:refer [simple-command-input-view]]))
|
||||||
|
|
||||||
(defn password-input-view [command]
|
(defn password-input-view [command]
|
|
@ -1,6 +1,6 @@
|
||||||
(ns syng-im.components.chat.input.phone
|
(ns syng-im.chat.views.phone
|
||||||
(:require
|
(:require
|
||||||
[syng-im.components.chat.input.simple-command
|
[syng-im.chat.views.command
|
||||||
:refer [simple-command-input-view]]))
|
:refer [simple-command-input-view]]))
|
||||||
|
|
||||||
(defn phone-input-view [command]
|
(defn phone-input-view [command]
|
|
@ -1,11 +1,11 @@
|
||||||
(ns syng-im.components.chat.plain-message-input
|
(ns syng-im.chat.views.plain-input
|
||||||
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||||
[syng-im.components.react :refer [view
|
[syng-im.components.react :refer [view
|
||||||
icon
|
icon
|
||||||
touchable-highlight
|
touchable-highlight
|
||||||
text-input]]
|
text-input]]
|
||||||
[syng-im.components.chat.suggestions :refer [suggestions-view]]
|
[syng-im.chat.views.suggestions :refer [suggestions-view]]
|
||||||
[syng-im.components.chat.plain-message-input-styles :as st]))
|
[syng-im.chat.styles.plain-input :as st]))
|
||||||
|
|
||||||
(defn set-input-message [message]
|
(defn set-input-message [message]
|
||||||
(dispatch [:set-chat-input-text message]))
|
(dispatch [:set-chat-input-text message]))
|
|
@ -1,11 +1,11 @@
|
||||||
(ns syng-im.components.chat.input.simple-command-staged
|
(ns syng-im.chat.views.staged-command
|
||||||
(:require [re-frame.core :refer [subscribe dispatch]]
|
(:require [re-frame.core :refer [subscribe dispatch]]
|
||||||
[syng-im.components.react :refer [view
|
[syng-im.components.react :refer [view
|
||||||
image
|
image
|
||||||
text
|
text
|
||||||
touchable-highlight]]
|
touchable-highlight]]
|
||||||
[syng-im.resources :as res]
|
[syng-im.resources :as res]
|
||||||
[syng-im.components.chat.input.input-styles :as st]))
|
[syng-im.chat.styles.input :as st]))
|
||||||
|
|
||||||
(defn cancel-command-input [staged-command]
|
(defn cancel-command-input [staged-command]
|
||||||
(dispatch [:unstage-command staged-command]))
|
(dispatch [:unstage-command staged-command]))
|
|
@ -1,4 +1,4 @@
|
||||||
(ns syng-im.components.chat.suggestions
|
(ns syng-im.chat.views.suggestions
|
||||||
(:require-macros
|
(:require-macros
|
||||||
[natal-shell.core :refer [with-error-view]])
|
[natal-shell.core :refer [with-error-view]])
|
||||||
(:require [re-frame.core :refer [subscribe dispatch]]
|
(:require [re-frame.core :refer [subscribe dispatch]]
|
||||||
|
@ -8,20 +8,21 @@
|
||||||
list-view
|
list-view
|
||||||
list-item]]
|
list-item]]
|
||||||
[syng-im.utils.listview :refer [to-datasource]]
|
[syng-im.utils.listview :refer [to-datasource]]
|
||||||
[syng-im.components.chat.suggestions-styles :as st]))
|
[syng-im.chat.styles.suggestions :as st]))
|
||||||
|
|
||||||
(defn set-command-input [command]
|
(defn set-command-input [command]
|
||||||
(dispatch [:set-chat-command command]))
|
(dispatch [:set-chat-command command]))
|
||||||
|
|
||||||
(defn suggestion-list-item [suggestion]
|
(defn suggestion-list-item
|
||||||
|
[{:keys [description command]
|
||||||
|
label :text
|
||||||
|
:as suggestion}]
|
||||||
[touchable-highlight
|
[touchable-highlight
|
||||||
{:onPress #(set-command-input (keyword (:command suggestion)))}
|
{:onPress #(set-command-input (keyword command))}
|
||||||
[view st/suggestion-item-container
|
[view st/suggestion-item-container
|
||||||
[view (st/suggestion-background suggestion)
|
[view (st/suggestion-background suggestion)
|
||||||
[text {:style st/suggestion-text}
|
[text {:style st/suggestion-text} label]]
|
||||||
(:text suggestion)]]
|
[text {:style st/suggestion-description} description]]])
|
||||||
[text {:style st/suggestion-description}
|
|
||||||
(:description suggestion)]]])
|
|
||||||
|
|
||||||
(defn render-row [row _ _]
|
(defn render-row [row _ _]
|
||||||
(list-item [suggestion-list-item (js->clj row :keywordize-keys true)]))
|
(list-item [suggestion-list-item (js->clj row :keywordize-keys true)]))
|
|
@ -1,7 +0,0 @@
|
||||||
(ns syng-im.components.chat.input.confirmation-code
|
|
||||||
(:require
|
|
||||||
[syng-im.components.chat.input.simple-command
|
|
||||||
:refer [simple-command-input-view]]))
|
|
||||||
|
|
||||||
(defn confirmation-code-input-view [command]
|
|
||||||
[simple-command-input-view command {:keyboardType :numeric}])
|
|
|
@ -1,10 +0,0 @@
|
||||||
(ns syng-im.components.chat.input.money
|
|
||||||
(:require
|
|
||||||
[syng-im.components.chat.input.simple-command
|
|
||||||
:refer [simple-command-input-view]]
|
|
||||||
[syng-im.components.chat.input.input-styles :as st]))
|
|
||||||
|
|
||||||
(defn money-input-view [command]
|
|
||||||
[simple-command-input-view command
|
|
||||||
{:keyboardType :numeric
|
|
||||||
:style st/money-input}])
|
|
|
@ -1,4 +1,4 @@
|
||||||
(ns syng-im.participants.views.new
|
(ns syng-im.participants.views.create
|
||||||
(:require [re-frame.core :refer [subscribe dispatch]]
|
(:require [re-frame.core :refer [subscribe dispatch]]
|
||||||
[syng-im.resources :as res]
|
[syng-im.resources :as res]
|
||||||
[syng-im.components.react :refer [view]]
|
[syng-im.components.react :refer [view]]
|
Loading…
Reference in New Issue