-
Notifications
You must be signed in to change notification settings - Fork 5
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
vote button | updatedenommetadata placeholder/buttons #77
Conversation
WalkthroughThe pull request introduces modifications to the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Warning Rate limit exceeded@chalabi2 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 11 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 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: 0
🧹 Outside diff range and nitpick comments (6)
components/factory/modals/updateDenomMetadata.tsx (3)
Line range hint
129-157
: Consider enhancing form field feedback.While the placeholders effectively show current values, consider adding visual feedback for validation states:
<TextInput label="NAME" name="name" value={values.name} placeholder={denom?.name} + className={`${errors.name && touched.name ? 'input-error' : ''}`} + helperText={touched.name && errors.name} onChange={handleChange} />
160-179
: Consider UX improvements for action buttons.The button layout looks good, but there are some UX considerations:
- Add confirmation dialog when canceling with unsaved changes:
onClick={() => { + if (dirty) { + if (!confirm('You have unsaved changes. Are you sure you want to cancel?')) { + return; + } + } const modal = document.getElementById(modalId) as HTMLDialogElement; modal?.close(); }}
- Consider swapping button order to follow platform conventions (primary action on the right):
-<button className="btn w-1/2 btn-neutral">Cancel</button> -<button className="btn w-1/2 btn-gradient">Update</button> +<button className="btn w-1/2 btn-gradient">Update</button> +<button className="btn w-1/2 btn-neutral">Cancel</button>
164-167
: Consider improving modal management architecture.The current implementation uses direct DOM manipulation for modal control. Consider using React's controlled components pattern or a modal context:
- Create a modal context:
// modalContext.tsx export const ModalContext = React.createContext({ isOpen: false, openModal: () => {}, closeModal: () => {}, }); export const ModalProvider: React.FC = ({ children }) => { const [isOpen, setIsOpen] = useState(false); return ( <ModalContext.Provider value={{ isOpen, openModal: () => setIsOpen(true), closeModal: () => setIsOpen(false), }} > {children} </ModalContext.Provider> ); };
- Update modal implementation:
-<dialog id={modalId} className="modal"> +<Modal isOpen={isOpen} onClose={closeModal}> {/* modal content */} -</dialog> +</Modal>This approach would:
- Eliminate direct DOM manipulation
- Provide better control over modal state
- Make the component more testable
Also applies to: 184-186
components/groups/modals/voteDetailsModal.tsx (3)
Line range hint
574-591
: Fix spelling: Rename 'executeWithdrawl' to 'executeWithdrawal'The function name contains a spelling error. 'Withdrawl' should be 'Withdrawal'.
Apply this change throughout the file:
- case 'remove': - executeWithdrawl(); + case 'remove': + executeWithdrawal();
Line range hint
574-591
: Enhance error handling in action handlersThe click handler contains multiple actions but lacks proper error boundaries. Consider wrapping the switch statement in a try-catch block for better error handling.
Consider this improvement:
onClick={() => { + try { switch (getButtonState.action) { case 'execute': executeProposal(); break; case 'vote': handleVoteButtonClick(); break; case 'remove': executeWithdrawal(); break; } + } catch (error) { + console.error('Action handler failed:', error); + // Consider showing a user-friendly error message + } }}
Line range hint
574-591
: Enhance button accessibilityWhile the button includes an aria-label, it could benefit from more descriptive accessibility attributes.
Consider these accessibility improvements:
<button aria-label="action-btn" + aria-busy={isSigning} + aria-disabled={isSigning || (getButtonState.action === 'remove' && !proposal?.proposers?.includes(address ?? ''))} disabled={ isSigning || (getButtonState.action === 'remove' && !proposal?.proposers?.includes(address ?? '')) } className="btn w-full btn-gradient text-white rounded-[12px]"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
components/factory/modals/updateDenomMetadata.tsx
(2 hunks)components/groups/modals/voteDetailsModal.tsx
(1 hunks)
🔇 Additional comments (1)
components/groups/modals/voteDetailsModal.tsx (1)
574-574
: LGTM: Button styling update aligns with modal design uniformity
The change from 'btn-primary' to 'btn-gradient' maintains consistency with the modal's updated design.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #77 +/- ##
==========================================
+ Coverage 58.97% 58.99% +0.02%
==========================================
Files 145 145
Lines 14076 14085 +9
==========================================
+ Hits 8301 8310 +9
Misses 5775 5775 ☔ View full report in Codecov by Sentry. |
fixes Uniformize modal look'n'feel #30 & Token metadata update modal should be initialized with current metadata #23
Summary by CodeRabbit
New Features
Bug Fixes
executeWithdrawl
toexecuteWithdrawal
for consistency.Improvements