Skip to content

Commit

Permalink
general improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
aelew committed Feb 6, 2024
1 parent 9db1b47 commit 872e135
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
35 changes: 19 additions & 16 deletions src/app/(tools)/(domain)/whois/[domain]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default async function WhoisLookupResultPage({
</Link>
);
}
return <span className="break-all">{contact.email}</span>;
return <span className="break-all sm:break-normal">{contact.email}</span>;
}
});

Expand Down Expand Up @@ -132,22 +132,25 @@ export default async function WhoisLookupResultPage({
),
Status: () => (
<div className="flex flex-col gap-2 sm:flex-row">
{result.domain.status.map((status) => (
<Link
href={`https://www.icann.org/epp#${status}`}
className="w-fit"
target="_blank"
key={status}
>
<Badge
className="-ml-[1px] border border-muted-foreground/25 shadow-sm hover:bg-muted"
variant="outline"
{result.domain.status.map((s) => {
const status =
EPP_STATUS_CODES.find((c) => s === c.toLowerCase()) ?? s;
return (
<Link
href={`https://www.icann.org/epp#${status}`}
className="w-fit"
target="_blank"
key={status}
>
{EPP_STATUS_CODES.find((c) => status === c.toLowerCase()) ??
status}
</Badge>
</Link>
))}
<Badge
className="-ml-[1px] border border-muted-foreground/25 shadow-sm hover:bg-muted-foreground/5"
variant="outline"
>
{status}
</Badge>
</Link>
);
})}
</div>
),
Nameservers: () => (
Expand Down
15 changes: 10 additions & 5 deletions src/app/(tools)/ip/[ip]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { Table, TableBody, TableCell, TableRow } from '@/components/ui/table';
import { CACHE_REVALIDATE_SECONDS } from '@/lib/config';
import { TOOLS } from '@/lib/resources/tools';
import { cn } from '@/lib/utils';
import { capitalize, cn } from '@/lib/utils';
import { api } from '@/trpc/server';
import type { InfoTable } from '@/types';
import { IPLookupForm } from '../form';
Expand Down Expand Up @@ -53,14 +53,19 @@ export default async function IPLookupResultPage({
}

const properties = Object.entries(result.properties).map(([key, value]) => ({
label: key === 'vpn' ? 'VPN' : key.charAt(0).toUpperCase() + key.slice(1),
label: key === 'vpn' ? 'VPN' : capitalize(key),
value
}));

const table = {
name: 'IP Address Information',
keys: {
Hostname: () => result.hostname,
Hostname: () =>
result.hostname && (
<Link href={`/whois/${result.hostname}`} className="hover:underline">
{result.hostname}
</Link>
),
'Time Zone': () => result.location.timezone,
Location: () =>
result.location.city +
Expand Down Expand Up @@ -94,7 +99,7 @@ export default async function IPLookupResultPage({
</p>
<p className="text-xs">
Type:{' '}
<span className="font-mono">{result.asn.type.toUpperCase()}</span>
<span className="font-mono">{capitalize(result.asn.type)}</span>
</p>
<p className="text-xs">
ASN: <span className="font-mono">{result.asn.asn.slice(2)}</span>
Expand Down Expand Up @@ -125,7 +130,7 @@ export default async function IPLookupResultPage({
<p className="text-xs">
Type:{' '}
<span className="font-mono">
{result.company.type.toUpperCase()}
{capitalize(result.company.type)}
</span>
</p>
</>
Expand Down
4 changes: 4 additions & 0 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

export function capitalize(str: string) {
return str.charAt(0).toUpperCase() + str.slice(1);
}

export function parseDomain(hostname: string) {
const result = _parseDomain(decodeURIComponent(hostname));
return result.type === ParseResultType.Listed
Expand Down

0 comments on commit 872e135

Please sign in to comment.