Skip to content

Commit 5d5446f

Browse files
committed
add clickable links to ip lookup page
1 parent 9c5236e commit 5d5446f

File tree

5 files changed

+49
-19
lines changed

5 files changed

+49
-19
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ next-env.d.ts
2323
# misc
2424
.DS_Store
2525
*.pem
26-
*.bin
2726

2827
# debug
2928
npm-debug.log*

src/app/(tools)/(domain)/dns/[domain]/page.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { Metadata } from 'next';
22
import { unstable_cache } from 'next/cache';
33
import Link from 'next/link';
4-
import { notFound } from 'next/navigation';
54

65
import { CloudflareIcon } from '@/components/icons/cloudflare';
76
import { Badge } from '@/components/ui/badge';

src/app/(tools)/ip/[ip]/page.tsx

+46-14
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { CheckIcon, SearchIcon, XIcon } from 'lucide-react';
22
import type { Metadata } from 'next';
33
import { unstable_cache } from 'next/cache';
44
import Image from 'next/image';
5+
import Link from 'next/link';
56
import { notFound } from 'next/navigation';
67

78
import { Button } from '@/components/ui/button';
@@ -72,22 +73,44 @@ export default async function IPLookupResultPage({
7273
ISP: () => (
7374
<div className="space-y-1">
7475
<div>
75-
<p>{result.asn.org}</p>
76+
<p className="font-medium">{result.asn.org}</p>
7677
<p className="font-mono text-xs">{result.asn.descr}</p>
7778
</div>
7879
<div>
7980
<p className="text-xs">
80-
Abuse email: <span className="font-mono">{result.asn.abuse}</span>
81+
Abuse email:{' '}
82+
<Link
83+
className="font-mono hover:underline"
84+
rel="nofollow noopener"
85+
target="_blank"
86+
href={
87+
result.asn.abuse.includes('@')
88+
? `mailto:${result.asn.abuse}`
89+
: `https://${result.asn.abuse}`
90+
}
91+
>
92+
{result.asn.abuse}
93+
</Link>
8194
</p>
82-
<p className="text-xs">
95+
<p className="whitespace-nowrap text-xs">
8396
Abuse score:{' '}
8497
<span className="font-mono">{result.asn.abuser_score}</span>
8598
</p>
8699
</div>
87100
<div>
88-
<p className="text-xs">
89-
Domain: <span className="font-mono">{result.asn.domain}</span>
90-
</p>
101+
{result.asn.domain && (
102+
<p className="text-xs">
103+
Domain:{' '}
104+
<Link
105+
href={`https://${result.asn.domain}`}
106+
className="font-mono hover:underline"
107+
rel="nofollow noopener"
108+
target="_blank"
109+
>
110+
{result.asn.domain}
111+
</Link>
112+
</p>
113+
)}
91114
<p className="text-xs">
92115
Route: <span className="font-mono">{result.asn.route}</span>
93116
</p>
@@ -105,21 +128,30 @@ export default async function IPLookupResultPage({
105128
return (
106129
<div className="space-y-1">
107130
<div>
108-
<p>{result.company.name}</p>
131+
<p className="font-medium">{result.company.name}</p>
109132
<p className="text-xs">
110133
Network:{' '}
111134
<span className="font-mono">{result.company.network}</span>
112135
</p>
113136
</div>
114137
<div>
115-
<p className="text-xs">
138+
<p className="whitespace-nowrap text-xs">
116139
Abuse score:{' '}
117140
<span className="font-mono">{result.company.abuser_score}</span>
118141
</p>
119-
<p className="text-xs">
120-
Domain:{' '}
121-
<span className="font-mono">{result.company.domain}</span>
122-
</p>
142+
{result.company.domain && (
143+
<p className="text-xs">
144+
Domain:{' '}
145+
<Link
146+
href={`https://${result.company.domain}`}
147+
className="font-mono hover:underline"
148+
rel="nofollow noopener"
149+
target="_blank"
150+
>
151+
{result.company.domain}
152+
</Link>
153+
</p>
154+
)}
123155
<p className="text-xs">
124156
Type:{' '}
125157
<span className="font-mono">
@@ -131,7 +163,7 @@ export default async function IPLookupResultPage({
131163
);
132164
},
133165
Properties: () => (
134-
<div className="grid max-w-96 grid-cols-4 gap-1">
166+
<div className="grid grid-cols-2 gap-1 lg:grid-cols-4">
135167
{properties.map((property) => {
136168
const PropertyIcon = property.value ? CheckIcon : XIcon;
137169
return (
@@ -201,7 +233,7 @@ export default async function IPLookupResultPage({
201233
}
202234
return (
203235
<TableRow key={label}>
204-
<TableCell className="w-36 whitespace-nowrap align-top font-medium">
236+
<TableCell className="whitespace-nowrap align-top font-medium">
205237
{label}
206238
</TableCell>
207239
<TableCell>{val}</TableCell>

src/app/api/trpc/[trpc]/route.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const createContext = async (req: NextRequest) => {
1515

1616
const handler = (req: NextRequest) =>
1717
fetchRequestHandler({
18-
endpoint: '/api/trpc',
1918
req,
2019
router: appRouter,
20+
endpoint: '/api/trpc',
2121
createContext: () => createContext(req),
2222
onError:
2323
env.NODE_ENV === 'development'

src/lib/ip.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type IPResult = {
1414
company: {
1515
name: string;
1616
abuser_score: string;
17-
domain: string;
17+
domain?: string;
1818
type: string;
1919
network: string;
2020
};
@@ -33,7 +33,7 @@ export type IPResult = {
3333
country: string;
3434
active: boolean;
3535
org: string;
36-
domain: string;
36+
domain?: string;
3737
abuse: string;
3838
type: string;
3939
created: string;

0 commit comments

Comments
 (0)