-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8069] feature - [Profile] My profile edit and share screens
Signed-off-by: Andrey Shovkoplyas <[email protected]>
- Loading branch information
1 parent
11ed6f4
commit 39e095e
Showing
28 changed files
with
4,318 additions
and
2,201 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
(ns status-im.ui.components.copyable-text | ||
(:require-macros [status-im.utils.views :refer [defview letsubs]]) | ||
(:require [reagent.core :as reagent] | ||
[status-im.ui.components.react :as react] | ||
[status-im.i18n :as i18n] | ||
[status-im.ui.components.colors :as colors] | ||
[status-im.ui.components.animation :as animation] | ||
[status-im.ui.components.typography :as typography])) | ||
|
||
(defn hide-cue-atom [anim-opacity anim-y cue-atom] | ||
(animation/start | ||
(animation/parallel | ||
[(animation/timing anim-opacity | ||
{:toValue 0 | ||
:duration 140 | ||
:delay 1000 | ||
:easing (.-ease (animation/easing)) | ||
:useNativeDriver true}) | ||
(animation/timing anim-y | ||
{:toValue 0 | ||
:duration 140 | ||
:delay 1000 | ||
:easing (.-ease (animation/easing)) | ||
:useNativeDriver true})]) | ||
#(reset! cue-atom false))) | ||
|
||
(defn show-cue-atom [anim-opacity anim-y cue-atom y] | ||
(when @cue-atom | ||
(animation/start | ||
(animation/parallel | ||
[(animation/timing anim-opacity | ||
{:toValue 1 | ||
:duration 140 | ||
:easing (.-ease (animation/easing)) | ||
:useNativeDriver true}) | ||
(animation/timing anim-y | ||
{:toValue y | ||
:duration 140 | ||
:easing (.-ease (animation/easing)) | ||
:useNativeDriver true})]) | ||
#(hide-cue-atom anim-opacity anim-y cue-atom)))) | ||
|
||
(defn copy-action-visual-cue [anim-opacity anim-y width cue-atom] | ||
[react/animated-view {:style {:opacity anim-opacity | ||
:transform [{:translateY anim-y}] | ||
:height 34 | ||
:max-width @width | ||
:position :absolute | ||
:border-radius 8 | ||
:align-self :center | ||
:z-index (if @cue-atom 1 -1) | ||
:align-items :center | ||
:justify-content :center | ||
:shadow-offset {:width 0 :height 4} | ||
:shadow-radius 12 | ||
:shadow-opacity 1 | ||
:shadow-color "rgba(0, 34, 51, 0.08)" | ||
:background-color colors/white}} | ||
[react/view {:padding-horizontal 16 | ||
:padding-vertical 7 | ||
:border-radius 8 | ||
:background-color colors/white | ||
:shadow-offset {:width 0 :height 2} | ||
:shadow-radius 4 | ||
:shadow-opacity 1 | ||
:shadow-color "rgba(0, 34, 51, 0.16)"} | ||
[react/text {:style {:typography :main-medium :line-height 20 :font-size 14}} | ||
(i18n/label :sharing-copied-to-clipboard)]]]) | ||
|
||
(defview copyable-text-view [{:keys [label copied-text]} content] | ||
(letsubs [cue-atom (reagent/atom false) | ||
width (reagent/atom nil) | ||
anim-y (animation/create-value 0) | ||
anim-opacity (animation/create-value 0)] | ||
[react/view | ||
[copy-action-visual-cue anim-opacity anim-y width cue-atom] | ||
[react/touchable-opacity | ||
{:active-opacity (if @cue-atom 1 0.7) | ||
:style {:margin-top 12 :margin-bottom 4} | ||
:on-press #(when (not @cue-atom) | ||
(reset! cue-atom true) | ||
(show-cue-atom anim-opacity anim-y cue-atom -22) | ||
(react/copy-to-clipboard copied-text))} | ||
[react/view | ||
[react/text {:style {:font-size 13 :line-height 18 :font-weight "500" | ||
:color colors/gray :margin-bottom 4}} | ||
(i18n/label label)] | ||
[react/view | ||
{:on-layout #(reset! width (-> % .-nativeEvent .-layout .-width))} | ||
content]]]])) |
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 |
---|---|---|
@@ -0,0 +1,144 @@ | ||
(ns status-im.ui.components.large-toolbar | ||
(:require-macros [status-im.utils.views :refer [defview letsubs]]) | ||
(:require [reagent.core :as reagent] | ||
[cljs-bean.core :refer [->clj ->js]] | ||
[status-im.ui.components.colors :as colors] | ||
[status-im.ui.components.list.views :as list.views] | ||
[status-im.ui.components.react :as react] | ||
[status-im.ui.components.toolbar.view :as toolbar] | ||
[status-im.ui.components.toolbar.styles :as toolbar.styles] | ||
[status-im.utils.platform :as platform] | ||
[status-im.ui.components.animation :as animation])) | ||
|
||
(def hidden (reagent/atom 0)) | ||
(def shown (reagent/atom 100)) | ||
(def minimized-header-visible? (reagent/atom false)) | ||
(def initial-on-show-done? (volatile! false)) | ||
|
||
(defview animated-content-wrapper [header-in-toolbar has-nav? show?] | ||
(letsubs [anim-opacity (animation/create-value 0) | ||
to-hide (reagent/atom false)] | ||
{:component-will-update | ||
(fn [_ [_ _ _ show?]] | ||
(cond | ||
(and (not @to-hide) show?) | ||
(animation/start | ||
(animation/timing | ||
anim-opacity | ||
{:toValue 1 | ||
:duration 200 | ||
:easing (.-ease (animation/easing)) | ||
:useNativeDriver true}) | ||
#(reset! to-hide true)) | ||
|
||
(and @to-hide (not show?)) | ||
(animation/start | ||
(animation/timing | ||
anim-opacity | ||
{:toValue 0 | ||
:duration 200 | ||
:easing (.-ease (animation/easing)) | ||
:useNativeDriver true}) | ||
#(reset! to-hide false))))} | ||
[react/animated-view | ||
{:style (cond-> {:flex 1 | ||
:align-self :stretch | ||
:opacity anim-opacity} | ||
(false? has-nav?) | ||
(assoc :margin-left -40 :margin-right 40))} | ||
header-in-toolbar])) | ||
|
||
(defn on-viewable-items-changed [threshold interporlation-step] | ||
(fn [info] | ||
(let [changed (->> (->clj info) | ||
:changed | ||
(filter #(= 1 (:index %)))) | ||
viewable? (when (seq changed) | ||
(->> changed | ||
first | ||
:isViewable))] | ||
(when (and @initial-on-show-done? (not (nil? viewable?))) | ||
(if (= threshold 0) | ||
(if viewable? | ||
(reset! minimized-header-visible? false) | ||
(reset! minimized-header-visible? true)) | ||
(if viewable? | ||
(do (swap! hidden - interporlation-step) (swap! shown + interporlation-step)) | ||
(do (swap! hidden + interporlation-step) (swap! shown - interporlation-step)))))))) | ||
|
||
(defonce viewability-config-callback-pairs | ||
(let [interporlation-step 20] | ||
(->js | ||
(vec | ||
(for [threshold (range 0 (+ 100 interporlation-step) interporlation-step)] | ||
{:viewabilityConfig {:itemVisiblePercentThreshold threshold} | ||
:onViewableItemsChanged (on-viewable-items-changed threshold interporlation-step)}))))) | ||
|
||
;; header-in-toolbar - component - small header in toolbar | ||
;; nav-item - component/nil - if nav-item like back button is needed, else nil | ||
;; action-items - status-im.ui.components.toolbar.view/actions | ||
(defn minimized-toolbar [header-in-toolbar nav-item action-items] | ||
(let [has-nav? (boolean nav-item)] | ||
[toolbar/toolbar | ||
{:transparent? true | ||
:style {:z-index 100 | ||
:elevation 9}} | ||
nav-item | ||
[animated-content-wrapper header-in-toolbar has-nav? @minimized-header-visible?] | ||
action-items])) | ||
|
||
;; header - component that serves as large header without any top/bottom padding | ||
;; top(4px high) and bottom(16px high and with border) padding | ||
;; are assumed to be constant | ||
;; this is wrapped with padding components and merged with content | ||
;; content - vector - of the rest(from header) of the list components | ||
;; wrapped header and content form the data prop of flat-list | ||
;; list-ref - atom - a reference to flat-list for the purpose of invoking its | ||
;; methods | ||
(defview flat-list-with-large-header [header content list-ref] | ||
(letsubs [window-width [:dimensions/window-width]] | ||
{:component-did-mount #(do (reset! hidden 0) (reset! shown 100) | ||
(reset! minimized-header-visible? false) | ||
(vreset! initial-on-show-done? false))} | ||
(let [header-top-padding [react/view {:height 4}] | ||
;; header bottom padding with border-bottom | ||
;; fades out as it approaches toolbar shadow | ||
header-bottom [react/animated-view | ||
{:style {:height 16 | ||
:opacity (/ @shown 100) | ||
:border-bottom-width 1 | ||
:border-bottom-color colors/gray-lighter}}] | ||
wrapped-data (into [header-top-padding header header-bottom] content) | ||
status-bar-height (get platform/platform-specific :status-bar-default-height) | ||
toolbar-shadow-component-height | ||
(+ 50 toolbar.styles/toolbar-height (if (zero? status-bar-height) 50 status-bar-height))] | ||
[react/view {:flex 1} | ||
;; toolbar shadow | ||
[react/animated-view | ||
{:style | ||
(cond-> {:flex 1 | ||
:align-self :stretch | ||
:position :absolute | ||
:height toolbar-shadow-component-height | ||
:width window-width | ||
:top (- toolbar-shadow-component-height) | ||
:shadow-radius 8 | ||
:shadow-offset {:width 0 :height 2} | ||
:shadow-opacity 1 | ||
:shadow-color "rgba(0, 9, 26, 0.12)" | ||
:elevation (if (>= @hidden 40) (- (/ @hidden 10) 2) 0) | ||
:background-color colors/white} | ||
platform/ios? | ||
(assoc :opacity (if (>= @hidden 40) (/ @hidden 100) 0)))}] | ||
|
||
[list.views/flat-list | ||
{:style {:z-index -1} | ||
:data wrapped-data | ||
:initial-num-to-render 3 | ||
:ref #(reset! list-ref %) | ||
:render-fn (fn [item idx] item) | ||
:key-fn (fn [item idx] (str idx)) | ||
:on-scroll-begin-drag #(when (false? @initial-on-show-done?) | ||
(vreset! initial-on-show-done? true)) | ||
:viewabilityConfigCallbackPairs viewability-config-callback-pairs | ||
:keyboard-should-persist-taps :handled}]]))) |
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
Oops, something went wrong.