update checks, disable button if unavailable
This commit is contained in:
@@ -126,11 +126,14 @@ export function StepHandle() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isHandleTaken =
|
||||||
|
!isPending &&
|
||||||
|
queryEnabled &&
|
||||||
|
isHandleAvailable &&
|
||||||
|
!isHandleAvailable.available
|
||||||
|
|
||||||
const textFieldInvalid =
|
const textFieldInvalid =
|
||||||
(!isPending &&
|
isHandleTaken ||
|
||||||
queryEnabled &&
|
|
||||||
isHandleAvailable &&
|
|
||||||
!isHandleAvailable.available) ||
|
|
||||||
!validCheck.frontLengthNotTooLong ||
|
!validCheck.frontLengthNotTooLong ||
|
||||||
!validCheck.handleChars ||
|
!validCheck.handleChars ||
|
||||||
!validCheck.hyphenStartOrEnd ||
|
!validCheck.hyphenStartOrEnd ||
|
||||||
@@ -175,38 +178,35 @@ export function StepHandle() {
|
|||||||
<RequirementText>{state.error}</RequirementText>
|
<RequirementText>{state.error}</RequirementText>
|
||||||
</Requirement>
|
</Requirement>
|
||||||
)}
|
)}
|
||||||
{queryEnabled &&
|
{isHandleTaken && validCheck.overall && (
|
||||||
isHandleAvailable &&
|
<>
|
||||||
!isHandleAvailable.available &&
|
<Requirement>
|
||||||
validCheck.overall && (
|
<RequirementText>
|
||||||
<>
|
<Trans>
|
||||||
<Requirement>
|
{createFullHandle(draftValue, state.userDomain)} is not
|
||||||
<RequirementText>
|
available
|
||||||
<Trans>
|
</Trans>
|
||||||
{createFullHandle(draftValue, state.userDomain)} is not
|
</RequirementText>
|
||||||
available
|
</Requirement>
|
||||||
</Trans>
|
{isHandleAvailable.suggestions &&
|
||||||
</RequirementText>
|
isHandleAvailable.suggestions.length > 0 && (
|
||||||
</Requirement>
|
<HandleSuggestions
|
||||||
{isHandleAvailable.suggestions &&
|
suggestions={isHandleAvailable.suggestions}
|
||||||
isHandleAvailable.suggestions.length > 0 && (
|
onSelect={suggestion => {
|
||||||
<HandleSuggestions
|
setDraftValue(
|
||||||
suggestions={isHandleAvailable.suggestions}
|
suggestion.handle.slice(
|
||||||
onSelect={suggestion => {
|
0,
|
||||||
setDraftValue(
|
state.userDomain.length * -1,
|
||||||
suggestion.handle.slice(
|
),
|
||||||
0,
|
)
|
||||||
state.userDomain.length * -1,
|
logger.metric('signup:handleSuggestionSelected', {
|
||||||
),
|
method: suggestion.method,
|
||||||
)
|
})
|
||||||
logger.metric('signup:handleSuggestionSelected', {
|
}}
|
||||||
method: suggestion.method,
|
/>
|
||||||
})
|
)}
|
||||||
}}
|
</>
|
||||||
/>
|
)}
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{(!validCheck.handleChars || !validCheck.hyphenStartOrEnd) && (
|
{(!validCheck.handleChars || !validCheck.hyphenStartOrEnd) && (
|
||||||
<Requirement>
|
<Requirement>
|
||||||
{!validCheck.hyphenStartOrEnd ? (
|
{!validCheck.hyphenStartOrEnd ? (
|
||||||
@@ -215,7 +215,10 @@ export function StepHandle() {
|
|||||||
</RequirementText>
|
</RequirementText>
|
||||||
) : (
|
) : (
|
||||||
<RequirementText>
|
<RequirementText>
|
||||||
<Trans>Only contains letters, numbers, and hyphens</Trans>
|
<Trans>
|
||||||
|
Username must only contain letters (a-z), numbers, and
|
||||||
|
hyphens
|
||||||
|
</Trans>
|
||||||
</RequirementText>
|
</RequirementText>
|
||||||
)}
|
)}
|
||||||
</Requirement>
|
</Requirement>
|
||||||
@@ -240,7 +243,7 @@ export function StepHandle() {
|
|||||||
<Animated.View layout={native(LinearTransition)}>
|
<Animated.View layout={native(LinearTransition)}>
|
||||||
<BackNextButtons
|
<BackNextButtons
|
||||||
isLoading={isNextLoading}
|
isLoading={isNextLoading}
|
||||||
isNextDisabled={!validCheck.overall || !!state.error}
|
isNextDisabled={!validCheck.overall || !!state.error || isHandleTaken}
|
||||||
onBackPress={onBackPress}
|
onBackPress={onBackPress}
|
||||||
onNextPress={onNextPress}
|
onNextPress={onNextPress}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user