-
Notifications
You must be signed in to change notification settings - Fork 987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
quo2 predictive keyboard component #15806
Conversation
0753e05
to
4774b0f
Compare
Jenkins BuildsClick to see older builds (11)
|
[rn/flat-list | ||
{:data words | ||
:content-container-style style/word-list | ||
:render-fn (fn [word] [render-word word |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just 2 things for this part:
- It looks like you can avoid the anonymous function if you pass
blur?
andon-press
in the:render-data
property of thern/flat-list
. - Although we still have plenty of examples where the
:render-fn
component is namedrender-xyz
, it's preferable to namerender-word
as a noun, since it should be treated as a normal hiccup component and not as a common function (which usually starts with a verb). In your example here, something likeword-component
should do it.
(gradients :blur) | ||
(colors/theme-colors (gradients :light) (gradients :dark)))} | ||
|
||
(condp = type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth sharing here: in Clojure it's a bit more idiomatic to use case
when the clauses are compile-time values as is the case here, it's also slightly more performant than condp
(not that it matters imo, not for our use cases). Just a reminder to also add the default clause, otherwise Clojure will throw an error if no match is found.
:type (if (= type :error) :error :default)} | ||
(when blur? | ||
{:text-color colors/white-opa-70 | ||
:icon-color colors/white-opa-70})) text] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, align multiline args vertically, as is explained in the style guide https://guide.clojure.style/#vertically-align-fn-args. zprint won't do this for us. In this line in particular, it's quite difficult to grasp that text
is the argument of info-message
.
[info-message/info-message | ||
{:icon :i/info | ||
:size :default | ||
:type :error} text] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about aligning args vertically https://guide.clojure.style/#vertically-align-fn-args
:padding-horizontal (if (= type :words) 0 20)}) | ||
|
||
(def word-list {:align-items :center :padding-horizontal 20}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The files in this PR have an extra empty line. In status-mobile
it's recommended to configure our editors to remove trailing new lines at the end of files and to automatically add a line break at the end of files (if one doesn't exist yet). Just so you never have to worry about this again :)
|
||
(defn wrapper | ||
[type] | ||
{:width "100%" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this case, can we use only flexbox properties and avoid "100%"?
(defn- render-word | ||
[word {:keys [blur? on-press]}] | ||
[button/button | ||
(merge {:type :blur-bg :size 32 :on-press #(on-press word)} (when blur? {:override-theme :dark})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is kind of unreadable due to the lack of line breaks. Suggestion:
(merge {:type :blur-bg
:size 32
:on-press #(on-press word)}
(when blur? {:override-theme :dark}))
[quo2.foundations.colors :as colors] | ||
[quo2.components.buttons.button :as button])) | ||
|
||
(def gradients |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the spirit of exposing only view
, we can add ^:private
to this var's metadata.
|
||
(defn- separator | ||
[] | ||
[rn/view {:width 8}]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick one: we should put the map in the :style
prop.
165758a
to
6442ce9
Compare
@ilmotta Thanks for the detailed review :). I have updated the PR with suggested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done. Thanks @ajayesivan
93% of end-end tests have passed
Failed tests (2)Click to expandClass TestCommunityMultipleDeviceMerged:
Class TestActivityCenterContactRequestMultipleDevicePR:
Passed tests (28)Click to expandClass TestActivityCenterContactRequestMultipleDevicePR:
Class TestOneToOneChatMultipleSharedDevicesNewUi:
Class TestActivityMultipleDevicePR:
Class TestCommunityOneDeviceMerged:
Class TestGroupChatMultipleDeviceMergedNewUI:
Class TestCommunityMultipleDeviceMerged:
|
@ajayesivan thanx for the PR. Please, have a look at a few minor issues ISSUE 1 Long info/error message is cut (Android)ISSUE 2 Blur is applied for the area beyond the component (Android)telegram-cloud-document-2-5377743472037996816.mp4 |
@ajayesivan is it expected for this error to appear in Quo2 Preview while tapping the buttons? telegram-cloud-document-2-5377743472037996833.mp4 |
6442ce9
to
20f7d4f
Compare
@pavloburykh Fixed all issues. |
(colors/theme-colors | ||
(gradients :light) | ||
(gradients :dark)))} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra line
:accessibility-label :predictive-keyboard | ||
:colors (if blur? | ||
(gradients :blur) | ||
(colors/theme-colors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its better to do not stretch too much code verticaly
81% of end-end tests have passed
Failed tests (6)Click to expandClass TestCommunityMultipleDeviceMerged:
Class TestActivityCenterContactRequestMultipleDevicePR:
Class TestActivityMultipleDevicePR:
Passed tests (25)Click to expandClass TestActivityCenterContactRequestMultipleDevicePR:
Class TestCommunityMultipleDeviceMerged:
Class TestGroupChatMultipleDeviceMergedNewUI:
Class TestOneToOneChatMultipleSharedDevicesNewUi:
Class TestActivityMultipleDevicePR:
Class TestCommunityOneDeviceMerged:
|
@ajayesivan thanx for the fixes. PR is ready to be merged. |
@@ -120,6 +121,9 @@ | |||
;;;; BANNER | |||
(def banner quo2.components.banners.banner.view/banner) | |||
|
|||
;;;; BUTTONS | |||
(def predictive-keyboard quo2.components.buttons.predictive-keyboard.view/view) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move other buttons in this file under this heading 🙏
eeaa6f8
to
5367528
Compare
5367528
to
eab4850
Compare
fixes #15802
Implemented predictive keyboard component
Test
Quo2 Preview -> Buttons -> Predictive Keyboard
status: ready