Skip to content

Comments

Created Solana staking banners#708

Merged
kvhnuke merged 6 commits intodevop/release-2-9from
feature/solana-staking-banner
Jun 20, 2025
Merged

Created Solana staking banners#708
kvhnuke merged 6 commits intodevop/release-2-9from
feature/solana-staking-banner

Conversation

@mihailpolev
Copy link
Contributor

@mihailpolev mihailpolev commented May 30, 2025

Summary by CodeRabbit

  • New Features

    • Introduced Solana staking promotional banners in the app menu and network assets views.
    • Banners can be dismissed by users and will not reappear once closed.
    • Added visually enhanced banners with custom icons and logos to highlight Solana staking opportunities.
    • Added user interaction tracking for Solana staking banner clicks.
  • Style

    • Implemented new SVG icons and logos to improve the appearance of staking banners.

@mihailpolev mihailpolev requested a review from kvhnuke May 30, 2025 03:08
@coderabbitai
Copy link

coderabbitai bot commented May 30, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (3)
  • main
  • develop
  • devop/vite-migrate

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update introduces a persistent banner system for promoting Solana staking within the extension's UI. It adds a state management class utilizing browser storage to track banner visibility, integrates new banner components into the app menu and network assets views, and provides associated SVG icon components. Banner visibility is managed asynchronously, allowing users to dismiss banners, with their choices saved for future sessions.

Changes

File(s) Change Summary
src/libs/banners-state/index.ts, src/libs/banners-state/types.ts Added BannersState class for persistent banner visibility management and supporting types/enums.
src/types/provider.ts Added bannersState to InternalStorageNamespace enum for storage scoping.
src/ui/action/components/app-menu/components/solana-staking-banner.vue Added new Solana staking banner Vue component with dismiss functionality and custom design.
src/ui/action/components/app-menu/index.vue Integrated Solana staking banner component; manages visibility state via BannersState.
src/ui/action/icons/banners/attractive-apr-icon.vue, .../consistent-rewards-icon.vue Added SVG icon components for banner use.
src/ui/action/icons/common/close-icon-white.vue, .../enkrypt-staking-logo-white.vue, .../enkrypt-staking-logo.vue Added SVG icon components for logos and close button.
src/ui/action/views/network-assets/components/network-assets-solana-staking-banner.vue Added network assets Solana staking banner Vue component with icons and dismiss logic.
src/ui/action/views/network-assets/index.vue Integrated network assets Solana staking banner; manages visibility state via BannersState.
src/libs/metrics/index.ts, src/libs/metrics/types.ts Added tracking for Solana staking banner events with new event enum and tracking function.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AppMenu
    participant NetworkAssets
    participant BannersState
    participant BrowserStorage

    Note over AppMenu,NetworkAssets: On component mount
    AppMenu->>BannersState: showSolanaStackingBanner()
    BannersState->>BrowserStorage: get(bannersInfo)
    BrowserStorage-->>BannersState: bannersInfo state or default
    BannersState-->>AppMenu: true/false

    NetworkAssets->>BannersState: showNetworkAssetsSolanaStackingBanner()
    BannersState->>BrowserStorage: get(bannersInfo)
    BrowserStorage-->>BannersState: bannersInfo state or default
    BannersState-->>NetworkAssets: true/false

    Note over User,AppMenu: User clicks close on banner
    AppMenu->>BannersState: hideSolanaStackingBanner()
    BannersState->>BrowserStorage: set(bannersInfo, isHideSolanStackingBanner=true)
    BrowserStorage-->>BannersState: ack

    Note over User,NetworkAssets: User clicks close on banner
    NetworkAssets->>BannersState: hideNetworkAssetsSolanaStackingBanner()
    BannersState->>BrowserStorage: set(bannersInfo, isHideNetworkAssetSolanStackingBanner=true)
    BrowserStorage-->>BannersState: ack
Loading

Suggested reviewers

  • gamalielhere
  • kvhnuke

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

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.

@github-actions
Copy link

github-actions bot commented May 30, 2025

💼 Build Files
chrome: enkrypt-chrome-caf93302.zip
firefox: enkrypt-firefox-caf93302.zip

💉 Virus total analysis
chrome: caf93302
firefox: caf93302

Copy link

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

🧹 Nitpick comments (6)
packages/extension/src/ui/action/icons/common/close-icon-white.vue (1)

16-21: DRY up repeated icon styles
The scoped CSS targeting svg { display: inline-block; vertical-align: baseline; } is repeated across multiple icon components. Consider extracting these rules into a shared CSS module or global mixin to reduce duplication and ensure consistent styling.

packages/extension/src/ui/action/icons/banners/attractive-apr-icon.vue (1)

6-11: Consolidate common icon CSS
The same inline-block and vertical-align styling is applied here. Extract to a shared stylesheet or Vue mixin to avoid repetition and keep icon components consistent.

packages/extension/src/ui/action/icons/common/enkrypt-staking-logo.vue (1)

30-35: Extract shared SVG styling
The scoped CSS here duplicates the display and vertical-align rules used by other icons. Consider moving these styles to a shared CSS file or Vue mixin to adhere to DRY principles.

packages/extension/src/ui/action/icons/banners/consistent-rewards-icon.vue (1)

