-
Notifications
You must be signed in to change notification settings - Fork 7
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
2.1.13 #651
base: main
Are you sure you want to change the base?
2.1.13 #651
Conversation
📝 WalkthroughWalkthroughThe pull request introduces several modifications across multiple components, primarily focusing on UI adjustments and state management enhancements. Key changes include reduced heights in various styled components, the addition of menu handling functions in the Changes
Possibly related PRs
Suggested reviewers
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration 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: 2
🧹 Outside diff range and nitpick comments (4)
src/future-hopr-lib-components/Layout/index.tsx (1)
20-21
: LGTM: Improved maintainability with constantsGood improvements:
- Using imported constants for drawer dimensions improves maintainability
- Margin adjustments are consistent with navbar height changes
Consider adding a comment explaining the relationship between these layout dimensions and their impact on the overall UI structure. This would help future maintainers understand the interdependencies.
Also applies to: 37-37, 42-42
src/components/Modal/node/PingModal.tsx (1)
127-128
: Simplify the disabled and pending prop logicThe disabled and pending props have duplicate conditions. Consider extracting the common condition to improve maintainability.
- disabled={props.disabled || pinging[peerId]} - pending={disableButton || pinging[peerId]} + const isPinging = pinging[peerId]; + disabled={props.disabled || isPinging} + pending={disableButton || isPinging}src/store/slices/node/initialState.ts (1)
182-184
: Consider using boolean type instead of literal trueThe type definition could be more flexible by using boolean instead of the literal true type.
pinging: { - [peerId: string]: true + [peerId: string]: boolean };src/store/slices/node/actionsAsync.ts (1)
1447-1453
: Add missing semicolonThere's a missing semicolon after the peerId declaration.
- const peerId = action.meta.arg.peerId + const peerId = action.meta.arg.peerId;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (12)
src/components/ConnectNode/index.tsx
(1 hunks)src/components/Modal/node/PingModal.tsx
(2 hunks)src/components/NotificationBar/index.tsx
(1 hunks)src/components/Overlays/LoadingOverlay.tsx
(1 hunks)src/future-hopr-lib-components/Layout/drawer.tsx
(4 hunks)src/future-hopr-lib-components/Layout/index.tsx
(2 hunks)src/future-hopr-lib-components/Navbar/navBar.tsx
(1 hunks)src/future-hopr-lib-components/Section/index.tsx
(0 hunks)src/pages/node/info/index.tsx
(1 hunks)src/pages/node/ping.tsx
(0 hunks)src/store/slices/node/actionsAsync.ts
(1 hunks)src/store/slices/node/initialState.ts
(2 hunks)
💤 Files with no reviewable changes (2)
- src/future-hopr-lib-components/Section/index.tsx
- src/pages/node/ping.tsx
✅ Files skipped from review due to trivial changes (1)
- src/pages/node/info/index.tsx
🔇 Additional comments (9)
src/future-hopr-lib-components/Navbar/navBar.tsx (1)
19-19
: LGTM: Height adjustment is consistent
The navbar height reduction to 55px aligns with the layout adjustments seen across other components.
src/components/NotificationBar/index.tsx (1)
22-23
: LGTM! Consistent styling update
The height and width adjustments align with similar changes across other components, maintaining UI consistency.
src/components/ConnectNode/index.tsx (2)
26-26
: LGTM! Consistent styling update
The height adjustment aligns with similar changes in NotificationBar component.
Line range hint 155-182
: LGTM! Well-implemented menu handling
The menu handling implementation includes:
- Clean separation of concerns with dedicated open/close handlers
- Proper cleanup of event listeners
- Correct handling of click outside events
src/future-hopr-lib-components/Layout/drawer.tsx (4)
20-21
: LGTM! Drawer width constants updated
The drawer width constants have been adjusted to provide a more compact layout.
84-96
: LGTM! Improved header styling
The StyledListSubheader changes provide better alignment and spacing:
- Reduced height for a more compact look
- Added proper icon spacing
- Improved font size for better readability
100-115
: LGTM! Enhanced list item styling
The StyledListItemButton changes provide better visual hierarchy:
- Adjusted height and padding for better spacing
- Updated icon dimensions for consistency
- Improved typography settings
218-228
: LGTM! Improved group header rendering
The conditional rendering of group headers has been enhanced with proper icon handling for both open and closed states.
src/components/Modal/node/PingModal.tsx (1)
26-26
: LGTM: Redux state integration for ping tracking
The addition of the pinging
state from the Redux store enables proper tracking of ongoing ping operations.
margin-left: 220px; | ||
width: calc( 100% - 240px - 32px); |
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.
Fix inconsistent width calculation
There's an inconsistency in the dimensions:
margin-left
is set to220px
- But the width calculation still uses
240px
:calc(100% - 240px - 32px)
This mismatch could cause layout issues. The width calculation should be updated to match the new margin.
.drawerOpen .Overlay {
margin-left: 220px;
- width: calc( 100% - 240px - 32px);
+ width: calc( 100% - 220px - 32px);
}
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.
margin-left: 220px; | |
width: calc( 100% - 240px - 32px); | |
margin-left: 220px; | |
width: calc( 100% - 220px - 32px); |
if (action.meta.arg.apiEndpoint !== state.apiEndpoint) return; | ||
if (action.payload) { | ||
const pingExists = state.pings.findIndex((ping) => ping.peerId === action.payload?.peerId); | ||
|
||
if (pingExists) { | ||
state.pings[pingExists] = { | ||
latency: action.payload.latency, | ||
peerId: action.payload.peerId, | ||
reportedVersion: action.payload.reportedVersion, | ||
}; | ||
} else { | ||
state.pings.push({ | ||
latency: action.payload.latency, | ||
peerId: action.payload.peerId, | ||
reportedVersion: action.payload.reportedVersion, | ||
}); | ||
} | ||
const peerId = action.meta.arg.peerId; | ||
if(peerId && state.pinging[peerId]){ | ||
const next = {...state.pinging} | ||
delete next[peerId] | ||
state.pinging = next; | ||
} | ||
}); | ||
builder.addCase(pingNodeThunk.rejected, (state, action) => { | ||
if (action.meta.arg.apiEndpoint !== state.apiEndpoint) return; | ||
const peerId = action.meta.arg.peerId; | ||
if(peerId && state.pinging[peerId]){ | ||
const next = {...state.pinging} | ||
delete next[peerId] | ||
state.pinging = next; | ||
} |
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.
🛠️ Refactor suggestion
Reduce code duplication in ping state management
The fulfilled and rejected cases contain identical code for removing the ping status. Consider extracting this logic into a helper function.
+ const removePingStatus = (state: typeof initialState, peerId: string) => {
+ if (peerId && state.pinging[peerId]) {
+ delete state.pinging[peerId];
+ }
+ };
builder.addCase(pingNodeThunk.fulfilled, (state, action) => {
if (action.meta.arg.apiEndpoint !== state.apiEndpoint) return;
const peerId = action.meta.arg.peerId;
- if(peerId && state.pinging[peerId]){
- const next = {...state.pinging}
- delete next[peerId]
- state.pinging = next;
- }
+ removePingStatus(state, peerId);
});
builder.addCase(pingNodeThunk.rejected, (state, action) => {
if (action.meta.arg.apiEndpoint !== state.apiEndpoint) return;
const peerId = action.meta.arg.peerId;
- if(peerId && state.pinging[peerId]){
- const next = {...state.pinging}
- delete next[peerId]
- state.pinging = next;
- }
+ removePingStatus(state, peerId);
});
Additionally, the object spread operation is unnecessary since we can directly modify the state object in Redux Toolkit.
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.
if (action.meta.arg.apiEndpoint !== state.apiEndpoint) return; | |
if (action.payload) { | |
const pingExists = state.pings.findIndex((ping) => ping.peerId === action.payload?.peerId); | |
if (pingExists) { | |
state.pings[pingExists] = { | |
latency: action.payload.latency, | |
peerId: action.payload.peerId, | |
reportedVersion: action.payload.reportedVersion, | |
}; | |
} else { | |
state.pings.push({ | |
latency: action.payload.latency, | |
peerId: action.payload.peerId, | |
reportedVersion: action.payload.reportedVersion, | |
}); | |
} | |
const peerId = action.meta.arg.peerId; | |
if(peerId && state.pinging[peerId]){ | |
const next = {...state.pinging} | |
delete next[peerId] | |
state.pinging = next; | |
} | |
}); | |
builder.addCase(pingNodeThunk.rejected, (state, action) => { | |
if (action.meta.arg.apiEndpoint !== state.apiEndpoint) return; | |
const peerId = action.meta.arg.peerId; | |
if(peerId && state.pinging[peerId]){ | |
const next = {...state.pinging} | |
delete next[peerId] | |
state.pinging = next; | |
} | |
const removePingStatus = (state: typeof initialState, peerId: string) => { | |
if (peerId && state.pinging[peerId]) { | |
delete state.pinging[peerId]; | |
} | |
}; | |
builder.addCase(pingNodeThunk.fulfilled, (state, action) => { | |
if (action.meta.arg.apiEndpoint !== state.apiEndpoint) return; | |
const peerId = action.meta.arg.peerId; | |
removePingStatus(state, peerId); | |
}); | |
builder.addCase(pingNodeThunk.rejected, (state, action) => { | |
if (action.meta.arg.apiEndpoint !== state.apiEndpoint) return; | |
const peerId = action.meta.arg.peerId; | |
removePingStatus(state, peerId); | |
}); |
Summary by CodeRabbit
Release Notes
New Features
UI Improvements
Bug Fixes
Chores