Skip to content

Commit 8cb5bcd

Browse files
committed
feat: support name servers
1 parent d834c9b commit 8cb5bcd

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

src/lib/whois.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export type WhoisAnalyzeResult = {
6969
creationDate: string;
7070
expirationDate: string;
7171
status: DomainStatusProps[];
72+
nameServers: string[];
7273
registrantOrganization: string;
7374
registrantProvince: string;
7475
registrantCountry: string;
@@ -92,6 +93,7 @@ const initialWhoisAnalyzeResult: WhoisAnalyzeResult = {
9293
creationDate: "Unknown",
9394
expirationDate: "Unknown",
9495
status: [],
96+
nameServers: [],
9597
registrantOrganization: "Unknown",
9698
registrantProvince: "Unknown",
9799
registrantCountry: "Unknown",
@@ -181,6 +183,9 @@ export function analyzeWhois(data: string): WhoisAnalyzeResult {
181183
case "domain status":
182184
result.status.push(analyzeDomainStatus(value));
183185
break;
186+
case "name server":
187+
result.nameServers.push(value);
188+
break;
184189
case "registrant name":
185190
result.registrantOrganization = value;
186191
break;

src/pages/[query].tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
Loader2,
1919
Search,
2020
Send,
21-
X,
2221
} from "lucide-react";
2322
import React, { useEffect, useMemo } from "react";
2423
import { addHistory } from "@/lib/history";
@@ -186,6 +185,7 @@ function ResultTable({ result }: ResultTableProps) {
186185
};
187186

188187
const [expand, setExpand] = React.useState<boolean>(false);
188+
const copy = useClipboard();
189189

190190
return (
191191
result && (
@@ -251,6 +251,25 @@ function ResultTable({ result }: ResultTableProps) {
251251
</div>
252252
</Row>
253253
<Row name={`Registrant Email`} value={result.registrantEmail} />
254+
<Row
255+
name={`Name Server`}
256+
value={
257+
<div className={`flex flex-col`}>
258+
{result.nameServers.length > 0
259+
? result.nameServers.map((ns, index) => (
260+
<div
261+
key={index}
262+
className={`text-secondary text-xs border cursor-pointer rounded-md px-1 py-0.5 mt-0.5 w-fit inline-flex flex-row items-center`}
263+
onClick={() => copy(ns)}
264+
>
265+
<CopyIcon className={`w-2.5 h-2.5 mr-1`} />
266+
{ns}
267+
</div>
268+
))
269+
: "N/A"}
270+
</div>
271+
}
272+
/>
254273
</tbody>
255274
</table>
256275
)
@@ -330,7 +349,7 @@ export default function Lookup({ data, target }: Props) {
330349
<ScrollArea className={`w-full h-full`}>
331350
<main
332351
className={
333-
"w-full min-h-full grid place-items-center px-4 md:px-6 py-8 md:pt-[10vh] md:pb-[5vh]"
352+
"relative w-full min-h-full grid place-items-center px-4 pt-20 pb-6"
334353
}
335354
>
336355
<div

0 commit comments

Comments
 (0)