@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/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Note: `@ensnode/ensnode-react` and `sonner` are package's peer dependencies. The
|
|
|
14
14
|
|
|
15
15
|
## Setup
|
|
16
16
|
|
|
17
|
-
The `namehash-ui` package comes with its own styles exported for some components, as well as global Tailwind styles
|
|
17
|
+
The `namehash-ui` package comes with its own styles exported for some components, as well as global Tailwind styles.
|
|
18
18
|
|
|
19
19
|
Make sure you import the `styles.css` file somewhere in your app:
|
|
20
20
|
|
package/dist/index.cjs
CHANGED
|
@@ -2180,6 +2180,7 @@ __export(index_exports, {
|
|
|
2180
2180
|
ChainExplorerIcon: () => ChainExplorerIcon,
|
|
2181
2181
|
ChainIcon: () => ChainIcon,
|
|
2182
2182
|
ChainName: () => ChainName,
|
|
2183
|
+
CopyButton: () => CopyButton,
|
|
2183
2184
|
DisplayDuration: () => DisplayDuration,
|
|
2184
2185
|
DisplayIdentity: () => DisplayIdentity,
|
|
2185
2186
|
EfpIcon: () => EfpIcon,
|
|
@@ -2201,7 +2202,17 @@ __export(index_exports, {
|
|
|
2201
2202
|
ResolveAndDisplayIdentity: () => ResolveAndDisplayIdentity,
|
|
2202
2203
|
TelegramIcon: () => TelegramIcon,
|
|
2203
2204
|
TwitterIcon: () => TwitterIcon,
|
|
2204
|
-
formatRelativeTime: () => formatRelativeTime
|
|
2205
|
+
formatRelativeTime: () => formatRelativeTime,
|
|
2206
|
+
getBlockExplorerAddressDetailsUrl: () => getBlockExplorerAddressDetailsUrl,
|
|
2207
|
+
getBlockExplorerBlockUrl: () => getBlockExplorerBlockUrl,
|
|
2208
|
+
getBlockExplorerTransactionDetailsUrl: () => getBlockExplorerTransactionDetailsUrl,
|
|
2209
|
+
getBlockExplorerUrl: () => getBlockExplorerUrl,
|
|
2210
|
+
getChainName: () => getChainName,
|
|
2211
|
+
getEnsManagerAddressDetailsUrl: () => getEnsManagerAddressDetailsUrl,
|
|
2212
|
+
getEnsManagerNameDetailsUrl: () => getEnsManagerNameDetailsUrl,
|
|
2213
|
+
getEnsManagerUrl: () => getEnsManagerUrl,
|
|
2214
|
+
getEnsMetadataServiceAvatarUrl: () => getEnsMetadataServiceAvatarUrl,
|
|
2215
|
+
useNow: () => useNow
|
|
2205
2216
|
});
|
|
2206
2217
|
module.exports = __toCommonJS(index_exports);
|
|
2207
2218
|
|
|
@@ -4335,9 +4346,6 @@ var import_date_fns3 = require("date-fns");
|
|
|
4335
4346
|
var import_constants = require("date-fns/constants");
|
|
4336
4347
|
var import_react3 = require("react");
|
|
4337
4348
|
|
|
4338
|
-
// src/components/ui/tooltip.tsx
|
|
4339
|
-
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
4340
|
-
|
|
4341
4349
|
// src/utils/cn.ts
|
|
4342
4350
|
var import_clsx = require("clsx");
|
|
4343
4351
|
var import_tailwind_merge = require("tailwind-merge");
|
|
@@ -4346,8 +4354,8 @@ function cn(...inputs) {
|
|
|
4346
4354
|
}
|
|
4347
4355
|
|
|
4348
4356
|
// src/components/ui/tooltip.tsx
|
|
4357
|
+
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
4349
4358
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
4350
|
-
var TooltipArrow = TooltipPrimitive.Arrow;
|
|
4351
4359
|
function TooltipProvider({
|
|
4352
4360
|
delayDuration = 0,
|
|
4353
4361
|
...props
|
|
@@ -4474,8 +4482,7 @@ function RelativeTime({
|
|
|
4474
4482
|
}
|
|
4475
4483
|
),
|
|
4476
4484
|
" ",
|
|
4477
|
-
"(UTC)"
|
|
4478
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TooltipArrow, { width: 12, height: 8 })
|
|
4485
|
+
"(UTC)"
|
|
4479
4486
|
]
|
|
4480
4487
|
}
|
|
4481
4488
|
)
|
|
@@ -5208,6 +5215,19 @@ function AddressDisplay({ address, className }) {
|
|
|
5208
5215
|
var import_boring_avatars = __toESM(require("boring-avatars"), 1);
|
|
5209
5216
|
var React3 = __toESM(require("react"), 1);
|
|
5210
5217
|
|
|
5218
|
+
// src/utils/ensMetadata.ts
|
|
5219
|
+
var import_ensnode_sdk = require("@ensnode/ensnode-sdk");
|
|
5220
|
+
function getEnsMetadataServiceAvatarUrl(name, namespaceId) {
|
|
5221
|
+
switch (namespaceId) {
|
|
5222
|
+
case import_ensnode_sdk.ENSNamespaceIds.Mainnet:
|
|
5223
|
+
return new URL(name, `https://metadata.ens.domains/mainnet/avatar/`);
|
|
5224
|
+
case import_ensnode_sdk.ENSNamespaceIds.Sepolia:
|
|
5225
|
+
return new URL(name, `https://metadata.ens.domains/sepolia/avatar/`);
|
|
5226
|
+
case import_ensnode_sdk.ENSNamespaceIds.EnsTestEnv:
|
|
5227
|
+
return null;
|
|
5228
|
+
}
|
|
5229
|
+
}
|
|
5230
|
+
|
|
5211
5231
|
// src/components/ui/avatar.tsx
|
|
5212
5232
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"), 1);
|
|
5213
5233
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
@@ -5235,19 +5255,6 @@ function AvatarImage({ className, ...props }) {
|
|
|
5235
5255
|
);
|
|
5236
5256
|
}
|
|
5237
5257
|
|
|
5238
|
-
// src/utils/ensMetadata.ts
|
|
5239
|
-
var import_ensnode_sdk = require("@ensnode/ensnode-sdk");
|
|
5240
|
-
function getEnsMetadataServiceAvatarUrl(name, namespaceId) {
|
|
5241
|
-
switch (namespaceId) {
|
|
5242
|
-
case import_ensnode_sdk.ENSNamespaceIds.Mainnet:
|
|
5243
|
-
return new URL(name, `https://metadata.ens.domains/mainnet/avatar/`);
|
|
5244
|
-
case import_ensnode_sdk.ENSNamespaceIds.Sepolia:
|
|
5245
|
-
return new URL(name, `https://metadata.ens.domains/sepolia/avatar/`);
|
|
5246
|
-
case import_ensnode_sdk.ENSNamespaceIds.EnsTestEnv:
|
|
5247
|
-
return null;
|
|
5248
|
-
}
|
|
5249
|
-
}
|
|
5250
|
-
|
|
5251
5258
|
// src/components/identity/EnsAvatar.tsx
|
|
5252
5259
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5253
5260
|
var EnsAvatar = ({ name, namespaceId, className, isSquare = false }) => {
|
|
@@ -5268,7 +5275,7 @@ var EnsAvatar = ({ name, namespaceId, className, isSquare = false }) => {
|
|
|
5268
5275
|
}
|
|
5269
5276
|
),
|
|
5270
5277
|
loadingStatus === "error" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EnsAvatarFallback, { name, isSquare }),
|
|
5271
|
-
(loadingStatus === "idle" || loadingStatus === "loading") && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AvatarLoading, {
|
|
5278
|
+
(loadingStatus === "idle" || loadingStatus === "loading") && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AvatarLoading, { isSquare })
|
|
5272
5279
|
] });
|
|
5273
5280
|
};
|
|
5274
5281
|
var avatarFallbackColors = ["#000000", "#bedbff", "#5191c1", "#1e6495", "#0a4b75"];
|
|
@@ -5282,19 +5289,66 @@ var EnsAvatarFallback = ({ name, isSquare }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
5282
5289
|
square: isSquare
|
|
5283
5290
|
}
|
|
5284
5291
|
);
|
|
5285
|
-
var AvatarLoading = ({
|
|
5292
|
+
var AvatarLoading = ({ isSquare }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5286
5293
|
"div",
|
|
5287
5294
|
{
|
|
5288
5295
|
className: cn(
|
|
5289
|
-
"nhui:h-full nhui:w-full nhui:
|
|
5290
|
-
|
|
5296
|
+
"nhui:h-full nhui:w-full nhui:animate-pulse nhui:bg-gray-200",
|
|
5297
|
+
!isSquare && "nhui:rounded-full"
|
|
5291
5298
|
)
|
|
5292
5299
|
}
|
|
5293
5300
|
);
|
|
5294
5301
|
|
|
5295
5302
|
// src/components/identity/Identity.tsx
|
|
5303
|
+
var import_lucide_react = require("lucide-react");
|
|
5296
5304
|
var import_ensnode_sdk3 = require("@ensnode/ensnode-sdk");
|
|
5297
5305
|
|
|
5306
|
+
// src/utils/blockExplorers.ts
|
|
5307
|
+
var getBlockExplorerUrl = (chainId) => {
|
|
5308
|
+
const chain = SUPPORTED_CHAINS.find((chain2) => chain2.id === chainId);
|
|
5309
|
+
if (!chain) return null;
|
|
5310
|
+
if (!chain.blockExplorers) return null;
|
|
5311
|
+
return new URL(chain.blockExplorers.default.url);
|
|
5312
|
+
};
|
|
5313
|
+
var getBlockExplorerAddressDetailsUrl = (chainId, address) => {
|
|
5314
|
+
const chainBlockExplorer = getBlockExplorerUrl(chainId);
|
|
5315
|
+
if (!chainBlockExplorer) return null;
|
|
5316
|
+
return new URL(`address/${address}`, chainBlockExplorer.toString());
|
|
5317
|
+
};
|
|
5318
|
+
var getBlockExplorerTransactionDetailsUrl = (chainId, transactionHash) => {
|
|
5319
|
+
const chainBlockExplorer = getBlockExplorerUrl(chainId);
|
|
5320
|
+
if (!chainBlockExplorer) return null;
|
|
5321
|
+
return new URL(`tx/${transactionHash}`, chainBlockExplorer.toString());
|
|
5322
|
+
};
|
|
5323
|
+
var getBlockExplorerBlockUrl = (chainId, blockNumber) => {
|
|
5324
|
+
const chainBlockExplorer = getBlockExplorerUrl(chainId);
|
|
5325
|
+
if (!chainBlockExplorer) return null;
|
|
5326
|
+
return new URL(`block/${blockNumber}`, chainBlockExplorer.toString());
|
|
5327
|
+
};
|
|
5328
|
+
|
|
5329
|
+
// src/utils/ensManager.ts
|
|
5330
|
+
var import_ensnode_sdk2 = require("@ensnode/ensnode-sdk");
|
|
5331
|
+
function getEnsManagerUrl(namespaceId) {
|
|
5332
|
+
switch (namespaceId) {
|
|
5333
|
+
case import_ensnode_sdk2.ENSNamespaceIds.Mainnet:
|
|
5334
|
+
return new URL(`https://app.ens.domains/`);
|
|
5335
|
+
case import_ensnode_sdk2.ENSNamespaceIds.Sepolia:
|
|
5336
|
+
return new URL(`https://sepolia.app.ens.domains/`);
|
|
5337
|
+
case import_ensnode_sdk2.ENSNamespaceIds.EnsTestEnv:
|
|
5338
|
+
return null;
|
|
5339
|
+
}
|
|
5340
|
+
}
|
|
5341
|
+
function getEnsManagerNameDetailsUrl(name, namespaceId) {
|
|
5342
|
+
const baseUrl = getEnsManagerUrl(namespaceId);
|
|
5343
|
+
if (!baseUrl) return null;
|
|
5344
|
+
return new URL(name, baseUrl);
|
|
5345
|
+
}
|
|
5346
|
+
function getEnsManagerAddressDetailsUrl(address, namespaceId) {
|
|
5347
|
+
const baseUrl = getEnsManagerUrl(namespaceId);
|
|
5348
|
+
if (!baseUrl) return null;
|
|
5349
|
+
return new URL(address, baseUrl);
|
|
5350
|
+
}
|
|
5351
|
+
|
|
5298
5352
|
// src/components/special-buttons/CopyButton.tsx
|
|
5299
5353
|
var React4 = __toESM(require("react"), 1);
|
|
5300
5354
|
var import_sonner = require("sonner");
|
|
@@ -5398,7 +5452,7 @@ function CopyButton({
|
|
|
5398
5452
|
type: "button",
|
|
5399
5453
|
onClick: copyToClipboard,
|
|
5400
5454
|
disabled: isCopying,
|
|
5401
|
-
className: cn(className),
|
|
5455
|
+
className: cn("nhui:cursor-pointer", className),
|
|
5402
5456
|
...props,
|
|
5403
5457
|
children: [
|
|
5404
5458
|
hasCopied ? successIcon ? successIcon : "Copied" : icon ? icon : "Copy",
|
|
@@ -5408,42 +5462,6 @@ function CopyButton({
|
|
|
5408
5462
|
);
|
|
5409
5463
|
}
|
|
5410
5464
|
|
|
5411
|
-
// src/utils/blockExplorers.ts
|
|
5412
|
-
var getBlockExplorerUrl = (chainId) => {
|
|
5413
|
-
const chain = SUPPORTED_CHAINS.find((chain2) => chain2.id === chainId);
|
|
5414
|
-
if (!chain) return null;
|
|
5415
|
-
if (!chain.blockExplorers) return null;
|
|
5416
|
-
return new URL(chain.blockExplorers.default.url);
|
|
5417
|
-
};
|
|
5418
|
-
var getBlockExplorerAddressDetailsUrl = (chainId, address) => {
|
|
5419
|
-
const chainBlockExplorer = getBlockExplorerUrl(chainId);
|
|
5420
|
-
if (!chainBlockExplorer) return null;
|
|
5421
|
-
return new URL(`address/${address}`, chainBlockExplorer.toString());
|
|
5422
|
-
};
|
|
5423
|
-
var getBlockExplorerTransactionDetailsUrl = (chainId, transactionHash) => {
|
|
5424
|
-
const chainBlockExplorer = getBlockExplorerUrl(chainId);
|
|
5425
|
-
if (!chainBlockExplorer) return null;
|
|
5426
|
-
return new URL(`tx/${transactionHash}`, chainBlockExplorer.toString());
|
|
5427
|
-
};
|
|
5428
|
-
|
|
5429
|
-
// src/utils/ensManager.ts
|
|
5430
|
-
var import_ensnode_sdk2 = require("@ensnode/ensnode-sdk");
|
|
5431
|
-
function getEnsManagerUrl(namespaceId) {
|
|
5432
|
-
switch (namespaceId) {
|
|
5433
|
-
case import_ensnode_sdk2.ENSNamespaceIds.Mainnet:
|
|
5434
|
-
return new URL(`https://app.ens.domains/`);
|
|
5435
|
-
case import_ensnode_sdk2.ENSNamespaceIds.Sepolia:
|
|
5436
|
-
return new URL(`https://sepolia.app.ens.domains/`);
|
|
5437
|
-
case import_ensnode_sdk2.ENSNamespaceIds.EnsTestEnv:
|
|
5438
|
-
return null;
|
|
5439
|
-
}
|
|
5440
|
-
}
|
|
5441
|
-
function getEnsManagerAddressDetailsUrl(address, namespaceId) {
|
|
5442
|
-
const baseUrl = getEnsManagerUrl(namespaceId);
|
|
5443
|
-
if (!baseUrl) return null;
|
|
5444
|
-
return new URL(address, baseUrl);
|
|
5445
|
-
}
|
|
5446
|
-
|
|
5447
5465
|
// src/components/identity/Identity.tsx
|
|
5448
5466
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5449
5467
|
function IdentityLink({
|
|
@@ -5451,6 +5469,9 @@ function IdentityLink({
|
|
|
5451
5469
|
className,
|
|
5452
5470
|
children
|
|
5453
5471
|
}) {
|
|
5472
|
+
if (linkDetails.link === null) {
|
|
5473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
|
|
5474
|
+
}
|
|
5454
5475
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5455
5476
|
"a",
|
|
5456
5477
|
{
|
|
@@ -5495,7 +5516,7 @@ var IdentityTooltip = ({
|
|
|
5495
5516
|
TooltipContent,
|
|
5496
5517
|
{
|
|
5497
5518
|
side: "top",
|
|
5498
|
-
className: "nhui:bg-gray-50 nhui:text-sm nhui:text-black nhui:text-left nhui:shadow-md nhui:outline-hidden nhui:w-fit",
|
|
5519
|
+
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",
|
|
5499
5520
|
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "nhui:flex nhui:gap-4", children: [
|
|
5500
5521
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "nhui:flex nhui:items-center", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5501
5522
|
ChainIcon,
|
|
@@ -5515,7 +5536,10 @@ var IdentityTooltip = ({
|
|
|
5515
5536
|
CopyButton,
|
|
5516
5537
|
{
|
|
5517
5538
|
value: identity.address,
|
|
5518
|
-
className: "nhui:text-gray-500 nhui:hover:text-gray-700 nhui:transition-colors"
|
|
5539
|
+
className: "nhui:text-gray-500 nhui:hover:text-gray-700 nhui:transition-colors",
|
|
5540
|
+
successIcon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react.CheckIcon, { className: "nhui:h-4 nhui:w-4" }),
|
|
5541
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react.CopyIcon, { className: "nhui:h-4 nhui:w-4" }),
|
|
5542
|
+
showToast: true
|
|
5519
5543
|
}
|
|
5520
5544
|
),
|
|
5521
5545
|
chainExplorerUrl && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("a", { target: "_blank", href: chainExplorerUrl.toString(), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
@@ -5553,19 +5577,6 @@ function NameDisplay({ name, className = "nhui:font-medium" }) {
|
|
|
5553
5577
|
var import_ensnode_react = require("@ensnode/ensnode-react");
|
|
5554
5578
|
var import_ensnode_sdk5 = require("@ensnode/ensnode-sdk");
|
|
5555
5579
|
|
|
5556
|
-
// src/components/ui/skeleton.tsx
|
|
5557
|
-
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
5558
|
-
function Skeleton({ className, ...props }) {
|
|
5559
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5560
|
-
"div",
|
|
5561
|
-
{
|
|
5562
|
-
"data-slot": "skeleton",
|
|
5563
|
-
className: cn("nhui:bg-accent nhui:animate-pulse nhui:rounded-md", className),
|
|
5564
|
-
...props
|
|
5565
|
-
}
|
|
5566
|
-
);
|
|
5567
|
-
}
|
|
5568
|
-
|
|
5569
5580
|
// src/hooks/useIsMobile.tsx
|
|
5570
5581
|
var React5 = __toESM(require("react"), 1);
|
|
5571
5582
|
var MOBILE_BREAKPOINT = 640;
|
|
@@ -5583,6 +5594,19 @@ function useIsMobile() {
|
|
|
5583
5594
|
return !!isMobile;
|
|
5584
5595
|
}
|
|
5585
5596
|
|
|
5597
|
+
// src/components/ui/skeleton.tsx
|
|
5598
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
5599
|
+
function Skeleton({ className, ...props }) {
|
|
5600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
5601
|
+
"div",
|
|
5602
|
+
{
|
|
5603
|
+
"data-slot": "skeleton",
|
|
5604
|
+
className: cn("nhui:bg-accent nhui:animate-pulse nhui:rounded-md", className),
|
|
5605
|
+
...props
|
|
5606
|
+
}
|
|
5607
|
+
);
|
|
5608
|
+
}
|
|
5609
|
+
|
|
5586
5610
|
// src/components/identity/ResolveAndDisplayIdentity.tsx
|
|
5587
5611
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
5588
5612
|
function ResolveAndDisplayIdentity({
|
|
@@ -5718,7 +5742,7 @@ function DisplayIdentity({
|
|
|
5718
5742
|
}
|
|
5719
5743
|
|
|
5720
5744
|
// src/components/registrar-actions/RegistrarActionCard.tsx
|
|
5721
|
-
var
|
|
5745
|
+
var import_lucide_react2 = require("lucide-react");
|
|
5722
5746
|
var import_react4 = require("react");
|
|
5723
5747
|
var import_ensnode_sdk6 = require("@ensnode/ensnode-sdk");
|
|
5724
5748
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
@@ -5743,7 +5767,6 @@ function ResolveAndDisplayReferrerIdentity({
|
|
|
5743
5767
|
referral,
|
|
5744
5768
|
accelerate = true,
|
|
5745
5769
|
withLink = true,
|
|
5746
|
-
identityLinkDetails,
|
|
5747
5770
|
withTooltip = true,
|
|
5748
5771
|
withAvatar = false,
|
|
5749
5772
|
withIdentifier = true,
|
|
@@ -5761,14 +5784,14 @@ function ResolveAndDisplayReferrerIdentity({
|
|
|
5761
5784
|
className2,
|
|
5762
5785
|
!withAvatar && "nhui:hidden"
|
|
5763
5786
|
),
|
|
5764
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5787
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react2.CircleQuestionMark, { size: iconSize, className: "nhui:text-gray-400" })
|
|
5765
5788
|
}
|
|
5766
5789
|
);
|
|
5767
5790
|
return withAvatar && !withIdentifier ? unknownAvatarPlaceholder("nhui:w-10 nhui:h-10", 24) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "nhui:h-[21px] nhui:inline-flex nhui:items-center nhui:gap-2 nhui:font-medium", children: [
|
|
5768
5791
|
unknownAvatarPlaceholder("nhui:w-5 nhui:h-5", 16),
|
|
5769
5792
|
"Unknown",
|
|
5770
5793
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { delayDuration: 250, children: [
|
|
5771
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5794
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react2.Info, { size: 16, className: "nhui:shrink-0 nhui:fill-neutral-300 nhui:text-white" }) }),
|
|
5772
5795
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
5773
5796
|
TooltipContent,
|
|
5774
5797
|
{
|
|
@@ -5796,12 +5819,16 @@ function ResolveAndDisplayReferrerIdentity({
|
|
|
5796
5819
|
withIdentifier,
|
|
5797
5820
|
className,
|
|
5798
5821
|
withLink,
|
|
5799
|
-
identityLinkDetails
|
|
5822
|
+
identityLinkDetails: {
|
|
5823
|
+
isExternal: true,
|
|
5824
|
+
link: getEnsManagerAddressDetailsUrl(referrerIdentity.address, namespaceId)
|
|
5825
|
+
}
|
|
5800
5826
|
}
|
|
5801
5827
|
);
|
|
5802
5828
|
}
|
|
5803
5829
|
function RegistrarActionCardLoading({
|
|
5804
|
-
showReferrer = true
|
|
5830
|
+
showReferrer = true,
|
|
5831
|
+
showReferralProgramField = true
|
|
5805
5832
|
}) {
|
|
5806
5833
|
const isMobile = useIsMobile();
|
|
5807
5834
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
@@ -5826,7 +5853,7 @@ function RegistrarActionCardLoading({
|
|
|
5826
5853
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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" })
|
|
5827
5854
|
] }) })
|
|
5828
5855
|
] }),
|
|
5829
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(LabeledField, { fieldLabel: "Incentive program", className: "nhui:w-[15%] nhui:min-w-[162px]", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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" }) })
|
|
5856
|
+
showReferralProgramField && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(LabeledField, { fieldLabel: "Incentive program", className: "nhui:w-[15%] nhui:min-w-[162px]", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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" }) })
|
|
5830
5857
|
]
|
|
5831
5858
|
}
|
|
5832
5859
|
);
|
|
@@ -5861,15 +5888,15 @@ function RegistrarActionCard({
|
|
|
5861
5888
|
{
|
|
5862
5889
|
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",
|
|
5863
5890
|
children: [
|
|
5864
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(LabeledField, { fieldLabel: "Name", className: "nhui:w-[15%] nhui:min-w-[162px]", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5891
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(LabeledField, { fieldLabel: "Name", className: "nhui:w-[15%] nhui:min-w-[162px]", children: links.name.link !== null ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5865
5892
|
"a",
|
|
5866
5893
|
{
|
|
5867
|
-
target: "_blank",
|
|
5894
|
+
target: links.name.isExternal ? "_blank" : "_self",
|
|
5868
5895
|
href: links.name.link.href,
|
|
5869
5896
|
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",
|
|
5870
5897
|
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(NameDisplay, { name: namedRegistrarAction.name, className: "nhui:h-[21px]" })
|
|
5871
5898
|
}
|
|
5872
|
-
) }),
|
|
5899
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("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__ */ (0, import_jsx_runtime41.jsx)(NameDisplay, { name: namedRegistrarAction.name, className: "nhui:h-[21px]" }) }) }),
|
|
5873
5900
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5874
5901
|
LabeledField,
|
|
5875
5902
|
{
|
|
@@ -5921,8 +5948,7 @@ function RegistrarActionCard({
|
|
|
5921
5948
|
referral,
|
|
5922
5949
|
withAvatar: true,
|
|
5923
5950
|
withIdentifier: false,
|
|
5924
|
-
withTooltip: false
|
|
5925
|
-
identityLinkDetails: links.referrer
|
|
5951
|
+
withTooltip: false
|
|
5926
5952
|
}
|
|
5927
5953
|
),
|
|
5928
5954
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(LabeledField, { fieldLabel: "Referrer", className: "nhui:w-[15%] nhui:min-w-[110px]", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
@@ -5933,8 +5959,7 @@ function RegistrarActionCard({
|
|
|
5933
5959
|
referral,
|
|
5934
5960
|
withAvatar: isMobile,
|
|
5935
5961
|
withIdentifier: true,
|
|
5936
|
-
withTooltip: false
|
|
5937
|
-
identityLinkDetails: links.referrer
|
|
5962
|
+
withTooltip: false
|
|
5938
5963
|
}
|
|
5939
5964
|
) })
|
|
5940
5965
|
] }),
|
|
@@ -5944,6 +5969,118 @@ function RegistrarActionCard({
|
|
|
5944
5969
|
);
|
|
5945
5970
|
}
|
|
5946
5971
|
var RegistrarActionCardMemo = (0, import_react4.memo)(RegistrarActionCard);
|
|
5972
|
+
|
|
5973
|
+
// src/hooks/useNow.ts
|
|
5974
|
+
var import_react6 = require("react");
|
|
5975
|
+
|
|
5976
|
+
// src/hooks/useSystemClock.ts
|
|
5977
|
+
var import_date_fns4 = require("date-fns");
|
|
5978
|
+
var import_react5 = require("react");
|
|
5979
|
+
|
|
5980
|
+
// src/utils/syncedClock.ts
|
|
5981
|
+
var DEFAULT_TICK_RATE = 16;
|
|
5982
|
+
var HighResolutionSyncedClock = class {
|
|
5983
|
+
#listeners = /* @__PURE__ */ new Set();
|
|
5984
|
+
#currentTime = Date.now();
|
|
5985
|
+
#timerId = null;
|
|
5986
|
+
/**
|
|
5987
|
+
* Tick rate frequency in milliseconds.
|
|
5988
|
+
*/
|
|
5989
|
+
#tickRate;
|
|
5990
|
+
/**
|
|
5991
|
+
* Clock's tick handler.
|
|
5992
|
+
*
|
|
5993
|
+
* Runs at `tickRate` frequency, and notifies all listeners about
|
|
5994
|
+
* the current time updates.
|
|
5995
|
+
*/
|
|
5996
|
+
#tick = () => {
|
|
5997
|
+
this.#currentTime = Date.now();
|
|
5998
|
+
this.#listeners.forEach((listener) => listener());
|
|
5999
|
+
this.#timerId = setTimeout(this.#tick, this.#tickRate);
|
|
6000
|
+
};
|
|
6001
|
+
/**
|
|
6002
|
+
* Starts the clock.
|
|
6003
|
+
*/
|
|
6004
|
+
start = () => {
|
|
6005
|
+
if (this.#timerId === null) {
|
|
6006
|
+
this.#currentTime = Date.now();
|
|
6007
|
+
this.#timerId = setTimeout(this.#tick, this.#tickRate);
|
|
6008
|
+
}
|
|
6009
|
+
};
|
|
6010
|
+
/**
|
|
6011
|
+
* Stops the clock.
|
|
6012
|
+
*/
|
|
6013
|
+
stop = () => {
|
|
6014
|
+
if (this.#timerId !== null) {
|
|
6015
|
+
clearTimeout(this.#timerId);
|
|
6016
|
+
this.#timerId = null;
|
|
6017
|
+
}
|
|
6018
|
+
};
|
|
6019
|
+
constructor(tickRate = DEFAULT_TICK_RATE) {
|
|
6020
|
+
this.#tickRate = tickRate;
|
|
6021
|
+
}
|
|
6022
|
+
/**
|
|
6023
|
+
* Adds a new listener to all listeners tracking the synced clock.
|
|
6024
|
+
*
|
|
6025
|
+
* Starts the clock (or restarts it, which is a noop) if there's at
|
|
6026
|
+
* least one listener.
|
|
6027
|
+
*
|
|
6028
|
+
* @param callback to notify the listener about clock updates.
|
|
6029
|
+
*/
|
|
6030
|
+
addListener(callback) {
|
|
6031
|
+
this.#listeners.add(callback);
|
|
6032
|
+
if (this.#listeners.size > 0) {
|
|
6033
|
+
this.start();
|
|
6034
|
+
}
|
|
6035
|
+
}
|
|
6036
|
+
/**
|
|
6037
|
+
* Removes a listener from all listeners tracking the synced clock.
|
|
6038
|
+
*
|
|
6039
|
+
* Stops the clock if there's no listener.
|
|
6040
|
+
*
|
|
6041
|
+
* @param callback to notify the listener about clock updates.
|
|
6042
|
+
*/
|
|
6043
|
+
removeListener(callback) {
|
|
6044
|
+
this.#listeners.delete(callback);
|
|
6045
|
+
if (this.#listeners.size === 0) {
|
|
6046
|
+
this.stop();
|
|
6047
|
+
}
|
|
6048
|
+
}
|
|
6049
|
+
get currentTime() {
|
|
6050
|
+
return this.#currentTime;
|
|
6051
|
+
}
|
|
6052
|
+
};
|
|
6053
|
+
|
|
6054
|
+
// src/utils/systemClock.ts
|
|
6055
|
+
var systemClock = new HighResolutionSyncedClock();
|
|
6056
|
+
|
|
6057
|
+
// src/hooks/useSystemClock.ts
|
|
6058
|
+
function useSystemClock() {
|
|
6059
|
+
const subscribe = (callback) => {
|
|
6060
|
+
systemClock.addListener(callback);
|
|
6061
|
+
return () => {
|
|
6062
|
+
systemClock.removeListener(callback);
|
|
6063
|
+
};
|
|
6064
|
+
};
|
|
6065
|
+
const getSnapshot = () => (0, import_date_fns4.getUnixTime)(new Date(systemClock.currentTime));
|
|
6066
|
+
const getServerSnapshot = () => (0, import_date_fns4.getUnixTime)(/* @__PURE__ */ new Date());
|
|
6067
|
+
const syncedSystemClock = (0, import_react5.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
6068
|
+
return syncedSystemClock ?? getSnapshot();
|
|
6069
|
+
}
|
|
6070
|
+
|
|
6071
|
+
// src/hooks/useNow.ts
|
|
6072
|
+
var DEFAULT_TIME_TO_REFRESH = 1;
|
|
6073
|
+
function useNow(props) {
|
|
6074
|
+
const clock = useSystemClock();
|
|
6075
|
+
const [throttledClock, setThrottledClock] = (0, import_react6.useState)(clock);
|
|
6076
|
+
const { timeToRefresh = DEFAULT_TIME_TO_REFRESH } = props || {};
|
|
6077
|
+
(0, import_react6.useEffect)(() => {
|
|
6078
|
+
if (clock - throttledClock >= timeToRefresh) {
|
|
6079
|
+
setThrottledClock(clock);
|
|
6080
|
+
}
|
|
6081
|
+
}, [timeToRefresh, clock, throttledClock]);
|
|
6082
|
+
return throttledClock;
|
|
6083
|
+
}
|
|
5947
6084
|
/*! Bundled license information:
|
|
5948
6085
|
|
|
5949
6086
|
@noble/hashes/esm/utils.js:
|