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

Sky Upgrade page banner update #4033

Merged
merged 3 commits into from
Sep 25, 2024
Merged

Conversation

marcinciarka
Copy link
Member

@marcinciarka marcinciarka commented Sep 25, 2024

Use multiple CTAs on the upgrade banner
Refactor ActionBanner component to support multiple CTAs

Summary by CodeRabbit

  • New Features
    • Introduced flexible call-to-action (CTA) buttons in the Action Banner, allowing for single or multiple CTAs.
    • Updated the Action Banner to include two distinct buttons: "Get SKY Rewards" and "Earn Chronicle Points," linking to respective reward pages.
    • Enhanced descriptive text to clarify that users can deposit USDS for rewards and withdraw at any time.
    • Updated the logo for the Sky lending protocol to improve visual representation.
    • Modified the partner logos on the homepage for better branding consistency.
    • Redesigned the cle icon for a more modern appearance.

Use multiple CTAs on the upgrade banner
Copy link
Contributor

coderabbitai bot commented Sep 25, 2024

Walkthrough

The changes introduce a new type definition CtaType for managing call-to-action buttons in the ActionBanner component, allowing for both single and multiple CTA objects. The SkySwapWrapper function updates the banner title and modifies the CTA from one button to two distinct buttons for earning rewards. The descriptive text is also revised to clarify the options for users regarding USDS deposits and withdrawals. Additionally, updates are made to partner logos and the Sky lending protocol logo.

Changes

