Skip to content

Conversation

@Y3drk
Copy link
Contributor

@Y3drk Y3drk commented Jan 19, 2026

Lite PR → refine namehash-ui package after applying it in ENSAwards

Summary

  • Refined some components of the package based on the needs that surfaced when applying them in ENSAwards
  • Made two patch changes in ENSAdmin, because of these refinements → apps/ensadmin/src/components/registrar-actions/display-registrar-actions-panel.tsx:68 & apps/ensadmin/src/components/ui/sidebar.tsx:3,29,72

Why


Testing

  • Tested the changed components of ENSAdmin's UI (registrar-actions' card and the sidebar) locally & in Vercel preview
  • Ran the usual CI tests
  • (Self-review process): Reviewed all LLM reviewers' comments & self-reviewed the code changes

Notes for Reviewer (Optional)

  • I realized that in the packages/namehash-ui/src/components/registrar-actions/RegistrarActionCard.tsx tooltip behavior also isn't app agnostic (we show tooltips in ENSAdmin and we don't in ENSAwards), therefore I had to introduce a dedicated prop to control this behavior (lines 257-260 in the mentioned file)

Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
  • Relevant changesets are included (or are not required)

Summary by CodeRabbit

  • New Features

    • Added configurable mobile detection hook with customizable breakpoints for better responsive behavior.
    • Introduced customizable referrer link resolution for registrar actions.
  • Refactor

    • Consolidated mobile detection logic into a shared library hook for consistency across applications.
    • Improved referrer URL handling with a pluggable function approach.
  • API Improvements

    • Exported LabeledField component for public use.
    • Made useIsMobile hook publicly available in the UI library.

✏️ Tip: You can customize this high-level summary in your review settings.

@Y3drk Y3drk self-assigned this Jan 19, 2026
@Y3drk Y3drk added the ensnode-internal ensnode-internal related label Jan 19, 2026
Copilot AI review requested due to automatic review settings January 19, 2026 18:00
@changeset-bot
Copy link

changeset-bot bot commented Jan 19, 2026

🦋 Changeset detected

Latest commit: d148d5a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
@namehash/namehash-ui Patch
ensadmin Patch
ensindexer Patch
ensrainbow Patch
ensapi Patch
fallback-ensapi Patch
@ensnode/datasources Patch
@ensnode/ensrainbow-sdk Patch
@ensnode/ponder-metadata Patch
@ensnode/ensnode-schema Patch
@ensnode/ensnode-react Patch
@ensnode/ponder-subgraph Patch
@ensnode/ensnode-sdk Patch
@ensnode/shared-configs Patch
@docs/ensnode Patch
@docs/ensrainbow Patch
@docs/mintlify Patch
@namehash/ens-referrals Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jan 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment Jan 19, 2026 6:00pm
ensnode.io Ready Ready Preview, Comment Jan 19, 2026 6:00pm
ensrainbow.io Ready Ready Preview, Comment Jan 19, 2026 6:00pm

@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

📝 Walkthrough

Walkthrough

The pull request consolidates mobile detection by migrating a local useIsMobile hook to the shared namehash-ui package with parameterizable breakpoint support. In parallel, registrar action components are refactored to accept customizable referrer link resolution callbacks instead of hardcoded URL construction, enabling flexible link generation across different contexts.

Changes

