Skip to content

Conversation

naps62
Copy link
Member

@naps62 naps62 commented Jul 28, 2025

No description provided.

@Copilot Copilot AI review requested due to automatic review settings July 28, 2025 16:04
@naps62 naps62 added the A-enhancement work towards a new feature label Jul 28, 2025
Copy link
Contributor

@Copilot 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 enhances the breadcrumb system to support rendering AddressView components for address-type breadcrumbs instead of plain text. The change enables better address display with features like alias support and click-to-copy functionality within breadcrumbs.

  • Updates breadcrumb data structure to support typed breadcrumb objects with address rendering
  • Modifies the contract route to pass address breadcrumbs as typed objects
  • Conditionally renders the "Clear alias" menu item only when an alias exists

Reviewed Changes

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

File Description
gui/src/routes/home/_l/contracts/_l/$chainId.$address.tsx Changes breadcrumb from string to typed object for address rendering
gui/src/components/Breadcrumbs.tsx Adds support for address-type breadcrumbs with AddressView rendering
gui/src/components/AddressView.tsx Conditionally shows "Clear alias" menu item only when alias exists

@@ -19,13 +20,24 @@ export function Breadcrumbs() {
if (typeof context.breadcrumb === "string") {
if (context.breadcrumb === acc[acc.length - 1]?.label) return acc;
acc.push({ label: context.breadcrumb, path: pathname });
} else if (context.breadcrumb.type === "address") {
if (context.breadcrumb.value === acc[acc.length - 1]?.label) return acc;
Copy link
Preview

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

This comparison will always fail because context.breadcrumb.value is a string but acc[acc.length - 1]?.label is now a React.ReactNode (AddressView component). The duplicate check for address breadcrumbs won't work correctly.

Suggested change
if (context.breadcrumb.value === acc[acc.length - 1]?.label) return acc;
if (context.breadcrumb.value === acc[acc.length - 1]?.rawLabel) return acc;

Copilot uses AI. Check for mistakes.

} else {
if (context.breadcrumb.label === acc[acc.length - 1]?.label) return acc;
acc.push(context.breadcrumb);
}
return acc;
},
[] as { label: string; path: string }[],
[] as { label: React.ReactNode; path: string; type?: string }[],
Copy link
Preview

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

[nitpick] The breadcrumb array type should be properly defined with a type interface rather than inline typing. Consider creating a BreadcrumbItem interface to improve type safety and maintainability.

Suggested change
[] as { label: React.ReactNode; path: string; type?: string }[],
[] as BreadcrumbItem[],

Copilot uses AI. Check for mistakes.

@@ -19,13 +20,24 @@ export function Breadcrumbs() {
if (typeof context.breadcrumb === "string") {
if (context.breadcrumb === acc[acc.length - 1]?.label) return acc;
acc.push({ label: context.breadcrumb, path: pathname });
} else if (context.breadcrumb.type === "address") {
Copy link
Preview

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

The code assumes context.breadcrumb has a type property when it's not a string, but there's no type safety ensuring this. Consider adding proper TypeScript interfaces for different breadcrumb types.

Suggested change
} else if (context.breadcrumb.type === "address") {
} else if (isAddressBreadcrumb(context.breadcrumb)) {

Copilot uses AI. Check for mistakes.

@naps62 naps62 merged commit d9a9724 into main Jul 28, 2025
7 checks passed
@naps62 naps62 deleted the breadcrumb-address branch July 28, 2025 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-enhancement work towards a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant