From 93c4719a2140070b33f69dd0f12b4de2619a25a6 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 8 Aug 2025 01:01:01 +0300 Subject: Check handle as you type (#8601) * check handle as you type * metrics * add metric types * fix overflow * only check reserved handles for bsky.social, fix test * change validation check name * tweak input * move ghosttext component to textfield * tweak styles to try and match latest * add suggestions * improvements, metrics * share logic between typeahead and next button * Apply suggestions from code review Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * update checks, disable button if unavailable * convert to lowercase * fix bug with checkHandleAvailability * add gate * move files around to make clearer * fix bad import * Fix flashing next button * Enable for TF --------- Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> Co-authored-by: Hailey Co-authored-by: Eric Bailey --- src/lib/strings/handles.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lib/strings/handles.ts') diff --git a/src/lib/strings/handles.ts b/src/lib/strings/handles.ts index 78a2e1a09..02b9943d3 100644 --- a/src/lib/strings/handles.ts +++ b/src/lib/strings/handles.ts @@ -34,7 +34,8 @@ export function sanitizeHandle(handle: string, prefix = ''): string { export interface IsValidHandle { handleChars: boolean hyphenStartOrEnd: boolean - frontLength: boolean + frontLengthNotTooShort: boolean + frontLengthNotTooLong: boolean totalLength: boolean overall: boolean } @@ -50,7 +51,8 @@ export function validateServiceHandle( handleChars: !str || (VALIDATE_REGEX.test(fullHandle) && !str.includes('.')), hyphenStartOrEnd: !str.startsWith('-') && !str.endsWith('-'), - frontLength: str.length >= 3 && str.length <= MAX_SERVICE_HANDLE_LENGTH, + frontLengthNotTooShort: str.length >= 3, + frontLengthNotTooLong: str.length <= MAX_SERVICE_HANDLE_LENGTH, totalLength: fullHandle.length <= 253, } -- cgit 1.4.1