From 940cd74b3f5c34be9f857c362d0d7e38c13c1763 Mon Sep 17 00:00:00 2001 From: danidfra Date: Sat, 28 Sep 2024 20:07:37 -0300 Subject: [PATCH 1/8] Add new translations --- src/locales/en.json | 11 ++++++++--- src/locales/pt-BR.json | 14 +++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index e0fa6b9d3..3c361117c 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1171,6 +1171,9 @@ "nostr_relays.read_write": "Read & write", "nostr_relays.title": "Relays", "nostr_relays.write_only": "Write-only", + "nostr_login.siwe.action": "Log in with extension", + "nostr_login.siwe.alt": "Log in with key", + "nostr_login.siwe.title": "Log in", "nostr_signup.has_key": "I already have a key", "nostr_signup.key-add.key_button": "Add Key", "nostr_signup.key-add.title": "Import Key", @@ -1181,9 +1184,11 @@ "nostr_signup.keygen.next": "Next", "nostr_signup.keygen.text": "Back up your secret key in a secure place. If lost, your account cannot be recovered. Never share your secret key with anyone.", "nostr_signup.keygen.title": "Your new key", - "nostr_signup.siwe.action": "Sign in with extension", - "nostr_signup.siwe.alt": "Sign in with key", - "nostr_signup.siwe.title": "Sign in", + "nostr_signup.siwe.action": "Don't have an extension?", + "nostr_signup.siwe.alt": "Sign up with key", + "nostr_signup.siwe.new_user": "New on {site_title}?", + "nostr_signup.siwe.title": "Sign up", + "nostr_signin.siwe.welcome": "Welcome to {site_title}", "notification.ditto:name_grant": "You were granted the name {acct}", "notification.ditto:zap": "{name} zapped you {amount} sats", "notification.favourite": "{name} liked your post", diff --git a/src/locales/pt-BR.json b/src/locales/pt-BR.json index e9b4b3f48..325b33700 100644 --- a/src/locales/pt-BR.json +++ b/src/locales/pt-BR.json @@ -1161,19 +1161,23 @@ "nostr_relays.read_write": "Leitura e escrita", "nostr_relays.title": "Relays", "nostr_relays.write_only": "Somente escrita", + "nostr_login.siwe.action": "Entrar com uma extensão", + "nostr_login.siwe.title": "Entrar", "nostr_signup.has_key": "Eu já tenho uma chave", "nostr_signup.key-add.key_button": "Adicionar chave", "nostr_signup.key-add.title": "Importar Chave", "nostr_signup.key.title": "Você precisa de uma chave para continuar", "nostr_signup.key_generate": "Gerar chave", - "nostr_signup.keygen.title": "Sua nova chave", "nostr_signup.keygen.download_key_button": "Baixar chave", "nostr_signup.keygen.label_text": "Chave secreta", - "nostr_signup.keygen.text": "Faça backup da sua chave secreta em um lugar seguro. Se for perdida, sua conta não poderá ser recuperada. Nunca compartilhe sua chave secreta com ninguém.", "nostr_signup.keygen.next": "Proximo", - "nostr_signup.siwe.action": "Faça login com a extensão", - "nostr_signup.siwe.alt": "Faça login com a chave", - "nostr_signup.siwe.title": "Entrar", + "nostr_signup.keygen.text": "Faça backup da sua chave secreta em um lugar seguro. Se for perdida, sua conta não poderá ser recuperada. Nunca compartilhe sua chave secreta com ninguém.", + "nostr_signup.keygen.title": "Sua nova chave", + "nostr_signup.siwe.action": "Não tem uma extensão?", + "nostr_signup.siwe.alt": "Cadastre-se com uma chave", + "nostr_signup.siwe.new_user": "Novo no {site_title}?", + "nostr_signup.siwe.title": "Cadastrar", + "nostr_signin.siwe.welcome": "Bem-vindo ao {site_title}", "notification.ditto:name_grant": "Você recebeu o nome {acct}", "notification.favourite": "{name} curtiu a sua postagem", "notification.follow": "{name} te seguiu", From b6f42fa63f3b37f27c4c0b9111c74e3c8fab3310 Mon Sep 17 00:00:00 2001 From: danidfra Date: Mon, 30 Sep 2024 14:39:59 -0300 Subject: [PATCH 2/8] New default messages --- src/locales/en.json | 13 +++++++------ src/locales/pt-BR.json | 8 +++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 3c361117c..0accc3497 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1165,15 +1165,17 @@ "new_group_panel.title": "Create Group", "nostr_extension.found": "Sign in with browser extension.", "nostr_extension.not_found": "Browser extension not found.", + "nostr_login.siwe.action": "Log in with extension", + "nostr_login.siwe.alt": "Log in with key", + "nostr_login.siwe.sign_up": "Sign Up", + "nostr_login.siwe.title": "Log in", "nostr_panel.message": "Connect with any Nostr client.", "nostr_panel.title": "Nostr Relay", "nostr_relays.read_only": "Read-only", "nostr_relays.read_write": "Read & write", "nostr_relays.title": "Relays", "nostr_relays.write_only": "Write-only", - "nostr_login.siwe.action": "Log in with extension", - "nostr_login.siwe.alt": "Log in with key", - "nostr_login.siwe.title": "Log in", + "nostr_signin.siwe.welcome": "Welcome to {site_title}", "nostr_signup.has_key": "I already have a key", "nostr_signup.key-add.key_button": "Add Key", "nostr_signup.key-add.title": "Import Key", @@ -1184,11 +1186,10 @@ "nostr_signup.keygen.next": "Next", "nostr_signup.keygen.text": "Back up your secret key in a secure place. If lost, your account cannot be recovered. Never share your secret key with anyone.", "nostr_signup.keygen.title": "Your new key", - "nostr_signup.siwe.action": "Don't have an extension?", - "nostr_signup.siwe.alt": "Sign up with key", + "nostr_signup.siwe.action": "Sign up with extension", + "nostr_signup.siwe.alt": "Don't have an extension?", "nostr_signup.siwe.new_user": "New on {site_title}?", "nostr_signup.siwe.title": "Sign up", - "nostr_signin.siwe.welcome": "Welcome to {site_title}", "notification.ditto:name_grant": "You were granted the name {acct}", "notification.ditto:zap": "{name} zapped you {amount} sats", "notification.favourite": "{name} liked your post", diff --git a/src/locales/pt-BR.json b/src/locales/pt-BR.json index 325b33700..8a0a94928 100644 --- a/src/locales/pt-BR.json +++ b/src/locales/pt-BR.json @@ -1153,7 +1153,7 @@ "new_group_panel.action": "Criar Grupo", "new_group_panel.subtitle": "Não encontrou o que procura? Crie seu próprio grupo privado ou público.", "new_group_panel.title": "Criar Grupo", - "nostr_extension.found": "Faça login com a extensão do navegador.", + "nostr_extension.found": "Faça login com a extensão do navegador.", "nostr_extension.not_found": "Extensão do navegador não encontrada.", "nostr_panel.message": "Conecte-se com qualquer cliente Nostr.", "nostr_panel.title": "Relay Nostr", @@ -1162,7 +1162,9 @@ "nostr_relays.title": "Relays", "nostr_relays.write_only": "Somente escrita", "nostr_login.siwe.action": "Entrar com uma extensão", + "nostr_login.siwe.alt": "Entrar com uma chave", "nostr_login.siwe.title": "Entrar", + "nostr_login.siwe.sign_up": "Cadastrar", "nostr_signup.has_key": "Eu já tenho uma chave", "nostr_signup.key-add.key_button": "Adicionar chave", "nostr_signup.key-add.title": "Importar Chave", @@ -1173,8 +1175,8 @@ "nostr_signup.keygen.next": "Proximo", "nostr_signup.keygen.text": "Faça backup da sua chave secreta em um lugar seguro. Se for perdida, sua conta não poderá ser recuperada. Nunca compartilhe sua chave secreta com ninguém.", "nostr_signup.keygen.title": "Sua nova chave", - "nostr_signup.siwe.action": "Não tem uma extensão?", - "nostr_signup.siwe.alt": "Cadastre-se com uma chave", + "nostr_signup.siwe.alt": "Não tem uma extensão?", + "nostr_signup.siwe.action": "Cadastre-se com uma extensão", "nostr_signup.siwe.new_user": "Novo no {site_title}?", "nostr_signup.siwe.title": "Cadastrar", "nostr_signin.siwe.welcome": "Bem-vindo ao {site_title}", From 7445325e6ae6fed4324ed2d2aed3c9565b392873 Mon Sep 17 00:00:00 2001 From: danidfra Date: Mon, 30 Sep 2024 14:41:07 -0300 Subject: [PATCH 3/8] Update divider --- src/components/ui/divider/divider.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ui/divider/divider.tsx b/src/components/ui/divider/divider.tsx index 691525bb5..821f55fd6 100644 --- a/src/components/ui/divider/divider.tsx +++ b/src/components/ui/divider/divider.tsx @@ -18,7 +18,7 @@ const Divider = ({ text, textSize = 'md' }: IDivider) => ( {text && (
- + {text}
From 1bda5a6cebb27b2acc804b1cdf0f63d282ea19dc Mon Sep 17 00:00:00 2001 From: danidfra Date: Mon, 30 Sep 2024 19:09:02 -0300 Subject: [PATCH 4/8] Update: Add new prop in ExtensionStep --- .../nostr-login-modal/nostr-login-modal.tsx | 2 +- .../steps/extension-step.tsx | 58 ++++++++++++++++--- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/src/features/ui/components/modals/nostr-login-modal/nostr-login-modal.tsx b/src/features/ui/components/modals/nostr-login-modal/nostr-login-modal.tsx index fd81a6c9a..21595bdb9 100644 --- a/src/features/ui/components/modals/nostr-login-modal/nostr-login-modal.tsx +++ b/src/features/ui/components/modals/nostr-login-modal/nostr-login-modal.tsx @@ -17,7 +17,7 @@ const NostrLoginModal: React.FC = ({ onClose, step: firstStep switch (step) { case 'extension': - return setStep('key-add')} onClose={handleClose} />; + return setStep('key-add')} onClose={handleClose} isLogin />; case 'key-add': return ; default: diff --git a/src/features/ui/components/modals/nostr-login-modal/steps/extension-step.tsx b/src/features/ui/components/modals/nostr-login-modal/steps/extension-step.tsx index 2b1af1f1e..e43ce2773 100644 --- a/src/features/ui/components/modals/nostr-login-modal/steps/extension-step.tsx +++ b/src/features/ui/components/modals/nostr-login-modal/steps/extension-step.tsx @@ -1,18 +1,28 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; +import { Link } from 'react-router-dom'; +import { openModal } from 'soapbox/actions/modals'; import { nostrExtensionLogIn } from 'soapbox/actions/nostr'; import EmojiGraphic from 'soapbox/components/emoji-graphic'; -import { Button, Stack, Modal } from 'soapbox/components/ui'; -import { useAppDispatch } from 'soapbox/hooks'; +import { Button, Stack, Modal, Text, Divider, HStack } from 'soapbox/components/ui'; +import { useAppDispatch, useInstance, useSoapboxConfig } from 'soapbox/hooks'; interface IExtensionStep { + isLogin?: boolean; onClickAlt: () => void; onClose(): void; } -const ExtensionStep: React.FC = ({ onClickAlt, onClose }) => { +const ExtensionStep: React.FC = ({ isLogin, onClickAlt, onClose }) => { const dispatch = useAppDispatch(); + const instance = useInstance(); + const { logo } = useSoapboxConfig(); + + const handleClose = () => { + onClose(); + dispatch(openModal('NOSTR_SIGNUP')); + }; const onClick = () => { dispatch(nostrExtensionLogIn()); @@ -20,18 +30,48 @@ const ExtensionStep: React.FC = ({ onClickAlt, onClose }) => { }; return ( - } onClose={onClose}> - - + : + } + width='sm' + onClose={onClose} + > + + + + + + + {logo ? +
+ +
+ : + + } - + + {isLogin && + + + + + + + + } +
From 12376f030063ff760f8eeb4ea870d83d597bd5aa Mon Sep 17 00:00:00 2001 From: danidfra Date: Mon, 30 Sep 2024 19:09:46 -0300 Subject: [PATCH 5/8] Small changes --- .../components/nostr-extension-indicator.tsx | 2 +- .../modals/nostr-signup-modal/nostr-signup-modal.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/features/ui/components/modals/nostr-login-modal/components/nostr-extension-indicator.tsx b/src/features/ui/components/modals/nostr-login-modal/components/nostr-extension-indicator.tsx index 2c0258663..33cbccc3c 100644 --- a/src/features/ui/components/modals/nostr-login-modal/components/nostr-extension-indicator.tsx +++ b/src/features/ui/components/modals/nostr-login-modal/components/nostr-extension-indicator.tsx @@ -16,7 +16,7 @@ const NostrExtensionIndicator: React.FC = () => { }; return ( - + {window.nostr ? ( void; } -const NostrSigninModal: React.FC = ({ onClose }) => { +const NostrSignUpModal: React.FC = ({ onClose }) => { const [step, setStep] = useState(window.nostr ? 'extension' : 'key'); const handleClose = () => onClose('NOSTR_SIGNUP'); @@ -28,6 +28,6 @@ const NostrSigninModal: React.FC = ({ onClose }) => { } }; -export default NostrSigninModal; +export default NostrSignUpModal; export type { Step }; From ea1e70b4a292d03e9a28bbf44ea0f1461fa4f116 Mon Sep 17 00:00:00 2001 From: danidfra Date: Mon, 30 Sep 2024 19:33:27 -0300 Subject: [PATCH 6/8] Revamp key-add-step --- .../nostr-login-modal/steps/key-add-step.tsx | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/features/ui/components/modals/nostr-login-modal/steps/key-add-step.tsx b/src/features/ui/components/modals/nostr-login-modal/steps/key-add-step.tsx index d53008b86..a9fbec91a 100644 --- a/src/features/ui/components/modals/nostr-login-modal/steps/key-add-step.tsx +++ b/src/features/ui/components/modals/nostr-login-modal/steps/key-add-step.tsx @@ -4,7 +4,7 @@ import { FormattedMessage } from 'react-intl'; import { logInNostr } from 'soapbox/actions/nostr'; import EmojiGraphic from 'soapbox/components/emoji-graphic'; -import { Button, Stack, Modal, Input, FormGroup, Form } from 'soapbox/components/ui'; +import { Button, Stack, Modal, Input, FormGroup, Form, Divider } from 'soapbox/components/ui'; import { NKeys } from 'soapbox/features/nostr/keys'; import { useAppDispatch } from 'soapbox/hooks'; @@ -43,9 +43,8 @@ const KeyAddStep: React.FC = ({ onClose }) => { }; return ( - } onClose={onClose}> + } width='sm' onClose={onClose}> - @@ -60,11 +59,20 @@ const KeyAddStep: React.FC = ({ onClose }) => { /> - + + + + + + + + + +
); From de8f604381de811d1e264fe671b2d5841e38e545 Mon Sep 17 00:00:00 2001 From: danidfra Date: Mon, 30 Sep 2024 19:34:40 -0300 Subject: [PATCH 7/8] Revamp key-step --- .../nostr-signup-modal/steps/key-step.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/features/ui/components/modals/nostr-signup-modal/steps/key-step.tsx b/src/features/ui/components/modals/nostr-signup-modal/steps/key-step.tsx index 9e203ced0..272992fc9 100644 --- a/src/features/ui/components/modals/nostr-signup-modal/steps/key-step.tsx +++ b/src/features/ui/components/modals/nostr-signup-modal/steps/key-step.tsx @@ -3,7 +3,7 @@ import { FormattedMessage } from 'react-intl'; import { openModal } from 'soapbox/actions/modals'; import EmojiGraphic from 'soapbox/components/emoji-graphic'; -import { Button, Stack, Modal } from 'soapbox/components/ui'; +import { Button, Stack, Modal, Text, Divider } from 'soapbox/components/ui'; import { useAppDispatch } from 'soapbox/hooks'; import NostrExtensionIndicator from '../../nostr-login-modal/components/nostr-extension-indicator'; @@ -23,9 +23,12 @@ const KeyStep: React.FC = ({ setStep, onClose }) => { }; return ( - } onClose={onClose}> - - + } width='sm' onClose={onClose}> + + + + + @@ -38,6 +41,13 @@ const KeyStep: React.FC = ({ setStep, onClose }) => { + + + + + + + ); From 0b7556c423d9cdc6a580ca0076b2609347da27cb Mon Sep 17 00:00:00 2001 From: danidfra Date: Mon, 30 Sep 2024 19:37:13 -0300 Subject: [PATCH 8/8] Revamp keygen-step --- .../nostr-signup-modal/steps/keygen-step.tsx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/features/ui/components/modals/nostr-signup-modal/steps/keygen-step.tsx b/src/features/ui/components/modals/nostr-signup-modal/steps/keygen-step.tsx index 364ad11cd..f4692f05b 100644 --- a/src/features/ui/components/modals/nostr-signup-modal/steps/keygen-step.tsx +++ b/src/features/ui/components/modals/nostr-signup-modal/steps/keygen-step.tsx @@ -7,7 +7,7 @@ import { logInNostr } from 'soapbox/actions/nostr'; import { startOnboarding } from 'soapbox/actions/onboarding'; import CopyableInput from 'soapbox/components/copyable-input'; import EmojiGraphic from 'soapbox/components/emoji-graphic'; -import { Button, Stack, Modal, FormGroup, Text, Tooltip } from 'soapbox/components/ui'; +import { Button, Stack, Modal, FormGroup, Text, Tooltip, HStack } from 'soapbox/components/ui'; import { useNostr } from 'soapbox/contexts/nostr-context'; import { NKeys } from 'soapbox/features/nostr/keys'; import { useAppDispatch, useInstance } from 'soapbox/hooks'; @@ -68,33 +68,33 @@ const KeygenStep: React.FC = ({ onClose }) => { }; return ( - } onClose={onClose}> + } width='sm' onClose={onClose}> - - - - }> - + - + + + + - + + );