@namehash/namehash-ui 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +227 -90
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +88 -116
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +125 -5
- package/dist/index.d.ts +125 -5
- package/dist/index.js +225 -88
- package/dist/index.js.map +1 -1
- package/package.json +13 -8
package/dist/index.js
CHANGED
|
@@ -4275,9 +4275,6 @@ import { formatDistance, formatDistanceStrict as formatDistanceStrict2, fromUnix
|
|
|
4275
4275
|
import { millisecondsInSecond } from "date-fns/constants";
|
|
4276
4276
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
4277
4277
|
|
|
4278
|
-
// src/components/ui/tooltip.tsx
|
|
4279
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4280
|
-
|
|
4281
4278
|
// src/utils/cn.ts
|
|
4282
4279
|
import { clsx } from "clsx";
|
|
4283
4280
|
import { twMerge } from "tailwind-merge";
|
|
@@ -4286,8 +4283,8 @@ function cn(...inputs) {
|
|
|
4286
4283
|
}
|
|
4287
4284
|
|
|
4288
4285
|
// src/components/ui/tooltip.tsx
|
|
4286
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4289
4287
|
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4290
|
-
var TooltipArrow = TooltipPrimitive.Arrow;
|
|
4291
4288
|
function TooltipProvider({
|
|
4292
4289
|
delayDuration = 0,
|
|
4293
4290
|
...props
|
|
@@ -4414,8 +4411,7 @@ function RelativeTime({
|
|
|
4414
4411
|
}
|
|
4415
4412
|
),
|
|
4416
4413
|
" ",
|
|
4417
|
-
"(UTC)"
|
|
4418
|
-
/* @__PURE__ */ jsx19(TooltipArrow, { width: 12, height: 8 })
|
|
4414
|
+
"(UTC)"
|
|
4419
4415
|
]
|
|
4420
4416
|
}
|
|
4421
4417
|
)
|
|
@@ -5148,6 +5144,19 @@ function AddressDisplay({ address, className }) {
|
|
|
5148
5144
|
import BoringAvatar from "boring-avatars";
|
|
5149
5145
|
import * as React3 from "react";
|
|
5150
5146
|
|
|
5147
|
+
// src/utils/ensMetadata.ts
|
|
5148
|
+
import { ENSNamespaceIds } from "@ensnode/ensnode-sdk";
|
|
5149
|
+
function getEnsMetadataServiceAvatarUrl(name, namespaceId) {
|
|
5150
|
+
switch (namespaceId) {
|
|
5151
|
+
case ENSNamespaceIds.Mainnet:
|
|
5152
|
+
return new URL(name, `https://metadata.ens.domains/mainnet/avatar/`);
|
|
5153
|
+
case ENSNamespaceIds.Sepolia:
|
|
5154
|
+
return new URL(name, `https://metadata.ens.domains/sepolia/avatar/`);
|
|
5155
|
+
case ENSNamespaceIds.EnsTestEnv:
|
|
5156
|
+
return null;
|
|
5157
|
+
}
|
|
5158
|
+
}
|
|
5159
|
+
|
|
5151
5160
|
// src/components/ui/avatar.tsx
|
|
5152
5161
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
5153
5162
|
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
@@ -5175,19 +5184,6 @@ function AvatarImage({ className, ...props }) {
|
|
|
5175
5184
|
);
|
|
5176
5185
|
}
|
|
5177
5186
|
|
|
5178
|
-
// src/utils/ensMetadata.ts
|
|
5179
|
-
import { ENSNamespaceIds } from "@ensnode/ensnode-sdk";
|
|
5180
|
-
function getEnsMetadataServiceAvatarUrl(name, namespaceId) {
|
|
5181
|
-
switch (namespaceId) {
|
|
5182
|
-
case ENSNamespaceIds.Mainnet:
|
|
5183
|
-
return new URL(name, `https://metadata.ens.domains/mainnet/avatar/`);
|
|
5184
|
-
case ENSNamespaceIds.Sepolia:
|
|
5185
|
-
return new URL(name, `https://metadata.ens.domains/sepolia/avatar/`);
|
|
5186
|
-
case ENSNamespaceIds.EnsTestEnv:
|
|
5187
|
-
return null;
|
|
5188
|
-
}
|
|
5189
|
-
}
|
|
5190
|
-
|
|
5191
5187
|
// src/components/identity/EnsAvatar.tsx
|
|
5192
5188
|
import { jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5193
5189
|
var EnsAvatar = ({ name, namespaceId, className, isSquare = false }) => {
|
|
@@ -5208,7 +5204,7 @@ var EnsAvatar = ({ name, namespaceId, className, isSquare = false }) => {
|
|
|
5208
5204
|
}
|
|
5209
5205
|
),
|
|
5210
5206
|
loadingStatus === "error" && /* @__PURE__ */ jsx34(EnsAvatarFallback, { name, isSquare }),
|
|
5211
|
-
(loadingStatus === "idle" || loadingStatus === "loading") && /* @__PURE__ */ jsx34(AvatarLoading, {
|
|
5207
|
+
(loadingStatus === "idle" || loadingStatus === "loading") && /* @__PURE__ */ jsx34(AvatarLoading, { isSquare })
|
|
5212
5208
|
] });
|
|
5213
5209
|
};
|
|
5214
5210
|
var avatarFallbackColors = ["#000000", "#bedbff", "#5191c1", "#1e6495", "#0a4b75"];
|
|
@@ -5222,17 +5218,18 @@ var EnsAvatarFallback = ({ name, isSquare }) => /* @__PURE__ */ jsx34(
|
|
|
5222
5218
|
square: isSquare
|
|
5223
5219
|
}
|
|
5224
5220
|
);
|
|
5225
|
-
var AvatarLoading = ({
|
|
5221
|
+
var AvatarLoading = ({ isSquare }) => /* @__PURE__ */ jsx34(
|
|
5226
5222
|
"div",
|
|
5227
5223
|
{
|
|
5228
5224
|
className: cn(
|
|
5229
|
-
"nhui:h-full nhui:w-full nhui:
|
|
5230
|
-
|
|
5225
|
+
"nhui:h-full nhui:w-full nhui:animate-pulse nhui:bg-gray-200",
|
|
5226
|
+
!isSquare && "nhui:rounded-full"
|
|
5231
5227
|
)
|
|
5232
5228
|
}
|
|
5233
5229
|
);
|
|
5234
5230
|
|
|
5235
5231
|
// src/components/identity/Identity.tsx
|
|
5232
|
+
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
5236
5233
|
import {
|
|
5237
5234
|
DEFAULT_EVM_CHAIN_ID,
|
|
5238
5235
|
isResolvedIdentity,
|
|
@@ -5240,6 +5237,52 @@ import {
|
|
|
5240
5237
|
translateDefaultableChainIdToChainId
|
|
5241
5238
|
} from "@ensnode/ensnode-sdk";
|
|
5242
5239
|
|
|
5240
|
+
// src/utils/blockExplorers.ts
|
|
5241
|
+
var getBlockExplorerUrl = (chainId) => {
|
|
5242
|
+
const chain = SUPPORTED_CHAINS.find((chain2) => chain2.id === chainId);
|
|
5243
|
+
if (!chain) return null;
|
|
5244
|
+
if (!chain.blockExplorers) return null;
|
|
5245
|
+
return new URL(chain.blockExplorers.default.url);
|
|
5246
|
+
};
|
|
5247
|
+
var getBlockExplorerAddressDetailsUrl = (chainId, address) => {
|
|
5248
|
+
const chainBlockExplorer = getBlockExplorerUrl(chainId);
|
|
5249
|
+
if (!chainBlockExplorer) return null;
|
|
5250
|
+
return new URL(`address/${address}`, chainBlockExplorer.toString());
|
|
5251
|
+
};
|
|
5252
|
+
var getBlockExplorerTransactionDetailsUrl = (chainId, transactionHash) => {
|
|
5253
|
+
const chainBlockExplorer = getBlockExplorerUrl(chainId);
|
|
5254
|
+
if (!chainBlockExplorer) return null;
|
|
5255
|
+
return new URL(`tx/${transactionHash}`, chainBlockExplorer.toString());
|
|
5256
|
+
};
|
|
5257
|
+
var getBlockExplorerBlockUrl = (chainId, blockNumber) => {
|
|
5258
|
+
const chainBlockExplorer = getBlockExplorerUrl(chainId);
|
|
5259
|
+
if (!chainBlockExplorer) return null;
|
|
5260
|
+
return new URL(`block/${blockNumber}`, chainBlockExplorer.toString());
|
|
5261
|
+
};
|
|
5262
|
+
|
|
5263
|
+
// src/utils/ensManager.ts
|
|
5264
|
+
import { ENSNamespaceIds as ENSNamespaceIds2 } from "@ensnode/ensnode-sdk";
|
|
5265
|
+
function getEnsManagerUrl(namespaceId) {
|
|
5266
|
+
switch (namespaceId) {
|
|
5267
|
+
case ENSNamespaceIds2.Mainnet:
|
|
5268
|
+
return new URL(`https://app.ens.domains/`);
|
|
5269
|
+
case ENSNamespaceIds2.Sepolia:
|
|
5270
|
+
return new URL(`https://sepolia.app.ens.domains/`);
|
|
5271
|
+
case ENSNamespaceIds2.EnsTestEnv:
|
|
5272
|
+
return null;
|
|
5273
|
+
}
|
|
5274
|
+
}
|
|
5275
|
+
function getEnsManagerNameDetailsUrl(name, namespaceId) {
|
|
5276
|
+
const baseUrl = getEnsManagerUrl(namespaceId);
|
|
5277
|
+
if (!baseUrl) return null;
|
|
5278
|
+
return new URL(name, baseUrl);
|
|
5279
|
+
}
|
|
5280
|
+
function getEnsManagerAddressDetailsUrl(address, namespaceId) {
|
|
5281
|
+
const baseUrl = getEnsManagerUrl(namespaceId);
|
|
5282
|
+
if (!baseUrl) return null;
|
|
5283
|
+
return new URL(address, baseUrl);
|
|
5284
|
+
}
|
|
5285
|
+
|
|
5243
5286
|
// src/components/special-buttons/CopyButton.tsx
|
|
5244
5287
|
import * as React4 from "react";
|
|
5245
5288
|
import { toast } from "sonner";
|
|
@@ -5343,7 +5386,7 @@ function CopyButton({
|
|
|
5343
5386
|
type: "button",
|
|
5344
5387
|
onClick: copyToClipboard,
|
|
5345
5388
|
disabled: isCopying,
|
|
5346
|
-
className: cn(className),
|
|
5389
|
+
className: cn("nhui:cursor-pointer", className),
|
|
5347
5390
|
...props,
|
|
5348
5391
|
children: [
|
|
5349
5392
|
hasCopied ? successIcon ? successIcon : "Copied" : icon ? icon : "Copy",
|
|
@@ -5353,49 +5396,16 @@ function CopyButton({
|
|
|
5353
5396
|
);
|
|
5354
5397
|
}
|
|
5355
5398
|
|
|
5356
|
-
// src/utils/blockExplorers.ts
|
|
5357
|
-
var getBlockExplorerUrl = (chainId) => {
|
|
5358
|
-
const chain = SUPPORTED_CHAINS.find((chain2) => chain2.id === chainId);
|
|
5359
|
-
if (!chain) return null;
|
|
5360
|
-
if (!chain.blockExplorers) return null;
|
|
5361
|
-
return new URL(chain.blockExplorers.default.url);
|
|
5362
|
-
};
|
|
5363
|
-
var getBlockExplorerAddressDetailsUrl = (chainId, address) => {
|
|
5364
|
-
const chainBlockExplorer = getBlockExplorerUrl(chainId);
|
|
5365
|
-
if (!chainBlockExplorer) return null;
|
|
5366
|
-
return new URL(`address/${address}`, chainBlockExplorer.toString());
|
|
5367
|
-
};
|
|
5368
|
-
var getBlockExplorerTransactionDetailsUrl = (chainId, transactionHash) => {
|
|
5369
|
-
const chainBlockExplorer = getBlockExplorerUrl(chainId);
|
|
5370
|
-
if (!chainBlockExplorer) return null;
|
|
5371
|
-
return new URL(`tx/${transactionHash}`, chainBlockExplorer.toString());
|
|
5372
|
-
};
|
|
5373
|
-
|
|
5374
|
-
// src/utils/ensManager.ts
|
|
5375
|
-
import { ENSNamespaceIds as ENSNamespaceIds2 } from "@ensnode/ensnode-sdk";
|
|
5376
|
-
function getEnsManagerUrl(namespaceId) {
|
|
5377
|
-
switch (namespaceId) {
|
|
5378
|
-
case ENSNamespaceIds2.Mainnet:
|
|
5379
|
-
return new URL(`https://app.ens.domains/`);
|
|
5380
|
-
case ENSNamespaceIds2.Sepolia:
|
|
5381
|
-
return new URL(`https://sepolia.app.ens.domains/`);
|
|
5382
|
-
case ENSNamespaceIds2.EnsTestEnv:
|
|
5383
|
-
return null;
|
|
5384
|
-
}
|
|
5385
|
-
}
|
|
5386
|
-
function getEnsManagerAddressDetailsUrl(address, namespaceId) {
|
|
5387
|
-
const baseUrl = getEnsManagerUrl(namespaceId);
|
|
5388
|
-
if (!baseUrl) return null;
|
|
5389
|
-
return new URL(address, baseUrl);
|
|
5390
|
-
}
|
|
5391
|
-
|
|
5392
5399
|
// src/components/identity/Identity.tsx
|
|
5393
|
-
import { jsx as jsx37, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5400
|
+
import { Fragment as Fragment3, jsx as jsx37, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5394
5401
|
function IdentityLink({
|
|
5395
5402
|
linkDetails,
|
|
5396
5403
|
className,
|
|
5397
5404
|
children
|
|
5398
5405
|
}) {
|
|
5406
|
+
if (linkDetails.link === null) {
|
|
5407
|
+
return /* @__PURE__ */ jsx37(Fragment3, { children });
|
|
5408
|
+
}
|
|
5399
5409
|
return /* @__PURE__ */ jsx37(
|
|
5400
5410
|
"a",
|
|
5401
5411
|
{
|
|
@@ -5440,7 +5450,7 @@ var IdentityTooltip = ({
|
|
|
5440
5450
|
TooltipContent,
|
|
5441
5451
|
{
|
|
5442
5452
|
side: "top",
|
|
5443
|
-
className: "nhui:bg-gray-50 nhui:text-sm nhui:text-black nhui:text-left nhui:shadow-md nhui:outline-hidden nhui:w-fit",
|
|
5453
|
+
className: "nhui:bg-gray-50 nhui:text-sm nhui:text-black nhui:text-left nhui:shadow-md nhui:outline-hidden nhui:w-fit [&_svg]:fill-gray-50 [&_svg]:bg-gray-50",
|
|
5444
5454
|
children: /* @__PURE__ */ jsxs26("div", { className: "nhui:flex nhui:gap-4", children: [
|
|
5445
5455
|
/* @__PURE__ */ jsx37("div", { className: "nhui:flex nhui:items-center", children: /* @__PURE__ */ jsx37(
|
|
5446
5456
|
ChainIcon,
|
|
@@ -5460,7 +5470,10 @@ var IdentityTooltip = ({
|
|
|
5460
5470
|
CopyButton,
|
|
5461
5471
|
{
|
|
5462
5472
|
value: identity.address,
|
|
5463
|
-
className: "nhui:text-gray-500 nhui:hover:text-gray-700 nhui:transition-colors"
|
|
5473
|
+
className: "nhui:text-gray-500 nhui:hover:text-gray-700 nhui:transition-colors",
|
|
5474
|
+
successIcon: /* @__PURE__ */ jsx37(CheckIcon, { className: "nhui:h-4 nhui:w-4" }),
|
|
5475
|
+
icon: /* @__PURE__ */ jsx37(CopyIcon, { className: "nhui:h-4 nhui:w-4" }),
|
|
5476
|
+
showToast: true
|
|
5464
5477
|
}
|
|
5465
5478
|
),
|
|
5466
5479
|
chainExplorerUrl && /* @__PURE__ */ jsx37("a", { target: "_blank", href: chainExplorerUrl.toString(), children: /* @__PURE__ */ jsx37(
|
|
@@ -5502,19 +5515,6 @@ import {
|
|
|
5502
5515
|
translateDefaultableChainIdToChainId as translateDefaultableChainIdToChainId2
|
|
5503
5516
|
} from "@ensnode/ensnode-sdk";
|
|
5504
5517
|
|
|
5505
|
-
// src/components/ui/skeleton.tsx
|
|
5506
|
-
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
5507
|
-
function Skeleton({ className, ...props }) {
|
|
5508
|
-
return /* @__PURE__ */ jsx39(
|
|
5509
|
-
"div",
|
|
5510
|
-
{
|
|
5511
|
-
"data-slot": "skeleton",
|
|
5512
|
-
className: cn("nhui:bg-accent nhui:animate-pulse nhui:rounded-md", className),
|
|
5513
|
-
...props
|
|
5514
|
-
}
|
|
5515
|
-
);
|
|
5516
|
-
}
|
|
5517
|
-
|
|
5518
5518
|
// src/hooks/useIsMobile.tsx
|
|
5519
5519
|
import * as React5 from "react";
|
|
5520
5520
|
var MOBILE_BREAKPOINT = 640;
|
|
@@ -5532,6 +5532,19 @@ function useIsMobile() {
|
|
|
5532
5532
|
return !!isMobile;
|
|
5533
5533
|
}
|
|
5534
5534
|
|
|
5535
|
+
// src/components/ui/skeleton.tsx
|
|
5536
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
5537
|
+
function Skeleton({ className, ...props }) {
|
|
5538
|
+
return /* @__PURE__ */ jsx39(
|
|
5539
|
+
"div",
|
|
5540
|
+
{
|
|
5541
|
+
"data-slot": "skeleton",
|
|
5542
|
+
className: cn("nhui:bg-accent nhui:animate-pulse nhui:rounded-md", className),
|
|
5543
|
+
...props
|
|
5544
|
+
}
|
|
5545
|
+
);
|
|
5546
|
+
}
|
|
5547
|
+
|
|
5535
5548
|
// src/components/identity/ResolveAndDisplayIdentity.tsx
|
|
5536
5549
|
import { jsx as jsx40, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5537
5550
|
function ResolveAndDisplayIdentity({
|
|
@@ -5697,7 +5710,6 @@ function ResolveAndDisplayReferrerIdentity({
|
|
|
5697
5710
|
referral,
|
|
5698
5711
|
accelerate = true,
|
|
5699
5712
|
withLink = true,
|
|
5700
|
-
identityLinkDetails,
|
|
5701
5713
|
withTooltip = true,
|
|
5702
5714
|
withAvatar = false,
|
|
5703
5715
|
withIdentifier = true,
|
|
@@ -5750,12 +5762,16 @@ function ResolveAndDisplayReferrerIdentity({
|
|
|
5750
5762
|
withIdentifier,
|
|
5751
5763
|
className,
|
|
5752
5764
|
withLink,
|
|
5753
|
-
identityLinkDetails
|
|
5765
|
+
identityLinkDetails: {
|
|
5766
|
+
isExternal: true,
|
|
5767
|
+
link: getEnsManagerAddressDetailsUrl(referrerIdentity.address, namespaceId)
|
|
5768
|
+
}
|
|
5754
5769
|
}
|
|
5755
5770
|
);
|
|
5756
5771
|
}
|
|
5757
5772
|
function RegistrarActionCardLoading({
|
|
5758
|
-
showReferrer = true
|
|
5773
|
+
showReferrer = true,
|
|
5774
|
+
showReferralProgramField = true
|
|
5759
5775
|
}) {
|
|
5760
5776
|
const isMobile = useIsMobile();
|
|
5761
5777
|
return /* @__PURE__ */ jsxs28(
|
|
@@ -5780,7 +5796,7 @@ function RegistrarActionCardLoading({
|
|
|
5780
5796
|
/* @__PURE__ */ jsx41("div", { className: "nhui:animate-pulse nhui:h-[14px] nhui:mt-[4px] nhui:mb-[3px] nhui:bg-gray-200 nhui:rounded-sm nhui:w-1/4 nhui:sm:w-3/5" })
|
|
5781
5797
|
] }) })
|
|
5782
5798
|
] }),
|
|
5783
|
-
/* @__PURE__ */ jsx41(LabeledField, { fieldLabel: "Incentive program", className: "nhui:w-[15%] nhui:min-w-[162px]", children: /* @__PURE__ */ jsx41("div", { className: "nhui:animate-pulse nhui:h-[14px] nhui:mt-[4px] nhui:mb-[3px] nhui:bg-gray-200 nhui:rounded-sm nhui:w-1/4 nhui:sm:w-4/5" }) })
|
|
5799
|
+
showReferralProgramField && /* @__PURE__ */ jsx41(LabeledField, { fieldLabel: "Incentive program", className: "nhui:w-[15%] nhui:min-w-[162px]", children: /* @__PURE__ */ jsx41("div", { className: "nhui:animate-pulse nhui:h-[14px] nhui:mt-[4px] nhui:mb-[3px] nhui:bg-gray-200 nhui:rounded-sm nhui:w-1/4 nhui:sm:w-4/5" }) })
|
|
5784
5800
|
]
|
|
5785
5801
|
}
|
|
5786
5802
|
);
|
|
@@ -5815,15 +5831,15 @@ function RegistrarActionCard({
|
|
|
5815
5831
|
{
|
|
5816
5832
|
className: "nhui:w-full nhui:min-h-[80px] nhui:box-border nhui:flex nhui:flex-col nhui:sm:flex-row nhui:flex-wrap nhui:justify-start nhui:sm:justify-between\n nhui:items-start nhui:gap-2 nhui:p-4 nhui:sm:p-6 nhui:sm:gap-y-5 nhui:rounded-2xl nhui:border nhui:border-gray-200 nhui:text-sm nhui:bg-white",
|
|
5817
5833
|
children: [
|
|
5818
|
-
/* @__PURE__ */ jsx41(LabeledField, { fieldLabel: "Name", className: "nhui:w-[15%] nhui:min-w-[162px]", children: /* @__PURE__ */ jsx41(
|
|
5834
|
+
/* @__PURE__ */ jsx41(LabeledField, { fieldLabel: "Name", className: "nhui:w-[15%] nhui:min-w-[162px]", children: links.name.link !== null ? /* @__PURE__ */ jsx41(
|
|
5819
5835
|
"a",
|
|
5820
5836
|
{
|
|
5821
|
-
target: "_blank",
|
|
5837
|
+
target: links.name.isExternal ? "_blank" : "_self",
|
|
5822
5838
|
href: links.name.link.href,
|
|
5823
5839
|
className: "nhui:max-sm:max-w-3/4 nhui:sm:w-full nhui:box-border nhui:overflow-x-auto nhui:text-blue-600 nhui:font-medium nhui:hover:underline nhui:hover:underline-offset-[25%] nhui:whitespace-nowrap",
|
|
5824
5840
|
children: /* @__PURE__ */ jsx41(NameDisplay, { name: namedRegistrarAction.name, className: "nhui:h-[21px]" })
|
|
5825
5841
|
}
|
|
5826
|
-
) }),
|
|
5842
|
+
) : /* @__PURE__ */ jsx41("p", { className: "nhui:max-sm:max-w-3/4 nhui:sm:w-full nhui:box-border nhui:overflow-x-auto nhui:font-medium nhui:whitespace-nowrap", children: /* @__PURE__ */ jsx41(NameDisplay, { name: namedRegistrarAction.name, className: "nhui:h-[21px]" }) }) }),
|
|
5827
5843
|
/* @__PURE__ */ jsx41(
|
|
5828
5844
|
LabeledField,
|
|
5829
5845
|
{
|
|
@@ -5875,8 +5891,7 @@ function RegistrarActionCard({
|
|
|
5875
5891
|
referral,
|
|
5876
5892
|
withAvatar: true,
|
|
5877
5893
|
withIdentifier: false,
|
|
5878
|
-
withTooltip: false
|
|
5879
|
-
identityLinkDetails: links.referrer
|
|
5894
|
+
withTooltip: false
|
|
5880
5895
|
}
|
|
5881
5896
|
),
|
|
5882
5897
|
/* @__PURE__ */ jsx41(LabeledField, { fieldLabel: "Referrer", className: "nhui:w-[15%] nhui:min-w-[110px]", children: /* @__PURE__ */ jsx41(
|
|
@@ -5887,8 +5902,7 @@ function RegistrarActionCard({
|
|
|
5887
5902
|
referral,
|
|
5888
5903
|
withAvatar: isMobile,
|
|
5889
5904
|
withIdentifier: true,
|
|
5890
|
-
withTooltip: false
|
|
5891
|
-
identityLinkDetails: links.referrer
|
|
5905
|
+
withTooltip: false
|
|
5892
5906
|
}
|
|
5893
5907
|
) })
|
|
5894
5908
|
] }),
|
|
@@ -5898,12 +5912,125 @@ function RegistrarActionCard({
|
|
|
5898
5912
|
);
|
|
5899
5913
|
}
|
|
5900
5914
|
var RegistrarActionCardMemo = memo(RegistrarActionCard);
|
|
5915
|
+
|
|
5916
|
+
// src/hooks/useNow.ts
|
|
5917
|
+
import { useEffect as useEffect6, useState as useState7 } from "react";
|
|
5918
|
+
|
|
5919
|
+
// src/hooks/useSystemClock.ts
|
|
5920
|
+
import { getUnixTime } from "date-fns";
|
|
5921
|
+
import { useSyncExternalStore } from "react";
|
|
5922
|
+
|
|
5923
|
+
// src/utils/syncedClock.ts
|
|
5924
|
+
var DEFAULT_TICK_RATE = 16;
|
|
5925
|
+
var HighResolutionSyncedClock = class {
|
|
5926
|
+
#listeners = /* @__PURE__ */ new Set();
|
|
5927
|
+
#currentTime = Date.now();
|
|
5928
|
+
#timerId = null;
|
|
5929
|
+
/**
|
|
5930
|
+
* Tick rate frequency in milliseconds.
|
|
5931
|
+
*/
|
|
5932
|
+
#tickRate;
|
|
5933
|
+
/**
|
|
5934
|
+
* Clock's tick handler.
|
|
5935
|
+
*
|
|
5936
|
+
* Runs at `tickRate` frequency, and notifies all listeners about
|
|
5937
|
+
* the current time updates.
|
|
5938
|
+
*/
|
|
5939
|
+
#tick = () => {
|
|
5940
|
+
this.#currentTime = Date.now();
|
|
5941
|
+
this.#listeners.forEach((listener) => listener());
|
|
5942
|
+
this.#timerId = setTimeout(this.#tick, this.#tickRate);
|
|
5943
|
+
};
|
|
5944
|
+
/**
|
|
5945
|
+
* Starts the clock.
|
|
5946
|
+
*/
|
|
5947
|
+
start = () => {
|
|
5948
|
+
if (this.#timerId === null) {
|
|
5949
|
+
this.#currentTime = Date.now();
|
|
5950
|
+
this.#timerId = setTimeout(this.#tick, this.#tickRate);
|
|
5951
|
+
}
|
|
5952
|
+
};
|
|
5953
|
+
/**
|
|
5954
|
+
* Stops the clock.
|
|
5955
|
+
*/
|
|
5956
|
+
stop = () => {
|
|
5957
|
+
if (this.#timerId !== null) {
|
|
5958
|
+
clearTimeout(this.#timerId);
|
|
5959
|
+
this.#timerId = null;
|
|
5960
|
+
}
|
|
5961
|
+
};
|
|
5962
|
+
constructor(tickRate = DEFAULT_TICK_RATE) {
|
|
5963
|
+
this.#tickRate = tickRate;
|
|
5964
|
+
}
|
|
5965
|
+
/**
|
|
5966
|
+
* Adds a new listener to all listeners tracking the synced clock.
|
|
5967
|
+
*
|
|
5968
|
+
* Starts the clock (or restarts it, which is a noop) if there's at
|
|
5969
|
+
* least one listener.
|
|
5970
|
+
*
|
|
5971
|
+
* @param callback to notify the listener about clock updates.
|
|
5972
|
+
*/
|
|
5973
|
+
addListener(callback) {
|
|
5974
|
+
this.#listeners.add(callback);
|
|
5975
|
+
if (this.#listeners.size > 0) {
|
|
5976
|
+
this.start();
|
|
5977
|
+
}
|
|
5978
|
+
}
|
|
5979
|
+
/**
|
|
5980
|
+
* Removes a listener from all listeners tracking the synced clock.
|
|
5981
|
+
*
|
|
5982
|
+
* Stops the clock if there's no listener.
|
|
5983
|
+
*
|
|
5984
|
+
* @param callback to notify the listener about clock updates.
|
|
5985
|
+
*/
|
|
5986
|
+
removeListener(callback) {
|
|
5987
|
+
this.#listeners.delete(callback);
|
|
5988
|
+
if (this.#listeners.size === 0) {
|
|
5989
|
+
this.stop();
|
|
5990
|
+
}
|
|
5991
|
+
}
|
|
5992
|
+
get currentTime() {
|
|
5993
|
+
return this.#currentTime;
|
|
5994
|
+
}
|
|
5995
|
+
};
|
|
5996
|
+
|
|
5997
|
+
// src/utils/systemClock.ts
|
|
5998
|
+
var systemClock = new HighResolutionSyncedClock();
|
|
5999
|
+
|
|
6000
|
+
// src/hooks/useSystemClock.ts
|
|
6001
|
+
function useSystemClock() {
|
|
6002
|
+
const subscribe = (callback) => {
|
|
6003
|
+
systemClock.addListener(callback);
|
|
6004
|
+
return () => {
|
|
6005
|
+
systemClock.removeListener(callback);
|
|
6006
|
+
};
|
|
6007
|
+
};
|
|
6008
|
+
const getSnapshot = () => getUnixTime(new Date(systemClock.currentTime));
|
|
6009
|
+
const getServerSnapshot = () => getUnixTime(/* @__PURE__ */ new Date());
|
|
6010
|
+
const syncedSystemClock = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
6011
|
+
return syncedSystemClock ?? getSnapshot();
|
|
6012
|
+
}
|
|
6013
|
+
|
|
6014
|
+
// src/hooks/useNow.ts
|
|
6015
|
+
var DEFAULT_TIME_TO_REFRESH = 1;
|
|
6016
|
+
function useNow(props) {
|
|
6017
|
+
const clock = useSystemClock();
|
|
6018
|
+
const [throttledClock, setThrottledClock] = useState7(clock);
|
|
6019
|
+
const { timeToRefresh = DEFAULT_TIME_TO_REFRESH } = props || {};
|
|
6020
|
+
useEffect6(() => {
|
|
6021
|
+
if (clock - throttledClock >= timeToRefresh) {
|
|
6022
|
+
setThrottledClock(clock);
|
|
6023
|
+
}
|
|
6024
|
+
}, [timeToRefresh, clock, throttledClock]);
|
|
6025
|
+
return throttledClock;
|
|
6026
|
+
}
|
|
5901
6027
|
export {
|
|
5902
6028
|
AbsoluteTime,
|
|
5903
6029
|
AddressDisplay,
|
|
5904
6030
|
ChainExplorerIcon,
|
|
5905
6031
|
ChainIcon,
|
|
5906
6032
|
ChainName,
|
|
6033
|
+
CopyButton,
|
|
5907
6034
|
DisplayDuration,
|
|
5908
6035
|
DisplayIdentity,
|
|
5909
6036
|
EfpIcon,
|
|
@@ -5925,7 +6052,17 @@ export {
|
|
|
5925
6052
|
ResolveAndDisplayIdentity,
|
|
5926
6053
|
TelegramIcon,
|
|
5927
6054
|
TwitterIcon,
|
|
5928
|
-
formatRelativeTime
|
|
6055
|
+
formatRelativeTime,
|
|
6056
|
+
getBlockExplorerAddressDetailsUrl,
|
|
6057
|
+
getBlockExplorerBlockUrl,
|
|
6058
|
+
getBlockExplorerTransactionDetailsUrl,
|
|
6059
|
+
getBlockExplorerUrl,
|
|
6060
|
+
getChainName,
|
|
6061
|
+
getEnsManagerAddressDetailsUrl,
|
|
6062
|
+
getEnsManagerNameDetailsUrl,
|
|
6063
|
+
getEnsManagerUrl,
|
|
6064
|
+
getEnsMetadataServiceAvatarUrl,
|
|
6065
|
+
useNow
|
|
5929
6066
|
};
|
|
5930
6067
|
/*! Bundled license information:
|
|
5931
6068
|
|