Full Toolkit for Next-Level Domain Analysis
Remove search from error message 😠
Felix Wotschofsky4620ea697aa9
diff --git a/app/_components/search-form.tsx b/app/_components/search-form.tsxindex 9878f09..8d4813b 100644--- a/app/_components/search-form.tsx+++ b/app/_components/search-form.tsx@@ -74,7 +74,7 @@ export const SearchForm: FC<SearchFormProps> = (props) => {const [domain, setDomain] = useState(props.initialValue ?? '');const [state, setState] = useState<FormStates>(FormStates.Initial);- const [error, setError] = useState(false);+ const [isInvalid, setInvalid] = useState(false);const [suggestionsVisible, setSuggestionsVisible] = useState(false);const inputRef = useRef<HTMLInputElement>(null);@@ -113,18 +113,18 @@ export const SearchForm: FC<SearchFormProps> = (props) => {const normalizedDomain = normalizeDomain(domain);if (!isValidDomain(normalizedDomain)) {- setError(true);+ setInvalid(true);return;}- setError(false);+ setInvalid(false);redirectUser(normalizedDomain);plausible('Search Form: Submit', {props: { domain: normalizedDomain },});},- [setError, domain, redirectUser, plausible]+ [setInvalid, domain, redirectUser, plausible]);const { suggestions } = useSuggestions(domain);@@ -137,7 +137,7 @@ export const SearchForm: FC<SearchFormProps> = (props) => {const handleSelectSuggestion = useCallback((value: string) => {- setError(false);+ setInvalid(false);setDomain(value);setSuggestionsVisible(false);@@ -210,7 +210,7 @@ export const SearchForm: FC<SearchFormProps> = (props) => {}, [isFirstRender, setSuggestionsVisible]);return (- <div>+ <><form className="flex gap-3" onSubmit={handleSubmit}><div className="group relative flex-[3]">{domain === props.initialValue ? (@@ -226,7 +226,10 @@ export const SearchForm: FC<SearchFormProps> = (props) => {<Inputref={inputRef}- className="w-full pl-9"+ className={cn('w-full pl-9', {+ 'focus-visible:ring-red-500 [&:not(:focus-visible)]:border-red-500':+ isInvalid,+ })}type="text"requiredplaceholder="Search any domain or URL"@@ -291,12 +294,6 @@ export const SearchForm: FC<SearchFormProps> = (props) => {Lookup</Button></form>-- <p className="mt-2 whitespace-pre text-center text-sm text-red-600">- {error- ? 'An error occurred! Please check your input or try again later.'- : ' '}- </p>- </div>+ </>);};diff --git a/app/lookup/[domain]/layout.tsx b/app/lookup/[domain]/layout.tsxindex 6f7aec4..87d67d7 100644--- a/app/lookup/[domain]/layout.tsx+++ b/app/lookup/[domain]/layout.tsx@@ -52,7 +52,7 @@ const LookupLayout: FC<LookupLayoutProps> = ({return (<>- <div className="container mb-8 max-w-xl">+ <div className="container mb-12 max-w-xl"><SearchForm initialValue={domain} autofocus={false} /></div>