Skip to content

Comments

feat: add survey popup#755

Merged
kvhnuke merged 3 commits intodevelopfrom
feat/survey-popup
Sep 18, 2025
Merged

feat: add survey popup#755
kvhnuke merged 3 commits intodevelopfrom
feat/survey-popup

Conversation

@olgakup
Copy link
Contributor

@olgakup olgakup commented Sep 16, 2025

Summary by CodeRabbit

  • New Features

    • Dismissible survey popup added to the app menu; appears after the Solana staking banner (or when that banner is absent), shows after a short delay, has a close button and a “Click here” CTA opening an external survey, and stays hidden once dismissed.
  • Style

    • Smooth slide-fade transitions when switching between the staking banner and the survey popup.
  • Chores

    • Extension package version bumped to 2.12.0.

@coderabbitai
Copy link

coderabbitai bot commented Sep 16, 2025

Walkthrough

Adds a persisted survey-popup flag and show/hide APIs to banners state, introduces a new Vue survey-popup component, integrates a delayed/transitioned survey flow into the app menu that follows or replaces the Solana staking banner, and renames one analytics event.

Changes

Cohort / File(s) Summary
Banners state (flag + API)
packages/extension/src/libs/banners-state/index.ts, packages/extension/src/libs/banners-state/types.ts
Adds isHideSurveyPopup: boolean to IState; initializes/resets it to false and persists it. Adds BannersState.showSurveyPopup(): Promise<boolean> and BannersState.hideSurveyPopup(): Promise<void>.
App menu integration
packages/extension/src/ui/action/components/app-menu/index.vue
Replaces standalone Solana banner with a Transition that conditionally renders the Solana staking banner or the new survey-popup. Adds isSurveyPopup reactive state, 4s delayed reveal, openSurveyPopup/closeSurveyPopup handlers calling bannersState APIs, slide-fade transitions, and stable key attributes.
New survey component
packages/extension/src/ui/action/components/app-menu/components/survey-popup.vue
New Vue 3 SFC that shows a bottom-left survey prompt with title/description, CTA that opens external survey link then closes, and a close icon that emits close. Uses TS script-setup and LESS styling.
Analytics event update
packages/extension/src/ui/action/components/app-menu/components/solana-staking-banner.vue
Changes analytics event in openStakingLink from SolanaWalletClicked to NetworkListClicked; other behavior unchanged.
Package version
packages/extension/package.json
Bumps package version from 2.11.0 to 2.12.0.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant AppMenu as AppMenu (index.vue)
  participant BState as BannersState
  participant Storage as Storage
  participant Solana as SolanaStakingBanner
  participant Survey as SurveyPopup

  Note over AppMenu: onMounted
  AppMenu->>BState: showSolanaStakingBanner()
  BState-->>AppMenu: boolean

  alt Solana banner shown
    AppMenu->>Solana: render
    User-->>Solana: close
    Solana-->>AppMenu: onClose
    AppMenu->>AppMenu: openSurveyPopup()
  else Solana not shown
    AppMenu->>AppMenu: openSurveyPopup()
  end

  AppMenu->>BState: showSurveyPopup()
  BState->>Storage: read isHideSurveyPopup
  Storage-->>BState: flag
  BState-->>AppMenu: boolean (show?)
  alt show == true
    AppMenu->>AppMenu: wait 4s
    AppMenu->>Survey: render (Transition)
    User-->>Survey: CTA click or close
    Survey-->>AppMenu: emit close
    AppMenu->>BState: hideSurveyPopup()
    BState->>Storage: set isHideSurveyPopup = true
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • gamalielhere

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "feat: add survey popup" is concise, uses a conventional commit prefix, and directly reflects the primary change—adding a survey popup component and related state/behavior—so it accurately summarizes the main intent. It is specific enough for history scanning and does not include noisy file lists or vague wording. It clearly communicates the developer's key change without overclaiming.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/survey-popup

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 771d1e8 and c604780.

📒 Files selected for processing (1)
  • packages/extension/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/extension/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: buildAll
  • GitHub Check: test
  • GitHub Check: test

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Sep 16, 2025

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

💉 Virus total analysis
chrome: c6047804
firefox: c6047804

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

🧹 Nitpick comments (9)
packages/extension/src/ui/action/components/app-menu/components/solana-staking-banner.vue (1)

34-38: Confirm analytics event rename and pipeline alignment.

Renaming to SolanaStakingBannerEvents.NetworkListClicked is fine, but please verify this enum value exists and downstream dashboards/ETL expect the new name. Also consider awaiting the tracking call (if it returns a Promise) rather than relying on a fixed 1s timeout before navigation.

packages/extension/src/ui/action/components/app-menu/components/survey-popup.vue (4)

6-9: Use a button for the CTA instead of an anchor with javascript:void(0).

Improves accessibility and avoids anti-pattern anchors.

-      <a href="javascript:void(0);" @click="openSurveyLink" class="button"
-        ><span>Click here</span></a
-      >
+      <button type="button" @click="openSurveyLink" class="button">
+        <span>Click here</span>
+      </button>

11-14: Add an accessible label to the close control.

Screen readers need a label; keep the visual as-is.

-    <a class="survey-popup__close" @click="close">
+    <a class="survey-popup__close" @click="close" aria-label="Close survey popup">
       <close-icon />
     </a>

28-31: Consider adding click/close telemetry for the survey.

Track “SurveyOpened/Clicked/Closed” to measure engagement, similar to the staking banner.

If you want, I can draft a tiny metrics helper (types + track calls) aligned with your existing metrics library.


75-83: Redundant CSS declaration.

.button sets width: auto; then immediately overrides to width: 163px;. Remove the first one.

-      width: auto;
       width: 163px;
packages/extension/src/libs/banners-state/index.ts (1)

58-67: New show/hide API for survey popup is straightforward.

Optional: add explicit return types to keep the class API self-documenting.

-  async hideSurveyPopup() {
+  async hideSurveyPopup(): Promise<void> {
     const state = await this.getOrInitializeState();
     state.isHideSurveyPopup = true;
     await this.storage.set(StorageKeys.bannersInfo, state);
   }
packages/extension/src/ui/action/components/app-menu/index.vue (3)

161-173: Prevent overlap during switch with transition mode.

Add mode="out-in" so the leaving banner finishes before the survey enters.

-    <Transition name="slide-fade">
+    <Transition name="slide-fade" mode="out-in">

273-285: Gate survey trigger by expansion state (optional).

You call openSurveyPopup() even when collapsed; it then appears instantly when the menu is expanded. If you prefer the 4s delay only when visible, guard by isExpanded.value.

-  if (!isSolanaStakingBanner.value) {
-    openSurveyPopup();
-  }
+  if (!isSolanaStakingBanner.value && isExpanded.value) {
+    openSurveyPopup();
+  }

556-577: Manage survey timer lifecycle; avoid stray timeouts and show-only-when-expanded.

Store/clear the timeout, check isExpanded before showing, and clear on unmount.

-const isSurveyPopup = ref(false);
+const isSurveyPopup = ref(false);
+const surveyTimer = ref<ReturnType<typeof setTimeout> | null>(null);
@@
-const closeSolanaStakingBanner = () => {
+const closeSolanaStakingBanner = () => {
   isSolanaStakingBanner.value = false;
   bannersState.hideSolanaStakingBanner();
   openSurveyPopup();
 };
 
 const openSurveyPopup = async () => {
   if (await bannersState.showSurveyPopup()) {
-    setTimeout(() => {
-      isSurveyPopup.value = true;
-    }, 4000);
+    if (surveyTimer.value) {
+      clearTimeout(surveyTimer.value);
+      surveyTimer.value = null;
+    }
+    surveyTimer.value = setTimeout(() => {
+      if (isExpanded.value) {
+        isSurveyPopup.value = true;
+      }
+      surveyTimer.value = null;
+    }, 4000);
   }
 };
 
-const closeSurveyPopup = () => {
+const closeSurveyPopup = () => {
   isSurveyPopup.value = false;
   bannersState.hideSurveyPopup();
+  if (surveyTimer.value) {
+    clearTimeout(surveyTimer.value);
+    surveyTimer.value = null;
+  }
 };

Add unmount cleanup and import:

-import { PropType, ref, computed, onMounted } from 'vue';
+import { PropType, ref, computed, onMounted, onUnmounted } from 'vue';
@@
 onMounted(async () => {
   …
 });
+
+onUnmounted(() => {
+  if (surveyTimer.value) {
+    clearTimeout(surveyTimer.value);
+    surveyTimer.value = null;
+  }
+});
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a648bc and 523cb32.

📒 Files selected for processing (5)
  • packages/extension/src/libs/banners-state/index.ts (3 hunks)
  • packages/extension/src/libs/banners-state/types.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/components/survey-popup.vue (1 hunks)
  • packages/extension/src/ui/action/components/app-menu/index.vue (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: buildAll
  • GitHub Check: test
  • GitHub Check: test
🔇 Additional comments (3)
packages/extension/src/libs/banners-state/types.ts (1)

8-8: State shape extension LGTM.

Adding isHideSurveyPopup: boolean cleanly extends the banner state.

Please confirm no migration is required for existing stored states; with missing fields defaulting to undefined, showSurveyPopup() will return true as desired.

packages/extension/src/libs/banners-state/index.ts (1)

20-25: Initialization and reset paths look correct.

isHideSurveyPopup is properly initialized and reset.

Also applies to: 28-34

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

583-595: Transition styles LGTM.

The slide-fade timings read well for unobtrusive UI.

@kvhnuke kvhnuke merged commit 75a49b7 into develop Sep 18, 2025
4 of 5 checks passed
@kvhnuke kvhnuke deleted the feat/survey-popup branch September 18, 2025 18:24
This was referenced Sep 18, 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.

3 participants