Skip to content

Full Toolkit for Next-Level Domain Analysis

Keep the domain summary, DNS map and header search from shifting the page while they load πŸ“πŸŒ (#132)

Felix Wotschofskyffce57f0f8d8
diff --git a/app/_components/star-button.tsx b/app/_components/star-button.tsx
index d4b94cb..c1530ab 100644
--- a/app/_components/star-button.tsx
+++ b/app/_components/star-button.tsx
@@ -18,7 +18,9 @@ export const StarButton: FC = () => {
rel="noopener"
>
<StarIcon className="mr-1 h-4 w-4 fill-yellow-400 text-yellow-400" />
- <span className="hidden md:inline">
+ {/* Wide enough for the count, so the search bar next to it stays put
+ when the count replaces "Star" */}
+ <span className="hidden min-w-[5ch] tabular-nums md:inline-block">
{data?.totalStars ? data.totalStars.toLocaleString() : 'Star'}
<span className="sr-only"> on GitHub</span>
</span>
diff --git a/app/lookup/[domain]/_components/domain-summary.tsx b/app/lookup/[domain]/_components/domain-summary.tsx
index 39e8fe5..1339435 100644
--- a/app/lookup/[domain]/_components/domain-summary.tsx
+++ b/app/lookup/[domain]/_components/domain-summary.tsx
@@ -21,20 +21,25 @@ import { Skeleton } from '@/components/ui/skeleton';
import type { DomainSummaryResponse } from '@/app/api/domain-summary/route';
import { formatSalePrice } from '@/lib/format-sale-price';
import { canonicalDnsName } from '@/lib/resolvers/base';
+import { cn } from '@/lib/utils';
type DomainSummaryTileProps = {
title: string;
+ className?: string;
} & (
| { loading: true; value?: ReactNode }
| { loading?: false; value: ReactNode }
);
+// The minimum widths keep the tiles in place, and wrapping onto the same rows,
+// when the loaded values replace the placeholders
const DomainSummaryTile: FC<DomainSummaryTileProps> = ({
title,
+ className,
loading,
value,
}) => (
- <div className="max-w-sm break-words">
+ <div className={cn('max-w-sm min-w-32 break-words', className)}>
<h3 className="text-xs/6 font-medium text-zinc-500 dark:text-zinc-400">
{title}
</h3>
@@ -131,7 +136,7 @@ export const DomainSummary: FC<{ domain: string }> = ({ domain }) => {
if (isLoading || !data) {
return (
<div className="flex flex-wrap gap-8">
- <DomainSummaryTile title="Registrar" loading />
+ <DomainSummaryTile title="Registrar" className="min-w-56" loading />
<DomainSummaryTile title="Creation Date" loading />
<DomainSummaryTile title="DNSSEC" loading />
</div>
@@ -158,6 +163,7 @@ export const DomainSummary: FC<{ domain: string }> = ({ domain }) => {
<div className="flex flex-wrap gap-8">
<DomainSummaryTile
title="Registrar"
+ className="min-w-56"
value={whois.registrar || 'Unavailable'}
/>
<DomainSummaryTile
diff --git a/app/lookup/[domain]/map/_components/results-globe.tsx b/app/lookup/[domain]/map/_components/results-globe.tsx
index 9966241..26294e4 100644
--- a/app/lookup/[domain]/map/_components/results-globe.tsx
+++ b/app/lookup/[domain]/map/_components/results-globe.tsx
@@ -153,8 +153,10 @@ export const ResultsGlobe: FC<ResultsGlobeProps> = ({ domain, markers }) => {
return createMarker(data.name, data.results, href, onClick);
};
+ // The globe is as tall as the window, so its height is reserved up front or
+ // the footer jumps down once the globe has loaded
return (
- <div ref={wrapperRef} className={cn(styles.wrapper, 'w-full')}>
+ <div ref={wrapperRef} className={cn(styles.wrapper, 'min-h-screen w-full')}>
<Globe
ref={handleGlobeRef as unknown as RefObject<GlobeMethods | undefined>}
atmosphereColor="#d4d4d8" // Zinc 300