Full Toolkit for Next-Level Domain Analysis
Clean up landing page ✨
Felix Wotschofsky4b1fa5e333e5
diff --git a/app/(landing)/_components/trusted-by-logos.tsx b/app/(landing)/_components/trusted-by-logos.tsxindex 2218302..bc44ccf 100644--- a/app/(landing)/_components/trusted-by-logos.tsx+++ b/app/(landing)/_components/trusted-by-logos.tsx@@ -3,6 +3,7 @@ import Link from 'next/link';export const TrustedByLogos = () => (<div className="flex flex-wrap justify-center gap-8 [&_*]:h-7 [&_*]:w-auto"><Link href="/lookup/cloudflare.com">+ <span className="sr-only">Cloudflare</span><svgxmlns="http://www.w3.org/2000/svg"x="0"@@ -28,6 +29,7 @@ export const TrustedByLogos = () => (</Link><Link href="/lookup/atlassian.com">+ <span className="sr-only">Atlassian</span><svgxmlns="http://www.w3.org/2000/svg"width="195"@@ -47,6 +49,7 @@ export const TrustedByLogos = () => (</Link><Link href="/lookup/heroku.com">+ <span className="sr-only">Heroku</span><svgxmlns="http://www.w3.org/2000/svg"width="268"@@ -62,6 +65,7 @@ export const TrustedByLogos = () => (</Link><Link href="/lookup/webflow.com">+ <span className="sr-only">Webflow</span><svgxmlns="http://www.w3.org/2000/svg"width="1080"@@ -113,6 +117,7 @@ export const TrustedByLogos = () => (</Link><Link href="/lookup/sap.com">+ <span className="sr-only">SAP</span><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2500 1223"><pathclassName="fill-muted-foreground"diff --git a/app/(landing)/page.tsx b/app/(landing)/page.tsxindex a77ba5c..611f51f 100644--- a/app/(landing)/page.tsx+++ b/app/(landing)/page.tsx@@ -1,13 +1,7 @@import Image from 'next/image';-import Link from 'next/link';-import Balancer from 'react-wrap-balancer';import { Card } from '@/components/ui/card';-import LogoDark from '@/assets/logo-dark.svg';-import LogoLight from '@/assets/logo-light.svg';-import { EXAMPLE_DOMAINS } from '@/lib/data';-import { SearchForm } from '../_components/search-form';import { TrustedByLogos } from './_components/trusted-by-logos';@@ -22,47 +16,41 @@ export const metadata = {const Home = () => {return (- <div className="container">- <section className="py-24 sm:py-32">- <div className="flex items-center justify-center gap-4 sm:gap-6">- <LogoDark className="inline h-12 dark:hidden sm:h-20" />- <LogoLight className="hidden h-12 dark:inline sm:h-20" />- <span className="text-4xl font-bold sm:text-6xl">Domain Digger</span>- </div>-- <div className="my-16">- <h1 className="mb-8 scroll-m-20 pb-2 text-center text-2xl font-semibold tracking-tight first:mt-0 sm:text-3xl">- Get details about any Domain- </h1>- <div className="mx-auto max-w-4xl">- <SearchForm autofocus={true} />- </div>+ <div className="container space-y-16 pt-24">+ <section>+ <h1 className="mb-8 scroll-m-20 pb-2 text-center text-2xl font-semibold tracking-tight first:mt-0 sm:text-3xl">+ Get details about any Domain+ </h1>+ <div className="mx-auto max-w-4xl">+ <SearchForm autofocus={true} /></div>+ </section>- <div>+ <section>+ <div className="flex flex-col items-center gap-6"><h2 className="text-center font-semibold sm:text-lg">- Start with examples+ Trusted by experts at</h2>- <div className="mt-2 text-center text-sm leading-7 text-muted-foreground">- <Balancer>- {EXAMPLE_DOMAINS.map((domain) => (- <>- <Link- key={domain}- className="underline decoration-dotted underline-offset-4"- href={`/lookup/${domain}`}- >- {domain}- </Link>- <span className="whitespace-pre-wrap">{' '}</span>- </>- ))}- </Balancer>- </div>++ <TrustedByLogos />++ <a+ href="https://www.producthunt.com/posts/domain-digger?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-domain-digger"+ target="_blank"+ className="mt-2"+ >+ <img+ src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=434616&theme=neutral"+ alt="Domain Digger - Full open-source toolkit for next-level domain analysis | Product Hunt"+ style={{ width: '250px', height: '54px' }}+ width="250"+ height="54"+ />+ </a></div></section>- <section className="flex items-center justify-center gap-4 pb-16 font-medium sm:pb-24">+ <section className="flex items-center justify-center gap-4 font-medium"><Imagewidth={48}height={48}@@ -94,31 +82,7 @@ const Home = () => {</div></section>- <section>- <div className="flex flex-col items-center gap-8">- <h2 className="text-center font-semibold sm:text-lg">- Trusted by experts at- </h2>-- <TrustedByLogos />-- <a- href="https://www.producthunt.com/posts/domain-digger?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-domain-digger"- target="_blank"- className="mt-4"- >- <img- src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=434616&theme=neutral"- alt="Domain Digger - Full open-source toolkit for next-level domain analysis | Product Hunt"- style={{ width: '250px', height: '54px' }}- width="250"- height="54"- />- </a>- </div>- </section>-- <section className="mt-32">+ <section className="!mt-32"><h2 className="mb-6 text-center text-3xl font-bold">Domain Digger: The Essential Domain Information Tool</h2>diff --git a/app/_components/search-form.tsx b/app/_components/search-form.tsxindex dc24374..700e41d 100644--- a/app/_components/search-form.tsx+++ b/app/_components/search-form.tsx@@ -20,6 +20,7 @@ import useSWR from 'swr';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';+import { EXAMPLE_DOMAINS } from '@/lib/data';import { cn, isAppleDevice, isValidDomain } from '@/lib/utils';const normalizeDomain = (input: string) => {@@ -44,7 +45,22 @@ const useSuggestions = (domain: string) => {{ keepPreviousData: true });- return { suggestions };+ return {+ suggestions: domain ? suggestions : EXAMPLE_DOMAINS,+ };+};++const useFirstRender = () => {+ const isFirstRender = useRef(true);++ useEffect(() => {+ if (isFirstRender.current) {+ isFirstRender.current = false;+ return;+ }+ }, []);++ return isFirstRender;};enum FormStates {@@ -59,6 +75,8 @@ type SearchFormProps = {};export const SearchForm = (props: SearchFormProps) => {+ const isFirstRender = useFirstRender();+const plausible = usePlausible();const router = useRouter();@@ -136,17 +154,18 @@ export const SearchForm = (props: SearchFormProps) => {redirectUser(value);plausible('Search Form: Click Suggestion', {- props: { domain: value },+ props: {+ domain: value,+ isExample: !domain,+ },});},- [setDomain, redirectUser, plausible]+ [domain, setDomain, redirectUser, plausible]);const handleKeyDown = useCallback<KeyboardEventHandler<HTMLInputElement>>((event) => {- if (- !(suggestionsVisible && domain && suggestions && suggestions.length > 0)- ) {+ if (!(suggestionsVisible && suggestions && suggestions.length > 0)) {return;}@@ -177,13 +196,18 @@ export const SearchForm = (props: SearchFormProps) => {},[suggestionsVisible,- domain,suggestions,selectedSuggestion,handleSelectSuggestion,]);+ const handleFocus = useCallback(() => {+ // Skip the first render to avoid suggestions showing up on initial load without user interaction+ if (isFirstRender.current) return;+ setSuggestionsVisible(true);+ }, [isFirstRender, setSuggestionsVisible]);+return (<div><form className="flex gap-3" onSubmit={handleSubmit}>@@ -193,14 +217,15 @@ export const SearchForm = (props: SearchFormProps) => {className="w-full"type="text"required- placeholder="example.com"+ placeholder="Search any domain or URL"aria-label="Domain"value={domain}onInput={(event: ChangeEvent<HTMLInputElement>) =>setDomain(event.target.value)}onKeyDown={handleKeyDown}- onFocus={() => setSuggestionsVisible(true)}+ onFocus={handleFocus}+ onClick={handleFocus}onBlur={() => {setTimeout(() => {setSuggestionsVisible(false);@@ -220,25 +245,22 @@ export const SearchForm = (props: SearchFormProps) => {)}</kbd>- {suggestionsVisible &&- domain &&- suggestions &&- suggestions.length > 0 && (- <ul className="absolute left-0 top-full w-full rounded-xl border bg-card p-1 text-card-foreground shadow">- {suggestions.map((value, index) => (- <li- key={value}- className={cn(- 'cursor-pointer rounded-lg px-2 py-1 hover:bg-muted/50',- { 'bg-muted/50': selectedSuggestion === index }- )}- onClick={() => handleSelectSuggestion(value)}- >- {value}- </li>- ))}- </ul>- )}+ {suggestionsVisible && suggestions && suggestions.length > 0 && (+ <ul className="absolute left-0 top-full w-full rounded-xl border bg-card p-1 text-card-foreground shadow">+ {suggestions.map((value, index) => (+ <li+ key={value}+ className={cn(+ 'cursor-pointer rounded-lg px-2 py-1 hover:bg-muted/50',+ { 'bg-muted/50': selectedSuggestion === index }+ )}+ onClick={() => handleSelectSuggestion(value)}+ >+ {value}+ </li>+ ))}+ </ul>+ )}</div><ButtonclassName="flex-[1]"@@ -252,15 +274,11 @@ export const SearchForm = (props: SearchFormProps) => {</Button></form>- {error ? (- <p className="mt-2 text-center text-sm text-red-600">- An error occurred! Please check your input or try again later.- </p>- ) : (- <p className="mt-2 text-center text-sm text-muted-foreground">- It can be anything! An apex, subdomain, or even a URL.- </p>- )}+ <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/package.json b/package.jsonindex 9ae8255..71aa573 100644--- a/package.json+++ b/package.json@@ -52,7 +52,6 @@"react-icons": "^5.0.1","react-leaflet": "^4.2.1","react-string-replace": "^1.1.1",- "react-wrap-balancer": "^1.1.0","sonner": "^1.4.3","swr": "^2.2.5","tailwind-merge": "^2.2.2",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 0f3356a..4830ea1 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -116,9 +116,6 @@ dependencies:react-string-replace:specifier: ^1.1.1version: 1.1.1- react-wrap-balancer:- specifier: ^1.1.0- version: 1.1.0([email protected])sonner:specifier: ^1.4.3version: 1.4.3([email protected])([email protected])@@ -6300,14 +6297,6 @@ packages:tslib: 2.6.2dev: false- resolution: {integrity: sha512-EhF3jOZm5Fjx+Cx41e423qOv2c2aOvXAtym2OHqrGeMUnwERIyNsRBgnfT3plB170JmuYvts8K2KSPEIerKr5A==}- peerDependencies:- react: '>=16.8.0 || ^17.0.0 || ^18'- dependencies:- react: 18.2.0- dev: false-resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==}engines: {node: '>=0.10.0'}