File Change Summary
components/ActionBanner.tsx Introduced CtaType for CTA properties; updated cta property in ActionBannerType to accept `CtaType
features/homepage/helpers/constants.ts Updated partnerLogosConfig to replace Maker logo with Sky logo and adjusted image dimensions.
lendingProtocols/lendingProtocolsConfigs.ts Added new logo import skyLogo and updated skyConfig to use this new logo instead of skyIcon.
theme/icons/cle.tsx Modified SVG representation of the cle icon, enhancing its design while retaining color and viewBox properties.

Possibly related PRs

  • Update APY calculations for SKY #4030: The changes in this PR involve updates to the skyUsdsStakeDetails function and related components that handle APY calculations, which may be relevant to the new CtaType and CtaComponent introduced in the main PR, as both involve handling financial data and user interactions related to staking and rewards.

🐰 In the land of code where the banners sway,
New buttons hop in to brighten the day!
"Get SKY Rewards" and "Earn Points" they say,
With USDS deposits, come join the play!
A type for the CTAs, so neat and so fine,
Hooray for the changes, let the features shine! 🌟


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
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: 2

🧹 Outside diff range and nitpick comments (2)
pages/[networkOrProduct]/sky/upgrade.tsx (2)

Line range hint 80-102: LGTM! Consider extracting CTA configuration for improved readability.

The changes to the ActionBanner component successfully implement multiple CTA buttons as per the PR objectives. The updated title and description accurately reflect the new options for users to earn SKY rewards or Chronicle Points.

To improve code readability and maintainability, consider extracting the CTA configuration into a separate constant:

const ctaConfig = [
  {
    label: 'Get SKY Rewards',
    url: `/earn/srr/${wallet?.accounts[0].address}`,
  },
  {
    label: 'Earn Chronicle Points',
    url: `/earn/cle/${wallet?.accounts[0].address}`,
  },
];

// Then in the ActionBanner component:
cta={ctaConfig}

This refactoring would make it easier to manage and update the CTA options in the future.

🧰 Tools
Biome

[error] 78-78: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


Line range hint 1-153: Overall implementation looks good. Consider updating comments for consistency.

The changes to the ActionBanner component have been well-implemented and don't negatively impact the rest of the file. The SkySwapWrapper function still correctly checks for a non-zero USDS balance before rendering the banner.

For consistency and to help future developers, consider updating the comments at the top of the file to reflect the new functionality of multiple CTAs and the option to earn either SKY rewards or Chronicle Points. This will make it easier for other developers to understand the purpose and functionality of this component at a glance.

🧰 Tools
Biome

[error] 78-78: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9f35ef2 and 6641587.

📒 Files selected for processing (2)
  • components/ActionBanner.tsx (3 hunks)
  • pages/[networkOrProduct]/sky/upgrade.tsx (2 hunks)
🔇 Additional comments not posted (3)
pages/[networkOrProduct]/sky/upgrade.tsx (1)

86-86: Verify privacy implications of using wallet addresses in URLs.

The implementation uses the user's wallet address in the URLs for the CTA buttons. While this is a common practice, it's important to ensure that this doesn't lead to any privacy concerns or unintended information exposure.

Please confirm that:

  1. The use of wallet addresses in these URLs is necessary for the functionality.
  2. There are no privacy implications or risks associated with exposing these addresses in the URL.
  3. The pages these URLs lead to have appropriate access controls to prevent unauthorized access to user data.

You can use the following script to check for other instances of wallet addresses being used in URLs throughout the codebase:

This will help ensure consistent and secure handling of wallet addresses across the application.

Also applies to: 90-90

components/ActionBanner.tsx (2)

42-94: Extraction of CtaComponent enhances modularity

Introducing the CtaComponent encapsulates the CTA rendering logic, improving code modularity and readability. This makes the codebase cleaner and the ActionBanner component more maintainable.


144-144: Effective integration of CtaComponent in ActionBanner

The integration of CtaComponent within ActionBanner ensures consistent rendering of CTAs and leverages the newly created component effectively.

components/ActionBanner.tsx Show resolved Hide resolved
components/ActionBanner.tsx Show resolved Hide resolved
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: 2

🧹 Outside diff range and nitpick comments (2)
features/homepage/helpers/constants.ts (1)

Line range hint 1-41: Consider standardizing logo sizes and adding URLs

While the changes look good, I have two suggestions for improving the overall partnerLogosConfig:

  1. Empty URLs: All entries, including the new 'Sky' entry, have empty URL fields. Consider adding appropriate URLs for each partner to enhance user interaction and provide more information about the partners.

  2. Logo size consistency: The dimensions of the logos vary significantly across entries. For example, the new 'Sky' logo (110x38px) is considerably smaller than some others like 'Aave' (146x100px) or 'Ajna' (163x30px). Consider standardizing the logo sizes or at least setting a consistent maximum width or height to improve the visual consistency of the slider.

Here's a suggestion to improve consistency:

export const partnerLogosConfig: ImagesSliderProps['items'] = [
  {
    imgSrc: staticFilesRuntimeUrl('/static/img/homepage/slider/aave.svg'),
    imgAlt: 'Aave',
    url: 'https://aave.com', // Add appropriate URL
    maxWidth: '160px', // Standardize max width
    height: 'auto',
  },
  // ... (apply similar changes to other entries)
  {
    imgSrc: staticFilesRuntimeUrl('/static/img/homepage/slider/sky.svg'),
    imgAlt: 'Sky',
    url: 'https://sky.xyz', // Add appropriate URL
    maxWidth: '160px', // Standardize max width
    height: 'auto',
  },
  // ... (apply similar changes to remaining entries)
]

This approach would help maintain visual consistency while allowing for different aspect ratios of the logos.

theme/icons/cle.tsx (1)

16-16: Ensure unique SVG id attributes to prevent potential collisions

The id attribute clip0_15346_4406 may cause collisions if multiple instances of this icon are rendered on the same page. Consider generating a unique id or making it more descriptive to avoid conflicts.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6641587 and 75bed22.

🔇 Files ignored due to path filters (2)
  • public/static/img/homepage/slider/sky.svg is excluded by !**/*.svg
  • public/static/img/protocol_icons/sky_logo.svg is excluded by !**/*.svg
📒 Files selected for processing (3)
  • features/homepage/helpers/constants.ts (1 hunks)
  • lendingProtocols/lendingProtocolsConfigs.ts (2 hunks)
  • theme/icons/cle.tsx (1 hunks)
🔇 Additional comments not posted (3)
features/homepage/helpers/constants.ts (1)

20-24: Logo update: Maker replaced with Sky

The changes look good overall. The 'Maker' logo has been replaced with 'Sky', which aligns with the PR objective of updating the Sky Upgrade page banner. A few observations:

  1. The image source has been correctly updated to point to the Sky logo.
  2. The alt text has been appropriately changed to 'Sky'.
  3. The dimensions have been adjusted, likely to accommodate the new logo's aspect ratio.

To ensure the new logo file exists and the dimensions are correct, please run the following script:

This script will help verify the existence of the new logo file and, if possible, check its dimensions to ensure they match the values specified in the code.

lendingProtocols/lendingProtocolsConfigs.ts (2)

13-13: LGTM: New logo import added correctly.

The addition of the skyLogo import is consistent with the existing import pattern and aligns with the PR objective of updating the Sky Upgrade page banner.


Line range hint 1-100: Overall assessment: Changes look good and align with PR objectives.

The updates to the Sky protocol configuration, including the new logo import and its usage, are well-implemented and consistent with the goal of enhancing the upgrade banner. The changes maintain the existing code structure and type safety. No major issues were identified during the review.

lendingProtocols/lendingProtocolsConfigs.ts Show resolved Hide resolved
theme/icons/cle.tsx Show resolved Hide resolved
@marcinciarka marcinciarka merged commit 357efe0 into dev Sep 25, 2024
26 checks passed
@marcinciarka marcinciarka deleted the marcinciarka/sky-cle-banner branch September 25, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant