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

Feat/new update UI #595

Merged
merged 11 commits into from
Jan 14, 2025
Merged

Feat/new update UI #595

merged 11 commits into from
Jan 14, 2025

Conversation

olgakup
Copy link

@olgakup olgakup commented Jan 9, 2025

Summary by CodeRabbit

  • New Features

    • Added updates tracking and management functionality.
    • Introduced a new updates dialog with version history.
    • Implemented metrics tracking for updates events.
  • New Components

    • Added updates-related icons and UI components, including heart and updated icons.
    • Created a new updates view with version details.
    • Introduced a header for updates notifications.
    • Added a network display component for update information.
  • Improvements

    • Enhanced app menu with updates icon and dropdown.
    • Added state management for tracking software updates.
    • Improved error handling for network icons and updates display.
    • Updated styling for better UI presentation.

Copy link

coderabbitai bot commented Jan 9, 2025

Warning

Rate limit exceeded

@olgakup has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 7a787d2 and 6ef4efc.

📒 Files selected for processing (3)
  • packages/extension/src/libs/metrics/index.ts (3 hunks)
  • packages/extension/src/libs/metrics/types.ts (1 hunks)
  • packages/extension/src/ui/action/App.vue (11 hunks)

Walkthrough

This pull request introduces a comprehensive updates tracking system for the Enkrypt browser extension. The changes include new metrics tracking for update events, a state management system for tracking version information, and a new user interface for displaying software updates. The implementation spans multiple files across the extension's source code, adding new types, components, and utility functions to support a robust update notification and tracking mechanism.

Changes

File Change Summary
packages/extension/src/libs/metrics/index.ts Added trackUpdatesEvents function for tracking update-related events.
packages/extension/src/libs/metrics/types.ts Introduced UpdatesEventType and UpdatesOpenLocation enums.
packages/extension/src/libs/updates-state/index.ts Created UpdatesState class for managing update-related browser storage.
packages/extension/src/libs/updates-state/types.ts Added StorageKeys enum and IState interface.
packages/extension/src/types/provider.ts Added updatesState to InternalStorageNamespace enum.
packages/extension/src/ui/action/App.vue Updated with new update-related state management and UI components.
packages/extension/src/ui/action/icons/updates/ Added new SVG icons for updates (heart.vue, updated.vue).
packages/extension/src/ui/action/types/updates.ts Introduced Version and Updates interfaces.
packages/extension/src/ui/action/utils/browser.ts Added getLatestEnkryptUpdates function.
packages/extension/src/ui/action/views/updates/ New components for updates UI (updates-header.vue, updates-network.vue, index.vue).
packages/extension/package.json Updated version from 2.0.2 to 2.0.3.

Possibly related PRs

  • feat: recent addresses #587: The main PR introduces a new class for managing recently sent addresses, which is related to the changes in the RecentlySentAddressesState class and its integration into various components for tracking recently sent addresses.
  • Devop/amplitude for new network UI #596: This PR enhances the tracking of network selection events, which aligns with the changes in the main PR that also focus on tracking user interactions related to network management.

Suggested reviewers

  • kvhnuke
  • NickKelly1
  • gamalielhere

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

Copy link

github-actions bot commented Jan 9, 2025

💼 Build Files
chrome: enkrypt-chrome-6ef4efc3.zip
firefox: enkrypt-firefox-6ef4efc3.zip

💉 Virus total analysis
chrome: 6ef4efc3
firefox: 6ef4efc3

@olgakup olgakup changed the base branch from main to develop January 11, 2025 00:09
@olgakup olgakup marked this pull request as ready for review January 11, 2025 00:09
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: 4

🧹 Nitpick comments (14)
packages/extension/src/libs/updates-state/types.ts (1)

5-9: Consider using more specific types and modern TypeScript conventions.

A few suggestions for improvement:

  1. Consider using a more specific type for currentReleaseTimestamp such as UnixTimestamp type alias
  2. Modern TypeScript style guides recommend dropping the 'I' prefix for interfaces
-export interface IState {
+export interface State {
   lastVersionViewed: string;
   currentRelease: string;
-  currentReleaseTimestamp: number;
+  currentReleaseTimestamp: UnixTimestamp;
 }
+
+type UnixTimestamp = number;
packages/extension/src/ui/action/types/updates.ts (1)

3-10: Follow TypeScript naming conventions and consider type restrictions.

  1. Property names should use camelCase instead of snake_case to follow TypeScript conventions
  2. Consider using a more specific type for release_date if it follows a specific format
 export interface Version {
   version: string;
   description?: string;
   chains_added?: NetworkNames[];
   swap_added?: NetworkNames[];
-  release_date: string;
-  release_link: string;
+  releaseDate: ISODateString;
+  releaseLink: string;
 }
+
+type ISODateString = string; // e.g. "2024-01-15T00:00:00Z"
packages/extension/src/ui/action/views/updates/components/updates-header.vue (1)

21-53: Consider CSS improvements for maintainability.

  1. Consider extracting magic numbers into CSS variables
  2. The class prefix settings might be too generic, consider something more specific like updates
+:root {
+  --updates-header-height: 68px;
+  --updates-header-padding: 24px 72px 12px 32px;
+  --updates-close-position: 8px;
+}
+
-.settings {
+.updates {
   &__header {
     width: 100%;
-    height: 68px;
+    height: var(--updates-header-height);
     background: @white;
     box-sizing: border-box;
-    padding: 24px 72px 12px 32px;
+    padding: var(--updates-header-padding);
     margin-bottom: 8px;
     // ... rest of the styles
packages/extension/src/libs/metrics/types.ts (1)

56-59: Fix inconsistent string literal casing.

The string literal for logo uses double quotes while settings uses single quotes. Also, consider using more specific values to avoid potential conflicts.

 export enum UpdatesOpenLocation {
-  settings = 'settings',
-  logo = "logo",
+  settings = 'updates_settings',
+  logo = 'updates_logo',
 }
packages/extension/src/ui/action/views/updates/components/updates-network.vue (2)

1-14: LGTM! Well-structured template with proper accessibility.

The template follows good practices with conditional rendering, proper error handling, and BEM naming convention.

Consider providing a default alt text when props.alt is undefined:

-      :alt="props.alt"
+      :alt="props.alt || `${networkName} network icon`"

40-47: Consider preserving the error state

The error handler sets isLoaded to true even when the network fails to load, which might mislead users. Consider setting it to false to indicate the failure state.

  .catch((error: unknown) => {
    console.error(
      `Failed to load image in news for: ${props.networkId}`,
      error,
    );
-    isLoaded.value = true;
+    isLoaded.value = false;
    resolvedImg.value = '';
  });
packages/extension/src/libs/metrics/index.ts (1)

80-87: Maintain code style consistency

The new tracking function should follow the same style as other tracking functions in the file.

 const trackUpdatesEvents = (
   event: UpdatesEventType,
   options: {
     network: NetworkNames;
     location?: UpdatesOpenLocation;
     duration?: number;
-  }) => {
+  }
+ ): void => {
   metrics.track('updatesClick', { event, ...options });
-
 };
packages/extension/src/libs/updates-state/index.ts (2)

38-38: Add missing semicolons for consistency

Maintain consistent use of semicolons across the codebase.

-    return ''
+    return '';
-    return 0
+    return 0;

Also applies to: 52-52


20-26: Simplify state checks with optional chaining

The state checks can be simplified using optional chaining, as suggested by the static analysis.

  async getLastVersionViewed(): Promise<IState['lastVersionViewed']> {
    const state: IState | undefined = await this.getState();
-    if (state && state.lastVersionViewed) {
-      return state.lastVersionViewed;
-    }
-    return '';
+    return state?.lastVersionViewed ?? '';
  }

  async getCurrentRelease(): Promise<IState['currentRelease']> {
    const state: IState | undefined = await this.getState();
-    if (state && state.currentRelease) {
-      return state.currentRelease;
-    }
-    return '';
+    return state?.currentRelease ?? '';
  }

  async getCurrentReleaseTimestamp(): Promise<IState['currentReleaseTimestamp']> {
    const state: IState | undefined = await this.getState();
-    if (state && state.currentReleaseTimestamp) {
-      return state.currentReleaseTimestamp;
-    }
-    return 0;
+    return state?.currentReleaseTimestamp ?? 0;
  }

Also applies to: 33-39, 47-53

🧰 Tools
🪛 Biome (1.9.4)

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

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/extension/src/ui/action/views/updates/index.vue (2)

56-58: Update Twitter reference for consistency.

The link text uses "x.com" but the comment still refers to "Twitter". Consider updating the comment to use "X" consistently.

-            Make sure you follow Enkrypt on Twitter (X....ugh) and let us know
+            Make sure you follow Enkrypt on X and let us know

166-180: Remove duplicate height property.

The height property is defined twice in the updates__wrap class. Remove the duplicate property for better maintainability.

  &__wrap {
    background: @white;
    box-shadow:
      0px 3px 6px rgba(0, 0, 0, 0.039),
      0px 7px 24px rgba(0, 0, 0, 0.19);
    border-radius: 12px;
    box-sizing: border-box;
    width: 460px;
-   height: auto;
    z-index: 107;
    position: relative;
    height: 568px;
    overflow-x: hidden;
    padding-bottom: 16px;
  }
packages/extension/src/ui/action/App.vue (2)

261-263: Extract magic number into a named constant.

The magic number 12096e5 (2 weeks in milliseconds) should be extracted into a named constant for better readability and maintainability.

+const TWO_WEEKS_IN_MS = 12096e5;
+
 const getShowUpdatesBtn = async () => {
   try {
     const lastVersionViewed = await updatesState.getLastVersionViewed();
     if (
       lastVersionViewed === '' ||
       (currentVersion && semverGT(currentVersion, lastVersionViewed))
     ) {
-      const expireTimestamp = stateCurrentReleaseTimestamp.value + 12096e5; //2 weeks;
+      const expireTimestamp = stateCurrentReleaseTimestamp.value + TWO_WEEKS_IN_MS;
       showUpdatesBtn.value =
         stateCurrentReleaseTimestamp.value < expireTimestamp;

267-269: Improve error handling in getShowUpdatesBtn.

The error is only logged to console. Consider setting a default state for showUpdatesBtn in case of error.

   } catch (error) {
     console.error('Failed to get show updates button:', error);
+    showUpdatesBtn.value = false;
   }
packages/extension/src/ui/action/utils/browser.ts (1)

69-69: Remove debug console.log statement.

Remove the console.log statement before production deployment.

-  console.log(fetchUrl)
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8ca8cf0 and cf0c453.

📒 Files selected for processing (14)
  • packages/extension/src/libs/metrics/index.ts (3 hunks)
  • packages/extension/src/libs/metrics/types.ts (1 hunks)
  • packages/extension/src/libs/updates-state/index.ts (1 hunks)
  • packages/extension/src/libs/updates-state/types.ts (1 hunks)
  • packages/extension/src/types/provider.ts (1 hunks)
  • packages/extension/src/ui/action/App.vue (11 hunks)
  • packages/extension/src/ui/action/components/accounts-header/components/header-accounts.vue (1 hunks)
  • packages/extension/src/ui/action/icons/updates/heart.vue (1 hunks)
  • packages/extension/src/ui/action/icons/updates/updated.vue (1 hunks)
  • packages/extension/src/ui/action/types/updates.ts (1 hunks)
  • packages/extension/src/ui/action/utils/browser.ts (2 hunks)
  • packages/extension/src/ui/action/views/updates/components/updates-header.vue (1 hunks)
  • packages/extension/src/ui/action/views/updates/components/updates-network.vue (1 hunks)
  • packages/extension/src/ui/action/views/updates/index.vue (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • packages/extension/src/ui/action/icons/updates/heart.vue
  • packages/extension/src/ui/action/components/accounts-header/components/header-accounts.vue
  • packages/extension/src/ui/action/icons/updates/updated.vue
🧰 Additional context used
🪛 Biome (1.9.4)
packages/extension/src/libs/updates-state/index.ts

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

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


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

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


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

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (2)
packages/extension/src/ui/action/views/updates/components/updates-network.vue (1)

54-73: LGTM! Well-organized styles.

The styles follow BEM naming convention and use flexbox appropriately.

packages/extension/src/types/provider.ts (1)

55-55: LGTM! Consistent enum extension.

The new enum value follows the existing naming pattern and is appropriately placed.

}

async getLastVersionViewed(): Promise<IState['lastVersionViewed']> {
const state: IState | undefined = await this.getState();
Copy link
Contributor

Choose a reason for hiding this comment

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

const state: IState | null = await this.getState();

return '';
}
async setLastVersionViewed(lastVersionViewed: string): Promise<void> {
const state: IState | undefined = await this.getState();
Copy link
Contributor

Choose a reason for hiding this comment

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

const state: IState | null = await this.getState();

packages/extension/src/libs/updates-state/index.ts Outdated Show resolved Hide resolved
packages/extension/src/libs/updates-state/index.ts Outdated Show resolved Hide resolved
packages/extension/src/ui/action/utils/browser.ts Outdated Show resolved Hide resolved
packages/extension/src/ui/action/utils/browser.ts Outdated Show resolved Hide resolved
packages/extension/src/ui/action/views/updates/index.vue Outdated Show resolved Hide resolved
packages/extension/src/ui/action/utils/browser.ts Outdated Show resolved Hide resolved
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: 0

🔭 Outside diff range comments (1)
packages/extension/src/ui/action/views/updates/index.vue (1)

Line range hint 257-273: Add error recovery mechanism in getShowUpdatesBtn.

The error handling could provide a fallback behavior.

 const getShowUpdatesBtn = async () => {
   try {
     const lastVersionViewed = await updatesState.getLastVersionViewed();
     if (
       lastVersionViewed === '' ||
       (currentVersion && semverGT(currentVersion, lastVersionViewed))
     ) {
       const expireTimestamp = stateCurrentReleaseTimestamp.value + 12096e5;
       showUpdatesBtn.value =
         stateCurrentReleaseTimestamp.value < expireTimestamp;
     } else {
       showUpdatesBtn.value = false;
     }
   } catch (error) {
     console.error('Failed to get show updates button:', error);
+    // Fallback to showing the button to ensure users don't miss updates
+    showUpdatesBtn.value = true;
   }
 };
🧹 Nitpick comments (7)
packages/extension/src/ui/action/views/updates/components/updates-network.vue (2)

40-47: Enhance error handling and user feedback.

The error handling could be improved to provide better feedback and recovery options.

Consider this enhancement:

 .catch((error: unknown) => {
+  const errorMessage = error instanceof Error ? error.message : String(error);
   console.error(
-    `Failed to load image in news for: ${props.networkId}`,
+    `Failed to load network data for ${props.networkId}: ${errorMessage}`,
     error,
   );
   isLoaded.value = false;
   resolvedImg.value = '';
+  networkName.value = props.networkId; // Fallback to network ID
 });

54-73: Consider using LESS variables for consistent styling.

The styles could be more maintainable by using variables for common values.

Consider these improvements:

+// Add to theme.less
+@network-icon-size: 24px;
+@network-icon-shadow: 0px 0px 1px rgba(0, 0, 0, 0.16);
+@network-spacing: 8px;

 .news_network {
   &__icon {
-    width: 24px;
-    height: 24px;
+    width: @network-icon-size;
+    height: @network-icon-size;
     background-color: white;
     border-radius: 50%;
-    box-shadow: inset 0px 0px 1px rgba(0, 0, 0, 0.16);
-    margin-right: 8px;
+    box-shadow: inset @network-icon-shadow;
+    margin-right: @network-spacing;
   }
 }
packages/extension/src/libs/updates-state/index.ts (2)

5-10: Add class documentation for better maintainability.

Consider adding JSDoc documentation to describe the class purpose and storage usage.

+/**
+ * Manages the state of application updates using browser storage.
+ * Handles version tracking, release information, and timestamps.
+ */
 class UpdatesState {
   private storage: BrowserStorage;

   constructor() {
     this.storage = new BrowserStorage(InternalStorageNamespace.updatesState);
   }

16-27: Improve type safety in state management.

The state retrieval could be more type-safe.

-  async getState(): Promise<IState> {
+  async getState(): Promise<IState> {
-    const state = this.storage.get(StorageKeys.updatesInfo);
+    const state = await this.storage.get<IState>(StorageKeys.updatesInfo);
     if (!state) {
       const newState: IState = {
         lastVersionViewed: '',
         currentRelease: '',
         currentReleaseTimestamp: 0,
       }
+      await this.setState(newState);
       return newState
     }
     return state;
   }
packages/extension/src/libs/metrics/index.ts (1)

80-87: Add input validation for tracking parameters.

Consider validating the duration parameter to ensure it's a positive number.

 const trackUpdatesEvents = (event: UpdatesEventType, options: {
   network: NetworkNames;
   location?: UpdatesOpenLocation;
   duration?: number;
 }): void => {
+  if (options.duration !== undefined && options.duration < 0) {
+    console.warn('Invalid duration provided to trackUpdatesEvents');
+    options.duration = 0;
+  }
   metrics.track('updatesClick', { event, ...options });
 };
packages/extension/src/ui/action/views/updates/index.vue (1)

7-61: Consider decomposing the template into smaller components.

The template contains repeated patterns that could be extracted into reusable components.

Consider creating these components:

  • UpdateVersionHeader for the version title and timestamp
  • UpdateFeatureSection for the chains/swap sections
  • UpdateFooter for the common footer content
packages/extension/src/ui/action/App.vue (1)

264-267: Extract magic numbers into named constants.

The timestamp calculation uses a magic number that should be extracted into a named constant.

+const TWO_WEEKS_IN_MS = 12096e5;
+
 const getShowUpdatesBtn = async () => {
   try {
     const lastVersionViewed = await updatesState.getLastVersionViewed();
     if (
       lastVersionViewed === '' ||
       (currentVersion && semverGT(currentVersion, lastVersionViewed))
     ) {
-      const expireTimestamp = stateCurrentReleaseTimestamp.value + 12096e5;
+      const expireTimestamp = stateCurrentReleaseTimestamp.value + TWO_WEEKS_IN_MS;
       showUpdatesBtn.value =
         stateCurrentReleaseTimestamp.value < expireTimestamp;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cf0c453 and 4bbff4d.

📒 Files selected for processing (7)
  • packages/extension/src/libs/metrics/index.ts (3 hunks)
  • packages/extension/src/libs/updates-state/index.ts (1 hunks)
  • packages/extension/src/ui/action/App.vue (11 hunks)
  • packages/extension/src/ui/action/utils/browser.ts (2 hunks)
  • packages/extension/src/ui/action/views/updates/components/updates-header.vue (1 hunks)
  • packages/extension/src/ui/action/views/updates/components/updates-network.vue (1 hunks)
  • packages/extension/src/ui/action/views/updates/index.vue (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/extension/src/ui/action/views/updates/components/updates-header.vue
  • packages/extension/src/ui/action/utils/browser.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (2)
packages/extension/src/ui/action/views/updates/components/updates-network.vue (1)

1-14: Well-structured template with proper error handling and accessibility!

The template follows Vue.js best practices with proper conditional rendering, error handling, and accessibility attributes.

packages/extension/src/libs/metrics/index.ts (1)

13-14: Clean type imports following existing patterns!

The new type imports are well-organized and consistent with the codebase structure.

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 (3)
packages/extension/src/ui/action/App.vue (3)

11-15: Consider adding a tooltip to the updated icon.

The updated icon's purpose might not be immediately clear to users. Adding a tooltip would improve user experience.

 <updated-icon
   v-if="loadedUpdates && showUpdatesBtn"
   @click="openUpdatesDialog(UpdatesOpenLocation.logo)"
   class="app__menu-updated"
+  title="New updates available!"
 />

264-264: Extract magic number to a constant.

The 2-week expiration period (12096e5) should be extracted to a named constant for better maintainability and readability.

+const UPDATE_NOTIFICATION_EXPIRY_DAYS = 14;
+const UPDATE_NOTIFICATION_EXPIRY_MS = UPDATE_NOTIFICATION_EXPIRY_DAYS * 24 * 60 * 60 * 1000;
-      const expireTimestamp = stateCurrentReleaseTimestamp.value + 12096e5; //2 weeks;
+      const expireTimestamp = stateCurrentReleaseTimestamp.value + UPDATE_NOTIFICATION_EXPIRY_MS;

737-746: Convert magic numbers to CSS variables.

The brightness values and dimensions should be converted to CSS variables for consistency and maintainability.

+  :root {
+    --updated-icon-height: 24px;
+    --updated-icon-width: 90px;
+    --hover-brightness: 0.9;
+    --default-brightness: 1;
+  }
   &-updated {
-    height: 24px;
-    width: 90px;
+    height: var(--updated-icon-height);
+    width: var(--updated-icon-width);
     cursor: pointer;
     transition: 0.3s;
-    filter: brightness(1);
+    filter: brightness(var(--default-brightness));
     &:hover {
-      filter: brightness(0.9);
+      filter: brightness(var(--hover-brightness));
     }
   }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4bbff4d and 6889a49.

📒 Files selected for processing (2)
  • packages/extension/package.json (1 hunks)
  • packages/extension/src/ui/action/App.vue (11 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/extension/package.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (1)
packages/extension/src/ui/action/App.vue (1)

281-284: Verify metrics implementation.

Let's verify that the metrics tracking is properly implemented for update events.

✅ Verification successful

Metrics implementation verified successfully

The updates tracking is properly implemented with consistent event tracking for both opening and closing updates. The implementation follows the correct pattern using the defined UpdatesEventType enum and trackUpdatesEvents function.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check metrics tracking implementation for updates

# Check for other update event types that should be tracked
rg -A 5 "UpdatesEventType\." --type ts

# Verify metrics handler implementation
ast-grep --pattern 'trackUpdatesEvents($_)'

Length of output: 86


Script:

#!/bin/bash
# Search for UpdatesEventType in all file types
rg "UpdatesEventType" -t vue -t ts -t js

# Look for tracking-related functions and enums
rg "track.*Events.*update" -i -t vue -t ts -t js

# Find enum or const definition related to updates
rg "enum.*Updates|const.*Updates" -t vue -t ts -t js

Length of output: 230


Script:

#!/bin/bash
# Search for UpdatesEventType without file type restriction
rg "UpdatesEventType"

# Look for tracking-related functions and enums
rg "trackUpdatesEvents"

# Find any Updates-related enums or types
rg "type.*Updates|enum.*Updates|const.*Updates"

Length of output: 2362

packages/extension/src/ui/action/App.vue Outdated Show resolved Hide resolved
@YungBS
Copy link

YungBS commented Jan 14, 2025

@olgakup olgakup merged commit 295c15a into develop Jan 14, 2025
4 checks passed
This was referenced Jan 14, 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.

4 participants