Skip to content

Full Toolkit for Next-Level Domain Analysis

Add link to results with location from globe 🔗

Felix Wotschofskyce21d86427b4
diff --git a/app/lookup/[domain]/map/page.tsx b/app/lookup/[domain]/map/page.tsx
index 64584d9..5ee8441 100644
--- a/app/lookup/[domain]/map/page.tsx
+++ b/app/lookup/[domain]/map/page.tsx
@@ -37,6 +37,7 @@ const MapResultsPage: FC<MapResultsPageProps> = async ({
return {
...data,
+ code,
results: {
A: results.A.map((r) => r.data),
AAAA: results.AAAA.map((r) => r.data),
@@ -46,7 +47,7 @@ const MapResultsPage: FC<MapResultsPageProps> = async ({
})
);
- return <ResultsGlobe markers={markers} />;
+ return <ResultsGlobe domain={domain} markers={markers} />;
};
export default MapResultsPage;
diff --git a/components/ResultsGlobe.tsx b/components/ResultsGlobe.tsx
index 653bd81..38af998 100644
--- a/components/ResultsGlobe.tsx
+++ b/components/ResultsGlobe.tsx
@@ -3,7 +3,8 @@
import h from 'hyperscript';
import { useTheme } from 'next-themes';
import dynamic from 'next/dynamic';
-import { type FC, useEffect, useRef, useState } from 'react';
+import { useRouter } from 'next/navigation';
+import { type FC, useEffect, useId, useRef, useState } from 'react';
import { cn } from '@/lib/utils';
@@ -14,7 +15,9 @@ const Globe = dynamic(() => import('react-globe.gl'), { ssr: false });
export const runtime = 'edge';
type ResultsGlobeProps = {
+ domain: string;
markers: {
+ code: string;
name: string;
lat: number;
lng: number;
@@ -26,7 +29,8 @@ type ResultsGlobeProps = {
}[];
};
-const ResultsGlobe: FC<ResultsGlobeProps> = ({ markers }) => {
+const ResultsGlobe: FC<ResultsGlobeProps> = ({ domain, markers }) => {
+ const router = useRouter();
const { resolvedTheme } = useTheme();
const wrapperRef = useRef<HTMLDivElement>(null);
const [width, setWidth] = useState<number | undefined>(undefined);
@@ -119,7 +123,23 @@ const ResultsGlobe: FC<ResultsGlobeProps> = ({ markers }) => {
'p.text-xs.text-muted-foreground.italic',
'No records found!'
)
- : undefined
+ : undefined,
+
+ h(
+ 'p.text-xs.text-muted-foreground.italic',
+ h(
+ 'a.underline.decoration-dotted',
+ {
+ href: `/lookup/${domain}?resolver=cloudflare&location=${d.code}`,
+ onclick: (event: MouseEvent) => {
+ event.preventDefault();
+ const el = event.target as HTMLAnchorElement;
+ router.push(el.href);
+ },
+ },
+ 'View full results'
+ )
+ )
)
);
}}