From 5eb388bb3b6492f5f49e622bfd912f18a68fa52d Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 19 Feb 2024 14:07:18 -0600 Subject: [PATCH] KeygenStep: simplify it, add a tooltip over "Next" button --- src/components/ui/tooltip/tooltip.tsx | 8 ++++++- .../nostr-signin-modal/steps/keygen-step.tsx | 24 +++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/components/ui/tooltip/tooltip.tsx b/src/components/ui/tooltip/tooltip.tsx index 9c86b94be..08d270c5d 100644 --- a/src/components/ui/tooltip/tooltip.tsx +++ b/src/components/ui/tooltip/tooltip.tsx @@ -15,13 +15,15 @@ interface ITooltip { children: React.ReactElement>; /** Text to display in the tooltip. */ text: string; + /** If disabled, it will render the children without wrapping them. */ + disabled?: boolean; } /** * Tooltip */ const Tooltip: React.FC = (props) => { - const { children, text } = props; + const { children, text, disabled = false } = props; const [isOpen, setIsOpen] = useState(false); @@ -55,6 +57,10 @@ const Tooltip: React.FC = (props) => { hover, ]); + if (disabled) { + return children; + } + return ( <> {React.cloneElement(children, { diff --git a/src/features/ui/components/modals/nostr-signin-modal/steps/keygen-step.tsx b/src/features/ui/components/modals/nostr-signin-modal/steps/keygen-step.tsx index 6e63f64e8..cb4fd34ac 100644 --- a/src/features/ui/components/modals/nostr-signin-modal/steps/keygen-step.tsx +++ b/src/features/ui/components/modals/nostr-signin-modal/steps/keygen-step.tsx @@ -4,7 +4,7 @@ import React, { useMemo, useState } from 'react'; import { FormattedMessage } from 'react-intl'; import CopyableInput from 'soapbox/components/copyable-input'; -import { Button, Stack, Modal, FormGroup } from 'soapbox/components/ui'; +import { Button, Stack, Modal, FormGroup, Text, Tooltip } from 'soapbox/components/ui'; import { NKeys } from 'soapbox/features/nostr/keys'; import { useInstance } from 'soapbox/hooks'; import { download } from 'soapbox/utils/download'; @@ -44,7 +44,7 @@ const KeygenStep: React.FC = ({ setSigner, setStep, onClose }) => { return ( } onClose={onClose}> - + @@ -53,20 +53,20 @@ const KeygenStep: React.FC = ({ setSigner, setStep, onClose }) => { - - - - + + + - - - + + Back up your secret key in a secure place. If lost, your account cannot be recovered. Never share your secret key with anyone. - + + +