|
25 | 25 | (if (= stored :on-device) (i18n/label :t/on-device) (i18n/label :t/on-keycard))))
|
26 | 26 |
|
27 | 27 | (defn avatar
|
28 |
| - [type full-name customization-color] |
29 |
| - (if (= type :default-keypair) |
30 |
| - [user-avatar/user-avatar |
31 |
| - {:full-name full-name |
32 |
| - :ring? true |
33 |
| - :size :small |
34 |
| - :customization-color customization-color}] |
35 |
| - [icon-avatar/icon-avatar |
36 |
| - {:size :size/s-32 |
37 |
| - :icon :i/placeholder |
38 |
| - :border? true}])) |
| 28 | + [{:keys [type details customization-color]}] |
| 29 | + (let [{:keys [full-name]} details] |
| 30 | + (if (= type :default-keypair) |
| 31 | + [user-avatar/user-avatar |
| 32 | + {:full-name full-name |
| 33 | + :ring? true |
| 34 | + :size :small |
| 35 | + :customization-color customization-color}] |
| 36 | + [icon-avatar/icon-avatar |
| 37 | + {:size :size/s-32 |
| 38 | + :icon :i/placeholder |
| 39 | + :border? true}]))) |
39 | 40 |
|
40 | 41 | (defn title-view
|
41 |
| - [full-name action selected? type blur? customization-color on-options-press theme] |
42 |
| - [rn/view |
43 |
| - {:style style/title-container |
44 |
| - :accessibility-label :title} |
45 |
| - [text/text {:weight :semi-bold} |
46 |
| - (if (= type :default-keypair) (keypair-string full-name) full-name)] |
47 |
| - (if (= action :selector) |
48 |
| - [selectors/radio |
49 |
| - {:checked? selected? |
50 |
| - :blur? blur? |
51 |
| - :customization-color customization-color}] |
52 |
| - [rn/pressable {:on-press on-options-press} |
53 |
| - [icon/icon :i/options |
54 |
| - {:color (if blur? |
55 |
| - colors/white-opa-70 |
56 |
| - (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)) |
57 |
| - :accessibility-label :options-button}]])]) |
| 42 | + [{:keys [details action selected? type blur? customization-color on-options-press theme]}] |
| 43 | + (let [{:keys [full-name]} details] |
| 44 | + [rn/view |
| 45 | + {:style style/title-container |
| 46 | + :accessibility-label :title} |
| 47 | + [text/text {:weight :semi-bold} |
| 48 | + (if (= type :default-keypair) (keypair-string full-name) full-name)] |
| 49 | + (if (= action :selector) |
| 50 | + [selectors/radio |
| 51 | + {:checked? selected? |
| 52 | + :blur? blur? |
| 53 | + :customization-color customization-color}] |
| 54 | + [rn/pressable {:on-press on-options-press} |
| 55 | + [icon/icon :i/options |
| 56 | + {:color (if blur? |
| 57 | + colors/white-opa-70 |
| 58 | + (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)) |
| 59 | + :accessibility-label :options-button}]])])) |
58 | 60 |
|
59 | 61 | (defn details-view
|
60 |
| - [address stored blur? theme] |
61 |
| - [rn/view |
62 |
| - {:style {:flex-direction :row |
63 |
| - :align-items :center}} |
64 |
| - [text/text |
65 |
| - {:size :paragraph-2 |
66 |
| - :accessibility-label :details |
67 |
| - :style {:color (if blur? |
68 |
| - colors/white-opa-40 |
69 |
| - (colors/theme-colors colors/neutral-50 colors/neutral-40 theme))}} |
70 |
| - (details-string address stored)] |
71 |
| - (when (= stored :on-keycard) |
72 |
| - [rn/view {:style {:margin-left 4}} |
73 |
| - [icon/icon :i/keycard-card |
74 |
| - {:size 16 |
75 |
| - :color (if blur? |
76 |
| - colors/white-opa-40 |
77 |
| - (colors/theme-colors colors/neutral-50 colors/neutral-40))}]])]) |
| 62 | + [details stored blur? theme] |
| 63 | + (let [{:keys [address]} details] |
| 64 | + [rn/view |
| 65 | + {:style {:flex-direction :row |
| 66 | + :align-items :center}} |
| 67 | + [text/text |
| 68 | + {:size :paragraph-2 |
| 69 | + :accessibility-label :details |
| 70 | + :style {:color (if blur? |
| 71 | + colors/white-opa-40 |
| 72 | + (colors/theme-colors colors/neutral-50 colors/neutral-40 theme))}} |
| 73 | + (details-string address stored)] |
| 74 | + (when (= stored :on-keycard) |
| 75 | + [rn/view {:style {:margin-left 4}} |
| 76 | + [icon/icon :i/keycard-card |
| 77 | + {:size 16 |
| 78 | + :color (if blur? |
| 79 | + colors/white-opa-40 |
| 80 | + (colors/theme-colors colors/neutral-50 colors/neutral-40))}]])])) |
78 | 81 |
|
79 | 82 | (defn- view-internal
|
80 | 83 | []
|
81 | 84 | (let [selected? (reagent/atom true)]
|
82 |
| - (fn [{:keys [theme accounts customization-color type details stored action blur? on-options-press]}] |
83 |
| - (let [{:keys [address full-name]} details] |
84 |
| - [rn/pressable |
85 |
| - {:style (style/container @selected? blur? customization-color theme) |
86 |
| - :on-press #(when (= action :selector) (reset! selected? (not @selected?)))} |
87 |
| - [rn/view {:style style/header-container} |
88 |
| - [avatar type full-name customization-color] |
89 |
| - [rn/view |
90 |
| - {:style {:margin-left 8 |
91 |
| - :flex 1}} |
92 |
| - [title-view full-name action @selected? type blur? customization-color on-options-press theme] |
93 |
| - [details-view address stored blur? theme]]] |
94 |
| - [rn/flat-list |
95 |
| - {:data accounts |
96 |
| - :render-fn account-list-card/view |
97 |
| - :separator [rn/view {:style {:height 8}}] |
98 |
| - :style {:padding-horizontal 8}}]])))) |
| 85 | + (fn [{:keys [accounts action] :as props}] |
| 86 | + [rn/pressable |
| 87 | + {:style (style/container (merge props {:selected? @selected?})) |
| 88 | + :on-press #(when (= action :selector) (reset! selected? (not @selected?)))} |
| 89 | + [rn/view {:style style/header-container} |
| 90 | + [avatar props] |
| 91 | + [rn/view |
| 92 | + {:style {:margin-left 8 |
| 93 | + :flex 1}} |
| 94 | + [title-view (merge props {:selected? @selected?})] |
| 95 | + [details-view props]]] |
| 96 | + [rn/flat-list |
| 97 | + {:data accounts |
| 98 | + :render-fn account-list-card/view |
| 99 | + :separator [rn/view {:style {:height 8}}] |
| 100 | + :style {:padding-horizontal 8}}]]))) |
99 | 101 |
|
100 | 102 | (def view (quo.theme/with-theme view-internal))
|
101 |
| - |
102 |
| -;; todo: mapize, fix dot |
0 commit comments