From b0e95457107d52e75d0954775df60698365e3eda Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 17 Jul 2025 21:33:57 +0300 Subject: [PATCH] tweak styles to try and match latest --- src/screens/Signup/StepHandle.tsx | 151 ++++++++++-------------------- 1 file changed, 50 insertions(+), 101 deletions(-) diff --git a/src/screens/Signup/StepHandle.tsx b/src/screens/Signup/StepHandle.tsx index c81a05d58d..f892bc7fad 100644 --- a/src/screens/Signup/StepHandle.tsx +++ b/src/screens/Signup/StepHandle.tsx @@ -17,19 +17,14 @@ import { validateServiceHandle, } from '#/lib/strings/handles' import {logger} from '#/logger' -import {isNative} from '#/platform/detection' import {useHandleAvailabilityQuery} from '#/state/queries/handle-availablility' import {useAgent} from '#/state/session' import {ScreenTransition} from '#/screens/Login/ScreenTransition' import {useSignupContext} from '#/screens/Signup/state' -import {atoms as a, useTheme} from '#/alf' +import {atoms as a, native, useTheme} from '#/alf' import * as TextField from '#/components/forms/TextField' import {useThrottledValue} from '#/components/hooks/useThrottledValue' import {At_Stroke2_Corner0_Rounded as AtIcon} from '#/components/icons/At' -import {Circle_Stroke2_Corner0_Rounded as CircleIcon} from '#/components/icons/Circle' -import {CircleCheck_Stroke2_Corner0_Rounded as CircleCheckIcon} from '#/components/icons/CircleCheck' -import {CircleX_Stroke2_Corner0_Rounded as CircleXIcon} from '#/components/icons/CircleX' -import {Loader} from '#/components/Loader' import {Text} from '#/components/Typography' import {BackNextButtons} from './BackNextButtons' @@ -130,11 +125,18 @@ export function StepHandle() { ) } + const textFieldInvalid = + (!isLoading && isHandleAvailable && !isHandleAvailable.available) || + !validCheck.frontLengthNotTooLong || + !validCheck.handleChars || + !validCheck.hyphenStartOrEnd || + !validCheck.totalLength + return ( - + - + - + {state.error && ( - - + {state.error} )} - {(isHandleAvailable || isLoading) && validCheck.overall && ( - - - - {isLoading ? ( - Checking... - ) : isHandleAvailable?.available ? ( - Available! - ) : isHandleAvailable?.reason === 'taken' ? ( - Taken - ) : ( - Invalid - )} - + {isHandleAvailable && + !isHandleAvailable.available && + validCheck.overall && ( + + + {isHandleAvailable?.reason === 'taken' ? ( + + {createFullHandle(draftValue, state.userDomain)} is + taken + + ) : ( + + {createFullHandle(draftValue, state.userDomain)} is + invalid + + )} + + + )} + {(!validCheck.handleChars || !validCheck.hyphenStartOrEnd) && ( + + {!validCheck.hyphenStartOrEnd ? ( + + Doesn't begin or end with a hyphen + + ) : ( + + Only contains letters, numbers, and hyphens + + )} )} - - - {!validCheck.hyphenStartOrEnd ? ( - - Doesn't begin or end with a hyphen - - ) : ( - - Only contains letters, numbers, and hyphens - - )} - - - - {!validCheck.frontLengthNotTooLong || !validCheck.totalLength ? ( + {(!validCheck.frontLengthNotTooLong || + !validCheck.totalLength) && ( No longer than{' '} @@ -232,10 +212,6 @@ export function StepHandle() { /> - ) : ( - - At least 3 characters - )} @@ -251,19 +227,13 @@ export function StepHandle() { ) } -function Requirement({ - children, - fade, -}: { - children: React.ReactNode - fade?: boolean -}) { +function Requirement({children}: {children: React.ReactNode}) { return ( + style={[a.w_full]} + layout={native(LinearTransition)} + entering={native(FadeIn)} + exiting={native(FadeOut)}> {children} ) @@ -272,29 +242,8 @@ function Requirement({ function RequirementText({children}: {children: React.ReactNode}) { const t = useTheme() return ( - + {children} ) } - -function RequirementIcon({ - state, -}: { - state: 'initial' | 'valid' | 'invalid' | 'loading' -}) { - const t = useTheme() - - switch (state) { - case 'initial': - return - case 'valid': - return ( - - ) - case 'invalid': - return - case 'loading': - return - } -}