Skip to content

Commit

Permalink
[#19921] feat: remove key pair action
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsen-ghafouri committed May 13, 2024
1 parent a6cd974 commit 300edb0
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 13 deletions.
5 changes: 3 additions & 2 deletions src/quo/components/text_combinations/page_top/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
:padding-horizontal 20
:row-gap 8})

(def header
(defn header
[title-size]
{:flex-direction :row
:justify-content :space-between
:height 32})
:height (if title-size :auto 32)})

(def header-title
{:flex 1
Expand Down
5 changes: 3 additions & 2 deletions src/quo/components/text_combinations/page_top/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@
(format-counter counter-bottom))]])

(defn- header
[{:keys [title title-accessibility-label input counter-top counter-bottom
[{:keys [title title-size title-accessibility-label input counter-top counter-bottom
title-right title-right-props]
avatar-props :avatar}]
(let [title-props (assoc title-right-props
:title title
:title-size title-size
:right title-right
:accessibility-label title-accessibility-label)]
[rn/view {:style style/header}
[rn/view {:style (style/header title-size)}
[rn/view {:style style/header-title}
(when avatar-props
(let [avatar-props (assoc avatar-props :size :size-32)]
Expand Down
4 changes: 2 additions & 2 deletions src/quo/components/text_combinations/standard_title/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
:icon-color (style/right-tag-icon-color blur? theme)}]))

(defn view
[{:keys [title right accessibility-label] :as props}]
[{:keys [title title-size right accessibility-label] :as props}]
[rn/view {:style style/container}
[text/text
{:size :heading-1
{:size (or title-size :heading-1)
:weight :semi-bold
:accessibility-label accessibility-label}
title]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
(ns status-im.contexts.settings.wallet.keypairs-and-accounts.actions.view
(:require [quo.core :as quo]
[status-im.contexts.settings.wallet.keypairs-and-accounts.remove.view :as remove-key-pair]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(defn on-rename-request
[data]
(rf/dispatch [:open-modal :screen/settings.rename-keypair data]))
(defn on-rename-key-pair
[key-pair]
(rf/dispatch [:open-modal :screen/settings.rename-keypair key-pair]))

(defn on-remove-key-pair
[key-pair]
(rf/dispatch [:show-bottom-sheet
{:theme :dark
:content (fn []
[remove-key-pair/view key-pair])}]))

(defn view
[props data]
[props key-pair]
[:<>
[quo/drawer-top props]
[quo/action-drawer
[(when (= (:type props) :keypair)
[{:icon :i/edit
(when (= (:type props) :keypair)
[[{:icon :i/edit
:accessibility-label :rename-key-pair
:label (i18n/label :t/rename-key-pair)
:on-press #(on-rename-request data)}])]]])
:on-press #(on-rename-key-pair key-pair)}]
[{:icon :i/delete
:accessibility-label :rename-key-pair
:add-divider? true
:danger? true
:label (i18n/label :t/remove-key-pair-and-derived-accounts)
:on-press #(on-remove-key-pair key-pair)}]])]])
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(ns status-im.contexts.settings.wallet.keypairs-and-accounts.remove.style)

(def header-container
{:margin-bottom 8})

(def content
{:margin-horizontal 20})
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
(ns status-im.contexts.settings.wallet.keypairs-and-accounts.remove.view
(:require [quo.core :as quo]
[quo.foundations.colors :as colors]
[react-native.core :as rn]
[status-im.common.standard-authentication.core :as standard-auth]
[status-im.contexts.settings.wallet.keypairs-and-accounts.remove.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(defn view
[{:keys [name key-uid]}]
(let [customization-color (rf/sub [:profile/customization-color])
on-remove (rn/use-callback #()
[key-uid])]
[:<>
[quo/page-top
{:container-style style/header-container
:title (i18n/label :t/remove-key-pair-and-derived-accounts)
:title-size :heading-2
:description :context-tag
:context-tag {:type :icon
:size 24
:context name
:icon :i/seed-phrase}}]
[rn/view {:style style/content}
[quo/text
{:style {:margin-top 4}
:weight :regular
:size :paragraph-1}
(i18n/label :t/the-key-pair-and-derived-accounts-will-be-removed)]
[standard-auth/slide-button
{:size :size-48
:track-text (i18n/label :t/slide-to-remove-key-pair)
:container-style {:margin-top 34}
:customization-color colors/danger-50
:on-auth-success on-remove
:auth-button-label (i18n/label :t/confirm)}]]]))

3 changes: 3 additions & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,8 @@
"remove-network": "Remove network",
"remove-token": "Remove token",
"removed": "removed",
"remove-key-pair-and-derived-accounts": "Remove key pair and derived accounts",
"the-key-pair-and-derived-accounts-will-be-removed": "The key pair and derived accounts will be removed from all of your synced devices. Make sure you have a backup of your keys or seed phrase before proceeding.",
"rename-key-pair": "Rename key pair",
"repeat-pin": "Repeat new 6-digit passcode",
"repeat-puk": "Repeat new 12-digit PUK",
Expand Down Expand Up @@ -1968,6 +1970,7 @@
"slide-to-request-to-join": "Slide to request to join",
"slide-to-reveal-code": "Slide to reveal code",
"slide-to-create-account": "Slide to create account",
"slide-to-remove-key-pair": "Slide to remove key pair",
"minimum-received": "Minimum received",
"powered-by-paraswap": "Powered by Paraswap",
"priority": "Priority",
Expand Down

0 comments on commit 300edb0

Please sign in to comment.