1-14: Add accessibility attributes to the SVG icon.

The SVG icon is missing accessibility attributes which could impact screen reader users.

Apply this diff to improve accessibility:

-<template>
-  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+<template>
+  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Consistent rewards icon">
packages/extension/src/ui/action/components/app-menu/components/solana-staking-banner.vue (1)

34-46: Consider using relative positioning instead of absolute.

The banner uses absolute positioning which could cause layout issues or overlap with other UI elements, especially on different screen sizes.

Consider whether this banner should use relative positioning or ensure proper z-index management to prevent UI conflicts.

packages/extension/src/ui/action/icons/common/enkrypt-staking-logo-white.vue (1)

1-36: Add accessibility attributes to the SVG logo.

The SVG logo is missing accessibility attributes which could impact screen reader users.

Apply this diff to improve accessibility:

-<template>
-  <svg width="121" height="24" viewBox="0 0 121 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<template>
+  <svg width="121" height="24" viewBox="0 0 121 24" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Enkrypt staking logo">
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97bd787 and a97128a.

⛔ Files ignored due to path filters (3)
  • packages/extension/src/ui/action/assets/banners/solana-stacking-banner-bg.png is excluded by !**/*.png
  • packages/extension/src/ui/action/assets/banners/solana-stacking-banner-tokens-img.png is excluded by !**/*.png
  • packages/extension/src/ui/action/assets/banners/solana-stacking-banner.png is excluded by !**/*.png
📒 Files selected for processing (12)
  • packages/extension/src/libs/banners-state/index.ts (1 hunks)
  • packages/extension/src/libs/banners-state/types.ts (1 hunks)
  • packages/extension/src/types/provider.ts (1 hunks)
  • packages/extension/src/ui/action/components/app-menu/components/solana-staking-banner.vue (1 hunks)
  • packages/extension/src/ui/action/components/app-menu/index.vue (4 hunks)
  • packages/extension/src/ui/action/icons/banners/attractive-apr-icon.vue (1 hunks)
  • packages/extension/src/ui/action/icons/banners/consistent-rewards-icon.vue (1 hunks)
  • packages/extension/src/ui/action/icons/common/close-icon-white.vue (1 hunks)
  • packages/extension/src/ui/action/icons/common/enkrypt-staking-logo-white.vue (1 hunks)
  • packages/extension/src/ui/action/icons/common/enkrypt-staking-logo.vue (1 hunks)
  • packages/extension/src/ui/action/views/network-assets/components/network-assets-solana-staking-banner.vue (1 hunks)
  • packages/extension/src/ui/action/views/network-assets/index.vue (4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/extension/src/libs/banners-state/index.ts (1)
packages/extension/src/libs/banners-state/types.ts (1)
  • IState (5-8)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: buildAll
  • GitHub Check: test
  • GitHub Check: test
🔇 Additional comments (8)
packages/extension/src/ui/action/views/network-assets/components/network-assets-solana-staking-banner.vue (1)

23-23: Good use of event modifier.

The use of @click.stop is appropriate here to prevent the close button click from bubbling up to the parent link element.

packages/extension/src/ui/action/components/app-menu/index.vue (3)

208-209: LGTM! Clean import setup for banner functionality.

The imports are properly organized and the BannersState import follows the correct path structure.


161-164: Banner integration looks good.

The conditional rendering logic is correct, and passing the close callback as a prop follows Vue best practices.


544-550: Banner state management implementation is correct.

The reactive variable initialization, BannersState instantiation, and close handler follow proper patterns. The close handler correctly updates both the UI state and persistent storage.

packages/extension/src/ui/action/views/network-assets/index.vue (4)

91-92: LGTM! Proper imports for banner functionality.

The component and state management imports are correctly structured.


17-20: Good network-specific banner logic.

The banner is correctly rendered only for the SOLANA network, which makes sense in the network assets context. The conditional logic is clean and follows Vue best practices.


154-159: Verify async onMounted implementation.

The async onMounted hook is implemented correctly. However, ensure that the component can handle cases where the banner state check fails.

Consider adding error handling for the banner state check:

 onMounted(async () => {
   updateAssets();
-  if (await bannersState.showNetworkAssetsSolanaStackingBanner()) {
-    isSolanaStackingBanner.value = true;
-  }
+  try {
+    if (await bannersState.showNetworkAssetsSolanaStackingBanner()) {
+      isSolanaStackingBanner.value = true;
+    }
+  } catch (error) {
+    console.error('Failed to check banner visibility:', error);
+  }
 });

188-191: Banner close handler is correctly implemented.

The close handler properly updates both the UI state and persistent storage state.

@kvhnuke kvhnuke changed the title Created Solana stacking banners Created Solana staking banners Jun 2, 2025
@kvhnuke kvhnuke changed the base branch from develop to devop/release-2-9 June 20, 2025 18:40
@kvhnuke kvhnuke merged commit e694cbf into devop/release-2-9 Jun 20, 2025
4 of 5 checks passed
@kvhnuke kvhnuke deleted the feature/solana-staking-banner branch June 20, 2025 20:48
@coderabbitai coderabbitai bot mentioned this pull request Jun 20, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jun 30, 2025
This was referenced Sep 16, 2025
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.

2 participants