-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Channels modal #97
Channels modal #97
Conversation
Warning Review FailedThe pull request is closed. WalkthroughThe recent update introduces several new features and enhancements across multiple components. Key changes include adding search functionality for channels, improving error handling, and renaming variables for clarity. The Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Outside diff range and nitpick comments (10)
app/(routes)/packets/packet-details.tsx (5)
Line range hint
169-169
: Use strict equality checks.- if (hex[0] != '0' || hex[1] != 'x') { + if (hex[0] !== '0' || hex[1] !== 'x') {
Line range hint
174-174
: Prefer template literals for string concatenation.- hex = '0x' + hex; + hex = `0x${hex}`;Also applies to: 179-179
Line range hint
168-168
: Avoid reassigning function parameters.Consider using a new variable instead of modifying the function parameter
hex
.Also applies to: 172-172, 174-174
Line range hint
170-170
: Avoid declaring variables that are only assigned once.- let split = hex.split('.'); + const split = hex.split('.');
Line range hint
69-69
: Ensure JSX elements without children are self-closing.- <div> + <div />Apply this change to all applicable elements.
Also applies to: 71-71, 72-72, 73-73, 88-88, 90-90, 91-91, 92-92, 158-158
app/components/ibc-table.tsx (5)
Line range hint
115-115
: Ensure JSX elements without children are self-closing.- <div> + <div />Apply this change to all applicable elements.
Also applies to: 155-155
Line range hint
159-170
: Ensure accessibility by pairing mouse events with keyboard events.Consider adding
onKeyUp
,onKeyDown
, oronKeyPress
events to complement theonClick
events for accessibility.
Line range hint
234-234
: Specify explicit types instead of usingany
.Consider defining a more specific type for the
column
andtable
parameters in theColumnFilter
function.
Line range hint
202-205
: Provide an explicit type prop for button elements.- <button + <button type="button"Apply this change to all applicable button elements.
Also applies to: 208-211, 217-220, 223-226
Line range hint
286-286
: Prefer template literals for string concatenation.- classes += ' max-w-32'; + classes += ` max-w-32`;Apply this change to all applicable string concatenations.
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- app/(routes)/channels/channel-details.tsx (1 hunks)
- app/(routes)/channels/page.tsx (3 hunks)
- app/(routes)/packets/packet-details.tsx (1 hunks)
- app/(routes)/packets/page.tsx (5 hunks)
- app/api/channels/helpers.ts (4 hunks)
- app/components/format-strings.tsx (2 hunks)
- app/components/ibc-table.tsx (4 hunks)
- app/components/state-cell.tsx (1 hunks)
Files not reviewed due to errors (3)
- app/api/channels/helpers.ts (no review received)
- app/(routes)/channels/page.tsx (no review received)
- app/(routes)/packets/page.tsx (no review received)
Additional Context Used
Biome (69)
app/(routes)/channels/channel-details.tsx (2)
58-58: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
1-2: Some named imports are only used as types.
app/(routes)/channels/page.tsx (6)
90-90: The computed expression can be simplified without the use of a string literal.
91-91: The computed expression can be simplified without the use of a string literal.
3-13: Some named imports are only used as types.
14-15: Some named imports are only used as types.
217-220: Provide an explicit type prop for the button element.
224-224: Provide an explicit type prop for the button element.
app/(routes)/packets/packet-details.tsx (19)
69-69: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
71-71: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
72-72: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
73-73: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
88-88: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
90-90: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
91-91: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
92-92: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
158-158: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
169-169: Use !== instead of !=.
!= is only allowed when comparing againstnull
169-169: Use !== instead of !=.
!= is only allowed when comparing againstnull
174-174: Template literals are preferred over string concatenation.
179-179: Template literals are preferred over string concatenation.
1-2: Some named imports are only used as types.
2-3: Some named imports are only used as types.
168-168: Reassigning a function parameter is confusing.
172-172: Reassigning a function parameter is confusing.
174-174: Reassigning a function parameter is confusing.
170-170: This let declares a variable that is only assigned once.
app/(routes)/packets/page.tsx (14)
82-86: This else clause can be omitted because previous branches break early.
84-86: This else clause can be omitted because previous branches break early.
131-131: The computed expression can be simplified without the use of a string literal.
132-132: The computed expression can be simplified without the use of a string literal.
133-133: The computed expression can be simplified without the use of a string literal.
135-135: The computed expression can be simplified without the use of a string literal.
136-136: The computed expression can be simplified without the use of a string literal.
137-137: The computed expression can be simplified without the use of a string literal.
138-138: The computed expression can be simplified without the use of a string literal.
139-139: The computed expression can be simplified without the use of a string literal.
3-13: Some named imports are only used as types.
15-16: All these imports are only used as types.
261-264: Provide an explicit type prop for the button element.
268-268: Provide an explicit type prop for the button element.
app/api/channels/helpers.ts (7)
37-37: Template literals are preferred over string concatenation.
55-55: Forbidden non-null assertion.
76-76: This type annotation is trivially inferred from its initialization.
122-122: Forbidden non-null assertion.
124-124: Template literals are preferred over string concatenation.
130-130: Template literals are preferred over string concatenation.
1-1: Some named imports are only used as types.
app/components/format-strings.tsx (3)
1-1: A Node.js builtin module should be imported with the node: protocol.
6-6: Template literals are preferred over string concatenation.
18-18: Template literals are preferred over string concatenation.
app/components/ibc-table.tsx (18)
115-115: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
155-155: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.
159-170: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.
234-234: Unexpected any. Specify a different type.
234-234: Unexpected any. Specify a different type.
234-234: Unexpected any. Specify a different type.
254-291: This else clause can be omitted because previous branches break early.
286-286: Template literals are preferred over string concatenation.
289-291: This else clause can be omitted because previous branches break early.
1-5: Some named imports are only used as types.
9-10: All these imports are only used as types.
10-11: All these imports are only used as types.
11-12: All these imports are only used as types.
12-13: All these imports are only used as types.
202-205: Provide an explicit type prop for the button element.
208-211: Provide an explicit type prop for the button element.
217-220: Provide an explicit type prop for the button element.
223-226: Provide an explicit type prop for the button element.
Additional comments not posted (4)
app/components/state-cell.tsx (1)
6-6
: LGTM! The conditional rendering of the background color based on the state is implemented correctly.app/components/format-strings.tsx (2)
16-25
: LGTM! The function correctly formats the port ID by shortening it.
27-38
: LGTM! The function correctly formats connection hops into a comma-separated string.app/(routes)/channels/channel-details.tsx (1)
4-53
: LGTM! TheChannelDetails
component correctly handles URL updates and conditional rendering based on the provided channel.
@@ -1,3 +1,4 @@ | |||
import { connect } from 'http2'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using the node:
protocol when importing Node.js built-in modules for clarity and to avoid potential issues with package resolution.
- import { connect } from 'http2';
+ import { connect } from 'node:http2';
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
import { connect } from 'http2'; | |
import { connect } from 'node:http2'; |
|
||
export function formatPortId(portId: string) { | ||
if (!portId) return null; | ||
const shortened = portId.slice(0, 18) + '...' + portId.slice(-5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use template literals for better readability and performance in string operations.
- const shortened = portId.slice(0, 18) + '...' + portId.slice(-5);
+ const shortened = `${portId.slice(0, 18)}...${portId.slice(-5)}`;
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
const shortened = portId.slice(0, 18) + '...' + portId.slice(-5); | |
const shortened = `${portId.slice(0, 18)}...${portId.slice(-5)}`; |
function Divider () { | ||
return ( | ||
<div className="flex flex-row justify-center my-0.5"> | ||
<div className="h-0 mb-[0.5px] mt-[1.5px] w-[calc(100%-0.5rem)] border-b border-fg-dark/30"></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using self-closing tags for JSX elements without children for cleaner code.
- <div className="h-0 mb-[0.5px] mt-[1.5px] w-[calc(100%-0.5rem)] border-b border-fg-dark/30"></div>
+ <div className="h-0 mb-[0.5px] mt-[1.5px] w-[calc(100%-0.5rem)] border-b border-fg-dark/30" />
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
<div className="h-0 mb-[0.5px] mt-[1.5px] w-[calc(100%-0.5rem)] border-b border-fg-dark/30"></div> | |
<div className="h-0 mb-[0.5px] mt-[1.5px] w-[calc(100%-0.5rem)] border-b border-fg-dark/30" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets get it tested in staging
This is basic functionality to show only UCs by default on the Channels page, make other channels searchable by ID and make it possible to navigate to a specific channel by including it as a url param.
Still needs more functionality in the new modal and styling work, as well as coordination with product to figure out how to show DApp specific data. Merging incrementally so PRs don't get too big.
This will also require new ENV variable:
REGISTRY_URL='https://raw.githubusercontent.com/polymerdao/polymer-registry/staging/dist/output.json'
Summary by CodeRabbit
New Features
Improvements
stateToString
function.ChannelDetails
component.Bug Fixes
Style
Refactor
Chores