Skip to content
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

fix: token creation form layout and theme #109

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

fmorency
Copy link
Contributor

@fmorency fmorency commented Dec 3, 2024

This PR fixes the token creation form layout and color scheme and adds an informational blurb about the number of required signatures.

2024-12-03_14-13
2024-12-03_14-13_1
2024-12-03_14-14_1
2024-12-03_14-14
2024-12-03_14-15
2024-12-03_14-15_1
2024-12-03_14-16
2024-12-03_14-16_1

Summary by CodeRabbit

Release Notes

  • New Features

    • Added informational messages in the ConfirmationForm to guide users through the token creation process.
  • User Interface Enhancements

    • Updated layouts and color schemes in the ConfirmationForm, CreateDenom, Success, and TokenDetailsForm for improved visibility and readability.
    • Streamlined the Success component by removing less critical token detail fields.
  • Bug Fixes

    • Enhanced button visibility in dark mode across various components.
  • Tests

    • Updated tests for ConfirmationForm and Success components to reflect changes in displayed information.

@fmorency fmorency added the enhancement New feature or request label Dec 3, 2024
@fmorency fmorency requested a review from chalabi2 December 3, 2024 19:18
@fmorency fmorency self-assigned this Dec 3, 2024
Copy link
Contributor

coderabbitai bot commented Dec 3, 2024

Walkthrough

The pull request introduces several updates across multiple components related to token management. Key changes include the addition of informational messages in the ConfirmationForm, adjustments to UI elements for better visibility and consistency, and the removal of redundant sections in the Success component. The styling of buttons has been enhanced for dark mode compatibility. Test files have been updated to reflect these changes, focusing on the relevant elements while removing outdated assertions.

Changes

File Change Summary
components/factory/forms/ConfirmationForm.tsx Added informational message about signing messages, updated layout and styling, removed sections for "Denom Units" and "Advanced Details".
components/factory/forms/CreateDenom.tsx Added dark:text-white class to button for dark mode support.
components/factory/forms/Success.tsx Removed sections displaying "DISPLAY," "SUBDENOM," "BASE EXPONENT," and "DISPLAY EXPONENT"; changed text color and heading.
components/factory/forms/TokenDetailsForm.tsx Updated "Previous" button styling for dark mode; no functional changes.
components/factory/forms/__tests__/ConfirmationForm.test.tsx Removed assertions for old text elements and added new ones focused on current UI.
components/factory/forms/__tests__/Success.test.tsx Removed assertions for old token details, retained checks for essential information.

Possibly related PRs

Suggested labels

render, UX

Suggested reviewers

  • chalabi2

🐰 In the meadow where tokens play,
A form was spruced up, brightening the day.
With colors that pop and messages clear,
Users now hop with a smile, full of cheer!
So let’s celebrate this change, oh so neat,
A user-friendly journey, now can't be beat! 🌼✨


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.09%. Comparing base (3dcd8df) to head (4d44b36).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #109      +/-   ##
==========================================
- Coverage   60.20%   60.09%   -0.11%     
==========================================
  Files         146      146              
  Lines       14473    14435      -38     
==========================================
- Hits         8713     8675      -38     
  Misses       5760     5760              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@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: 0

🧹 Outside diff range and nitpick comments (4)
components/factory/forms/__tests__/ConfirmationForm.test.tsx (1)

33-34: Consider expanding test coverage for new features

While the test updates align with UI changes, consider adding assertions to verify the new informational message about signing two messages that was added to the form.

Add the following test:

 test('renders form with correct details', () => {
   renderWithProps();
+  expect(screen.getByText(/You will be required to sign two messages/)).toBeInTheDocument();
   // existing assertions...
 });
components/factory/forms/Success.tsx (1)

16-16: Improve color contrast accessibility

The specific hex color #808080 might not provide sufficient contrast in all theme modes. Consider using Tailwind's built-in color system for better theme compatibility.

-<p className="text-md text-[#808080] mb-6 text-pretty">
+<p className="text-md text-gray-400 dark:text-gray-500 mb-6 text-pretty">

Also applies to: 21-21, 25-25

components/factory/forms/ConfirmationForm.tsx (2)

106-112: Consider improving accessibility of form labels

The current implementation uses gray text colors which might have insufficient contrast. Consider using semantic HTML and ARIA attributes for better accessibility.

-<div className="bg-base-300 p-4 rounded-[12px]">
-  <label className="text-sm text-gray-500 dark:text-gray-400">Symbol</label>
-  <div className="">{formData.symbol || formData.display}</div>
+<div className="bg-base-300 p-4 rounded-[12px]">
+  <label htmlFor="symbol" className="text-sm font-medium text-gray-700 dark:text-gray-300">Symbol</label>
+  <div id="symbol" aria-label="Token symbol" className="mt-1">{formData.symbol || formData.display}</div>
</div>

Line range hint 28-77: Enhance error handling and user feedback

The transaction error handling could be improved to provide better feedback to users.

 try {
   // First, create the denom
   const createDenomMsg = createDenom({
     sender: address,
     subdenom: formData.subdenom,
   });

   const createDenomFee = await estimateFee(address, [createDenomMsg]);
   const createDenomResult = await tx([createDenomMsg], {
     fee: createDenomFee,
     returnError: true,
   });

   if (createDenomResult && createDenomResult.error) {
-    console.error('Error creating denom:', createDenomResult.error);
+    const errorMessage = createDenomResult.error.message || 'Failed to create token';
+    toast.error(errorMessage);
     return;
   }
   // ... rest of the code
 } catch (error) {
-  console.error('Error during transaction setup:', error);
+  const errorMessage = error instanceof Error ? error.message : 'An unexpected error occurred';
+  toast.error(errorMessage);
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3dcd8df and 4d44b36.

📒 Files selected for processing (6)
  • components/factory/forms/ConfirmationForm.tsx (2 hunks)
  • components/factory/forms/CreateDenom.tsx (1 hunks)
  • components/factory/forms/Success.tsx (2 hunks)
  • components/factory/forms/TokenDetailsForm.tsx (1 hunks)
  • components/factory/forms/__tests__/ConfirmationForm.test.tsx (1 hunks)
  • components/factory/forms/__tests__/Success.test.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • components/factory/forms/tests/Success.test.tsx
✅ Files skipped from review due to trivial changes (2)
  • components/factory/forms/CreateDenom.tsx
  • components/factory/forms/TokenDetailsForm.tsx
🔇 Additional comments (3)
components/factory/forms/Success.tsx (1)

48-50: LGTM! Clear and consistent terminology

The change from URI to "Logo URL" improves user understanding.

components/factory/forms/ConfirmationForm.tsx (2)

97-101: LGTM! Clear user communication

The added message effectively communicates the two-step signing process to users.


132-135: LGTM! Improved button contrast

The dark text color on the neutral button improves readability.

Copy link
Collaborator

@chalabi2 chalabi2 left a comment

Choose a reason for hiding this comment

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

lgtm!

@fmorency fmorency merged commit ca111aa into liftedinit:main Dec 4, 2024
4 checks passed
@fmorency fmorency deleted the tf-confirmation branch December 4, 2024 13:45
This was referenced Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants