-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#9789] Add a loading indicator and button to username input of start…
… new chat Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
- Loading branch information
1 parent
87ce82e
commit d64ba1b
Showing
13 changed files
with
160 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
(ns status-im.ui.screens.add-new.new-chat.styles | ||
(:require [status-im.ui.components.colors :as colors])) | ||
|
||
(def error-message | ||
{:margin-horizontal 14 | ||
:margin-top 4 | ||
(def message | ||
{:margin-horizontal 16 | ||
:align-self :center | ||
:font-size 12 | ||
:color colors/red}) | ||
:color colors/gray}) | ||
|
||
(def list-title | ||
{:margin-top 24 | ||
:margin-left 16 | ||
:font-size 14 | ||
:color colors/gray}) | ||
{:margin-top 24 | ||
:margin-left 16 | ||
:font-size 14 | ||
:color colors/gray}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
(ns status-im.utils.debounce | ||
(:require [re-frame.core :as re-frame])) | ||
|
||
(def timeout (atom nil)) | ||
(def timeout (atom {})) | ||
|
||
(defn clear [event-key] | ||
(when-let [event-timeout (get @timeout event-key)] | ||
(js/clearTimeout event-timeout))) | ||
|
||
(defn clear-all [] | ||
(doseq [[_ v] @timeout] | ||
(js/clearTimeout v))) | ||
|
||
(defn debounce-and-dispatch | ||
"Dispatches event only if there were no calls of this function in period of *time* ms" | ||
[event time] | ||
(when @timeout (js/clearTimeout @timeout)) | ||
(reset! timeout (js/setTimeout #(re-frame/dispatch event) time))) | ||
(let [event-key (first event)] | ||
(clear event-key) | ||
(swap! timeout assoc event-key (js/setTimeout #(re-frame/dispatch event) time)))) | ||
|
||
(defn clear [] | ||
(when @timeout (js/clearTimeout @timeout))) | ||
|
||
(def chill? (atom false)) | ||
(def chill (atom {})) | ||
|
||
(defn dispatch-and-chill | ||
"Dispateches event and ignores next calls in period of *time* ms" | ||
[event time] | ||
(when-not @chill? | ||
(reset! chill? true) | ||
(js/setTimeout #(reset! chill? false) time) | ||
(re-frame/dispatch event))) | ||
|
||
(let [event-key (first event)] | ||
(when-not (get @chill event-key) | ||
(swap! chill assoc event-key true) | ||
(js/setTimeout #(swap! chill assoc event-key false) time) | ||
(re-frame/dispatch event)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters