-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathpage.tsx
More file actions
49 lines (40 loc) · 1.62 KB
/
Copy pathpage.tsx
File metadata and controls
49 lines (40 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"use client";
import { getEnsManagerNameDetailsUrl } from "@namehash/namehash-ui";
import { ScanSearch } from "lucide-react";
import Link from "next/link";
import { useSearchParams } from "next/navigation";
import type { Name } from "@ensnode/ensnode-sdk";
import { ExternalLinkWithIcon } from "@/components/link";
import { getRecordResolutionRelativePath } from "@/components/name-links";
import { Button } from "@/components/ui/button";
import { useNamespace } from "@/hooks/async/use-namespace";
import { useRawConnectionUrlParam } from "@/hooks/use-connection-url-param";
export default function ActionsNamePage() {
const searchParams = useSearchParams();
const nameParam = searchParams.get("name");
const name = nameParam ? (nameParam as Name) : null;
const { data: namespace } = useNamespace();
const { retainCurrentRawConnectionUrlParam } = useRawConnectionUrlParam();
if (!name) return null;
const inspectRecordsHref = retainCurrentRawConnectionUrlParam(
getRecordResolutionRelativePath(name),
);
const ensAppProfileUrl = namespace ? getEnsManagerNameDetailsUrl(name, namespace) : null;
return (
<div className="flex items-center gap-2">
<Button variant="link" size="sm" asChild>
<Link href={inspectRecordsHref} className="inline-flex items-center gap-1">
Inspect Records
<ScanSearch size={12} />
</Link>
</Button>
{ensAppProfileUrl && (
<Button variant="link" size="sm" asChild>
<ExternalLinkWithIcon href={ensAppProfileUrl.toString()}>
View in ENS App
</ExternalLinkWithIcon>
</Button>
)}
</div>
);
}