From 23cb3941602479ca80c449146d370c4f14b8d042 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 28 Jan 2025 14:51:08 -0600 Subject: [PATCH] DisplayUserNameStep: fix title and subtitle, remove character minimum, progress on success --- .../steps/display-identity-step.tsx | 47 ++++--------------- src/locales/en.json | 11 ++--- 2 files changed, 14 insertions(+), 44 deletions(-) diff --git a/src/features/ui/components/modals/onboarding-flow-modal/steps/display-identity-step.tsx b/src/features/ui/components/modals/onboarding-flow-modal/steps/display-identity-step.tsx index 3437369a6..a08f800a7 100644 --- a/src/features/ui/components/modals/onboarding-flow-modal/steps/display-identity-step.tsx +++ b/src/features/ui/components/modals/onboarding-flow-modal/steps/display-identity-step.tsx @@ -1,4 +1,3 @@ -import helpSquare from '@tabler/icons/outline/help-square-rounded.svg'; import xIcon from '@tabler/icons/outline/x.svg'; import { useMutation } from '@tanstack/react-query'; import React, { useState } from 'react'; @@ -6,11 +5,8 @@ import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; import Button from 'soapbox/components/ui/button.tsx'; import FormGroup from 'soapbox/components/ui/form-group.tsx'; -import HStack from 'soapbox/components/ui/hstack.tsx'; import IconButton from 'soapbox/components/ui/icon-button.tsx'; -import Popover from 'soapbox/components/ui/popover.tsx'; import Stack from 'soapbox/components/ui/stack.tsx'; -import SvgIcon from 'soapbox/components/ui/svg-icon.tsx'; import Text from 'soapbox/components/ui/text.tsx'; import Textarea from 'soapbox/components/ui/textarea.tsx'; import { UsernameInput } from 'soapbox/features/edit-identity/index.tsx'; @@ -22,12 +18,9 @@ import toast from 'soapbox/toast.tsx'; const closeIcon = xIcon; const messages = defineMessages({ - title: { id: 'onboarding.display_identity.title', defaultMessage: 'Choose an Identity' }, - subtitle: { id: 'onboarding.display_identity.subtitle', defaultMessage: 'You can always edit this later.' }, - label: { id: 'onboarding.display_identity.label', defaultMessage: 'Identity' }, - helpText: { id: 'onboarding.display_identity.help_text', defaultMessage: 'This identifier is a unique username that represents you on the platform. This username can be used to personalize your experience and facilitate communication within the community.' }, - placeholder: { id: 'onboarding.display_identity.fields.reason_placeholder', defaultMessage: 'Why do you want to be part of the {siteTitle} community?' }, - requested: { id: 'onboarding.display_identity.request', defaultMessage: 'Username requested' }, + label: { id: 'onboarding.username.label', defaultMessage: 'Username' }, + placeholder: { id: 'onboarding.username.fields.reason_placeholder', defaultMessage: 'Why do you want to be part of the {siteTitle} community?' }, + requested: { id: 'onboarding.username.request', defaultMessage: 'Username requested' }, error: { id: 'onboarding.error', defaultMessage: 'An unexpected error occurred. Please try again or skip this step.' }, saving: { id: 'onboarding.saving', defaultMessage: 'Saving…' }, next: { id: 'onboarding.next', defaultMessage: 'Next' }, @@ -61,9 +54,8 @@ const DisplayUserNameStep: React.FC = ({ onClose, onNext } const [username, setUsername] = useState(''); const [reason, setReason] = useState(''); - const trimmedValue = username.trim(); - const isValid = trimmedValue.length > 0; - const isDisabled = !isValid || username.length > 30; + const isValid = username.trim().length > 0; + const isDisabled = !isValid; const handleSubmit = () => { const name = `${username}@${instance.domain}`; @@ -72,6 +64,7 @@ const DisplayUserNameStep: React.FC = ({ onClose, onNext } mutate({ name, reason }, { onSuccess() { + onNext(); toast.success(intl.formatMessage(messages.requested)); queryClient.invalidateQueries({ queryKey: ['names', 'pending'], @@ -85,43 +78,21 @@ const DisplayUserNameStep: React.FC = ({ onClose, onNext } return ( - - {/* */}
- + - +
- -
- {intl.formatMessage(messages.label)} -
- - {intl.formatMessage(messages.helpText)} - - } - > -
- -
-
- - - } - > + setUsername(e.target.value)} />