Cohort / File(s) Summary
Mobile detection consolidation
apps/ensadmin/src/components/ui/sidebar.tsx, apps/ensadmin/src/hooks/use-mobile.tsx, packages/namehash-ui/src/hooks/useIsMobile.tsx, packages/namehash-ui/src/index.ts
Removes local useIsMobile hook from ensadmin and replaces with parameterized version from shared package; updated hook now accepts optional breakpoint parameter with dependency tracking; exported from namehash-ui index.
Referrer link customization
apps/ensadmin/src/components/registrar-actions/display-registrar-actions-panel.tsx, packages/namehash-ui/src/components/registrar-actions/RegistrarActionCard.tsx
Introduces ReferrerLinkFunction type to customize referrer URL resolution; exports LabeledField component; plumbs getReferrerLink callback through card component to replace hardcoded ENS manager URL references.
Changeset documentation
.changeset/fruity-numbers-fry.md
Adds patch release entry documenting refinements to @namehash/namehash-ui from ENSAwards application use.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A mobile hook hops to shared ground,
While referrer links spin round and round,
No hardcodes left, just callbacks clean—
The finest refactor I've ever seen! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feat(namehash-ui): refine package' is vague and does not clearly summarize the main changes in the changeset, using non-descriptive terms like 'refine'. Replace with a more specific title that describes the actual changes, such as 'feat(namehash-ui): add configurable mobile breakpoint to useIsMobile hook and referrer URL customization'.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The PR description follows the required template structure with all key sections present: Summary, Why, Testing, Notes for Reviewer, and Pre-Review Checklist. Content covers the changes, rationale (Issue #906), testing approach, and important reviewer notes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch y3drk/feat/refine-namehash-ui-package

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines the namehash-ui package by improving reusability and reducing code duplication. The changes consolidate a duplicated mobile detection hook and make the RegistrarActionCard component more flexible by parameterizing the referrer link function.

Changes:

  • Enhanced useIsMobile hook with configurable breakpoint parameter and exported it from the package
  • Refactored RegistrarActionCard to accept referrer link function as a parameter instead of hardcoding it
  • Replaced duplicate useIsMobile implementation in ensadmin app with the shared hook from namehash-ui

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/namehash-ui/src/index.ts Exports useIsMobile hook and all chain utilities (previously only getChainName)
packages/namehash-ui/src/hooks/useIsMobile.tsx Added optional breakpoint parameter with default value for configurability
packages/namehash-ui/src/components/registrar-actions/RegistrarActionCard.tsx Parameterized referrer link function and exported LabeledField component
apps/ensadmin/src/hooks/use-mobile.tsx Removed duplicate implementation in favor of shared hook
apps/ensadmin/src/components/ui/sidebar.tsx Uses shared useIsMobile hook with custom 768px breakpoint
apps/ensadmin/src/components/registrar-actions/display-registrar-actions-panel.tsx Passes getEnsManagerAddressDetailsUrl as referrer link function parameter
.changeset/fruity-numbers-fry.md Added changeset documenting the patch version changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.changeset/fruity-numbers-fry.md:
- Around line 1-5: The MD041 warning is triggered by YAML front matter in
.changeset/fruity-numbers-fry.md; update the repo lint config so markdownlint
allows front matter in changeset files (e.g., add a markdownlint config rule to
exclude .changeset/** or set MD041: false for that glob) or adjust the linter
task to skip the .changeset directory so the YAML front matter is permitted and
the lint job no longer fails.

In
`@packages/namehash-ui/src/components/registrar-actions/RegistrarActionCard.tsx`:
- Around line 60-67: The prop getReferrerLink on
ResolveAndDisplayReferrerIdentityProps was made required and breaks consumers;
make getReferrerLink optional and provide a backward-compatible default by
updating the type ReferrerLinkFunction to be used as getReferrerLink?:
ReferrerLinkFunction and in the RegistrarActionCard (or the component that
consumes ResolveAndDisplayReferrerIdentityProps) default undefined to the
existing helper getEnsManagerAddressDetailsUrl when not supplied; update places
that construct ResolveAndDisplayReferrerIdentityProps to allow omission of
getReferrerLink and ensure the runtime uses getEnsManagerAddressDetailsUrl for
null/undefined values.

Comment on lines +1 to +5
---
"@namehash/namehash-ui": patch
---

Refines several features as a result of the application of the package in ENSAwards.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

markdownlint MD041 warning on front matter.
If markdownlint runs on .changeset/**, configure it to allow YAML front matter or disable MD041 for changesets to avoid lint failures.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

5-5: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

🤖 Prompt for AI Agents
In @.changeset/fruity-numbers-fry.md around lines 1 - 5, The MD041 warning is
triggered by YAML front matter in .changeset/fruity-numbers-fry.md; update the
repo lint config so markdownlint allows front matter in changeset files (e.g.,
add a markdownlint config rule to exclude .changeset/** or set MD041: false for
that glob) or adjust the linter task to skip the .changeset directory so the
YAML front matter is permitted and the lint job no longer fails.

Comment on lines +60 to 67
type ReferrerLinkFunction = (address: Address, namespaceId: ENSNamespaceId) => URL | null;

interface ResolveAndDisplayReferrerIdentityProps
extends Omit<ResolveAndDisplayIdentityProps, "identity" | "identityLinkDetails"> {
chainId: DefaultableChainId;
referral: RegistrarActionReferral;
getReferrerLink: ReferrerLinkFunction;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's find and read the relevant file
find . -type f -name "RegistrarActionCard.tsx" | head -5

Repository: namehash/ensnode

Length of output: 139


🏁 Script executed:

# Read the file to check the current state
cat -n ./packages/namehash-ui/src/components/registrar-actions/RegistrarActionCard.tsx | head -100

Repository: namehash/ensnode

Length of output: 3885


🏁 Script executed:

# Continue reading to see the RegistrarActionCard interface and props
cat -n ./packages/namehash-ui/src/components/registrar-actions/RegistrarActionCard.tsx | sed -n '100,250p'

Repository: namehash/ensnode

Length of output: 7589


🏁 Script executed:

# Continue reading to see how getReferrerLink is used
cat -n ./packages/namehash-ui/src/components/registrar-actions/RegistrarActionCard.tsx | sed -n '250,350p'

Repository: namehash/ensnode

Length of output: 5065


🏁 Script executed:

# Continue reading to see getReferrerLink usage
cat -n ./packages/namehash-ui/src/components/registrar-actions/RegistrarActionCard.tsx | sed -n '350,400p'

Repository: namehash/ensnode

Length of output: 1058


🏁 Script executed:

# Search for all usages of RegistrarActionCard
rg -n "RegistrarActionCard" --type tsx | head -50

Repository: namehash/ensnode

Length of output: 87


🏁 Script executed:

# Search for all usages of RegistrarActionCard with glob pattern
rg -n "RegistrarActionCard" -g '*.tsx' -g '*.ts'

Repository: namehash/ensnode

Length of output: 1565


🏁 Script executed:

# Check the usage in display-registrar-actions-panel.tsx
cat -n ./apps/ensadmin/src/components/registrar-actions/display-registrar-actions-panel.tsx | sed -n '1,100p'

Repository: namehash/ensnode

Length of output: 3784


Breaking API: referrerLinkFunction is now required.
This is a public component prop change and will break existing consumers (especially with a patch changeset). Consider making it optional with a backward-compatible default (e.g., getEnsManagerAddressDetailsUrl), or bump major + document migration.

💡 Suggested compatibility-friendly default
-import { getBlockExplorerTransactionDetailsUrl } from "../../utils/blockExplorers";
+import { getBlockExplorerTransactionDetailsUrl } from "../../utils/blockExplorers";
+import { getEnsManagerAddressDetailsUrl } from "../../utils/ensManager";
@@
 export interface RegistrarActionCardProps {
@@
   links: {
     name: IdentityLinkDetails;
     registrant: IdentityLinkDetails;
-    referrerLinkFunction: ReferrerLinkFunction;
+    referrerLinkFunction?: ReferrerLinkFunction;
   };
@@
 export function RegistrarActionCard({
@@
 }: RegistrarActionCardProps) {
   const isMobile = useIsMobile();
+  const referrerLinkFunction =
+    links.referrerLinkFunction ?? getEnsManagerAddressDetailsUrl;
@@
-              getReferrerLink={links.referrerLinkFunction}
+              getReferrerLink={referrerLinkFunction}
@@
-              getReferrerLink={links.referrerLinkFunction}
+              getReferrerLink={referrerLinkFunction}
🤖 Prompt for AI Agents
In
`@packages/namehash-ui/src/components/registrar-actions/RegistrarActionCard.tsx`
around lines 60 - 67, The prop getReferrerLink on
ResolveAndDisplayReferrerIdentityProps was made required and breaks consumers;
make getReferrerLink optional and provide a backward-compatible default by
updating the type ReferrerLinkFunction to be used as getReferrerLink?:
ReferrerLinkFunction and in the RegistrarActionCard (or the component that
consumes ResolveAndDisplayReferrerIdentityProps) default undefined to the
existing helper getEnsManagerAddressDetailsUrl when not supplied; update places
that construct ResolveAndDisplayReferrerIdentityProps to allow omission of
getReferrerLink and ensure the runtime uses getEnsManagerAddressDetailsUrl for
null/undefined values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ensnode-internal ensnode-internal related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants