[15128-followup] PR comments and cleanup (#16350)
This commit is contained in:
parent
7aa40b8adf
commit
88bb84bb3e
|
@ -4,8 +4,14 @@
|
|||
[react-native.core :as rn]
|
||||
[status-im2.constants :as constants]
|
||||
[utils.re-frame :as rf]
|
||||
[status-im2.common.mute-chat-drawer.style :as style]
|
||||
[utils.chats :as chat-utils]))
|
||||
[status-im2.common.mute-chat-drawer.style :as style]))
|
||||
|
||||
(defn not-community-chat?
|
||||
[chat-type]
|
||||
(contains? #{constants/public-chat-type
|
||||
constants/private-group-chat-type
|
||||
constants/one-to-one-chat-type}
|
||||
chat-type))
|
||||
|
||||
(defn hide-sheet-and-dispatch
|
||||
[event]
|
||||
|
@ -20,7 +26,7 @@
|
|||
:size :paragraph-2
|
||||
:style (style/header-text)}
|
||||
(i18n/label
|
||||
(if (chat-utils/not-community-chat? chat-type)
|
||||
(if (not-community-chat? chat-type)
|
||||
:t/mute-chat-capitialized
|
||||
:t/mute-channel))]
|
||||
[quo/menu-item
|
||||
|
|
|
@ -334,29 +334,3 @@
|
|||
(def ^:const auth-method-none "none")
|
||||
|
||||
(def ^:const image-description-in-lightbox? false)
|
||||
(def ^:const int->weekday
|
||||
"Maps the corresponding string representation of a weekday
|
||||
By it's numeric index as in cljs-time"
|
||||
{1 "mon"
|
||||
2 "tue"
|
||||
3 "wed"
|
||||
4 "thu"
|
||||
5 "fri"
|
||||
6 "sat"
|
||||
7 "sun"})
|
||||
|
||||
(def ^:const months
|
||||
"Maps the corresponding string representation of a weekday
|
||||
By it's numeric index as in cljs-time"
|
||||
{1 "jan"
|
||||
2 "feb"
|
||||
3 "mar"
|
||||
4 "apr"
|
||||
5 "may"
|
||||
6 "jun"
|
||||
7 "jul"
|
||||
8 "aug"
|
||||
9 "sep"
|
||||
10 "oct"
|
||||
11 "nov"
|
||||
12 "dec"})
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
[status-im.utils.types :as types]
|
||||
[reagent.core :as reagent]
|
||||
[quo2.foundations.colors :as colors]
|
||||
[utils.datetime :as datetime]
|
||||
[utils.chats :as chat-utils]))
|
||||
[utils.datetime :as datetime]))
|
||||
|
||||
(defn- get-chat
|
||||
[cofx chat-id]
|
||||
|
@ -302,38 +301,41 @@
|
|||
(log/debug "muted chat successfully" chat-id " for" muted-till)
|
||||
(let [time-string (fn [duration-kw unmute-time]
|
||||
(i18n/label duration-kw {:duration unmute-time}))
|
||||
not-community-chat? (chat-utils/not-community-chat? chat-type)
|
||||
not-community-chat? #(contains? #{constants/public-chat-type
|
||||
constants/private-group-chat-type
|
||||
constants/one-to-one-chat-type}
|
||||
%)
|
||||
mute-duration-text
|
||||
(fn [unmute-time]
|
||||
(if unmute-time
|
||||
(str
|
||||
(condp = mute-type
|
||||
constants/mute-for-15-mins-type (time-string
|
||||
(if (chat-utils/not-community-chat? chat-type)
|
||||
(if (not-community-chat? chat-type)
|
||||
:t/chat-muted-for-15-minutes
|
||||
:t/channel-muted-for-15-minutes)
|
||||
unmute-time)
|
||||
constants/mute-for-1-hour-type (time-string
|
||||
(if (chat-utils/not-community-chat? chat-type)
|
||||
(if (not-community-chat? chat-type)
|
||||
:t/chat-muted-for-1-hour
|
||||
:t/channel-muted-for-1-hour)
|
||||
unmute-time)
|
||||
constants/mute-for-8-hours-type (time-string
|
||||
(if (chat-utils/not-community-chat? chat-type)
|
||||
(if (not-community-chat? chat-type)
|
||||
:t/chat-muted-for-8-hours
|
||||
:t/channel-muted-for-8-hours)
|
||||
unmute-time)
|
||||
constants/mute-for-1-week (time-string
|
||||
(if (chat-utils/not-community-chat? chat-type)
|
||||
(if (not-community-chat? chat-type)
|
||||
:t/chat-muted-for-1-week
|
||||
:t/channel-muted-for-1-week)
|
||||
unmute-time)
|
||||
constants/mute-till-unmuted (time-string
|
||||
(if (chat-utils/not-community-chat? chat-type)
|
||||
(if (not-community-chat? chat-type)
|
||||
:t/chat-muted-till-unmuted
|
||||
:t/channel-muted-till-unmuted)
|
||||
unmute-time)))
|
||||
(i18n/label (if (chat-utils/not-community-chat? chat-type)
|
||||
(i18n/label (if (not-community-chat? chat-type)
|
||||
:t/chat-unmuted-successfully
|
||||
:t/channel-unmuted-successfully))))]
|
||||
{:db (assoc-in db [:chats chat-id :muted-till] muted-till)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
[status-im2.constants :as constants]
|
||||
[clojure.string :as string]
|
||||
[utils.i18n :as i18n]
|
||||
[quo2.components.icon :as quo2.icons]))
|
||||
[quo2.components.icon :as icons]))
|
||||
|
||||
(def max-subheader-length 50)
|
||||
|
||||
|
@ -237,7 +237,6 @@
|
|||
{:style {:top 16
|
||||
:right 16}}
|
||||
unviewed-messages-count])
|
||||
[quo2.icons/icon :i/muted
|
||||
{:size 20
|
||||
:color colors/neutral-40
|
||||
[icons/icon :i/muted
|
||||
{:color colors/neutral-40
|
||||
:container-style style/muted-icon}])]))
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
(ns ^{:doc "Utils needed for chat related operations"}
|
||||
utils.chats
|
||||
(:require [status-im2.constants :as constants]))
|
||||
|
||||
(defn not-community-chat?
|
||||
[chat-type]
|
||||
(contains? #{constants/public-chat-type
|
||||
constants/private-group-chat-type
|
||||
constants/one-to-one-chat-type}
|
||||
chat-type))
|
|
@ -5,11 +5,37 @@
|
|||
[cljs-time.format :as t.format]
|
||||
[clojure.string :as string]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.i18n-goog :as i18n-goog]
|
||||
[status-im2.constants :as constants]))
|
||||
[utils.i18n-goog :as i18n-goog]))
|
||||
|
||||
(defn now [] (t/now))
|
||||
|
||||
(def ^:const int->weekday
|
||||
"Maps the corresponding string representation of a weekday
|
||||
By it's numeric index as in cljs-time"
|
||||
{1 "mon"
|
||||
2 "tue"
|
||||
3 "wed"
|
||||
4 "thu"
|
||||
5 "fri"
|
||||
6 "sat"
|
||||
7 "sun"})
|
||||
|
||||
(def ^:const months
|
||||
"Maps the corresponding string representation of a weekday
|
||||
By it's numeric index as in cljs-time"
|
||||
{1 "jan"
|
||||
2 "feb"
|
||||
3 "mar"
|
||||
4 "apr"
|
||||
5 "may"
|
||||
6 "jun"
|
||||
7 "jul"
|
||||
8 "aug"
|
||||
9 "sep"
|
||||
10 "oct"
|
||||
11 "nov"
|
||||
12 "dec"})
|
||||
|
||||
(def one-second 1000)
|
||||
(def minute (* 60 one-second))
|
||||
(defn minutes [m] (* m minute))
|
||||
|
@ -292,7 +318,7 @@
|
|||
" "
|
||||
(i18n/label
|
||||
(keyword "t"
|
||||
(get constants/int->weekday
|
||||
(get int->weekday
|
||||
(t/day-of-week
|
||||
parsed-time))))
|
||||
" "
|
||||
|
@ -300,6 +326,6 @@
|
|||
" "
|
||||
(i18n/label
|
||||
(keyword "t"
|
||||
(get constants/months
|
||||
(get months
|
||||
(t/month parsed-time))))))]
|
||||
when-to-unmute))
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
[cljs.test :refer-macros [deftest testing is are]]
|
||||
[clojure.string :as string]
|
||||
[utils.datetime :as datetime]
|
||||
[utils.i18n-goog :as i18n-goog]
|
||||
[status-im2.constants :as constants]))
|
||||
[utils.i18n-goog :as i18n-goog]))
|
||||
|
||||
(defn match
|
||||
[name symbols]
|
||||
|
@ -203,7 +202,7 @@
|
|||
get-day #(t.format/unparse custom-DD-formatter %)
|
||||
get-week-day #(->> %
|
||||
t/day-of-week
|
||||
(get constants/int->weekday))
|
||||
(get datetime/int->weekday))
|
||||
mock-today (t.format/unparse (t.format/formatters :date-time-no-ms) curr-time)
|
||||
in-n-days #(-> (time-str-to-obj mock-today)
|
||||
(t/plus (t/days %)))
|
||||
|
@ -234,7 +233,7 @@
|
|||
form-full-date #(str (get-hh-mm %)
|
||||
" " (string/capitalize (get-week-day %))
|
||||
" " (get-month-day-int %)
|
||||
" " (string/capitalize (get constants/months (t/month %))))
|
||||
" " (string/capitalize (get datetime/months (t/month %))))
|
||||
today-date #(str (get-hh-mm %) " today")
|
||||
tomorrow-date #(str (get-hh-mm %) " tomorrow")
|
||||
write-date #(cond (today? % curr-time) (today-date %)
|
||||
|
|
Loading…
Reference in New Issue