aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/paths/instance/templates/update
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-03-13 00:24:28 -0300
committerSebastian <sebasjm@gmail.com>2023-03-13 00:24:28 -0300
commit3267f56dc3de054a7dbdd6cd83305b92cf16bd61 (patch)
tree5f3b77915e5bc9af05bfeed30436e70b372e3d21 /packages/merchant-backoffice-ui/src/paths/instance/templates/update
parenta1af7945d17d40b33aeaf3894ed348b083f98f9a (diff)
downloadwallet-core-3267f56dc3de054a7dbdd6cd83305b92cf16bd61.tar.xz
show/hide key
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/templates/update')
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/templates/update/UpdatePage.tsx34
1 files changed, 32 insertions, 2 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/templates/update/UpdatePage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/templates/update/UpdatePage.tsx
index e34e2c746..9fcfcc4bf 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/templates/update/UpdatePage.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/templates/update/UpdatePage.tsx
@@ -57,6 +57,7 @@ export function UpdatePage({ template, onUpdate, onBack }: Props): VNode {
const { i18n } = useTranslationContext();
const backend = useBackendContext();
+ const [showKey, setShowKey] = useState(false);
const [state, setState] = useState<Partial<Entity>>(template);
const errors: FormErrors<Entity> = {
@@ -161,14 +162,26 @@ export function UpdatePage({ template, onUpdate, onBack }: Props): VNode {
convert={(v) => Number(v)}
/>
{state.pos_algorithm && state.pos_algorithm > 0 ? (
- <Input<Entity>
+ <InputWithAddon<Entity>
name="pos_key"
label={i18n.str`Point-of-sale key`}
+ inputType={showKey ? "text" : "password"}
help=""
+ expand
tooltip={i18n.str`Useful to validate the purchase`}
+ addonAfter={
+ <span class="icon">
+ {showKey ? (
+ <i class="mdi mdi-eye" />
+ ) : (
+ <i class="mdi mdi-eye-off" />
+ )}
+ </span>
+ }
side={
- <span data-tooltip={i18n.str`generate random secret key`}>
+ <span>
<button
+ data-tooltip={i18n.str`generate random secret key`}
class="button is-info mr-3"
onClick={(e) => {
const pos_key = randomBase32Key();
@@ -177,6 +190,23 @@ export function UpdatePage({ template, onUpdate, onBack }: Props): VNode {
>
<i18n.Translate>random</i18n.Translate>
</button>
+ <button
+ data-tooltip={
+ showKey
+ ? i18n.str`show secret key`
+ : i18n.str`hide secret key`
+ }
+ class="button is-info mr-3"
+ onClick={(e) => {
+ setShowKey(!showKey);
+ }}
+ >
+ {showKey ? (
+ <i18n.Translate>hide</i18n.Translate>
+ ) : (
+ <i18n.Translate>show</i18n.Translate>
+ )}
+ </button>
</span>
}
/>