Skip to content

License Page New UI #1535

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

Merged
merged 1 commit into from
Feb 19, 2025
Merged

License Page New UI #1535

merged 1 commit into from
Feb 19, 2025

Conversation

SmitGala
Copy link
Contributor

No description provided.

Copy link

coderabbitai bot commented Feb 19, 2025

Walkthrough

This pull request restructures the license detail component. The Handlebars template has been refactored from a table layout to a stack-based design using components such as <AkStack>, <AkTypography>, and <AkChip>. The SCSS has been updated to use new CSS classes for header and body presentation, while the TypeScript file now includes new getters, optional chaining, and an internationalization service injection. Additionally, localization files have received new keys, and the billing dashboard now wraps the license detail component with a <PageWrapper> under specific conditions.

Changes

File(s) Change Summary
app/components/license-detail/index.hbs, index.scss, index.ts Refactored license detail component: updated from table to stack-based layout, modularized structure with <AkStack>, <AkTypography>, and <AkChip>, enhanced with new getters, optional chaining, and internationalization service injection; CSS classes adjusted accordingly.
app/styles/_component-variables.scss Updated license detail SCSS variables: removed old color definitions and added a new background color variable.
app/templates/.../billing.hbs Introduced <PageWrapper> to encapsulate <LicenseDetail> when specific billing conditions are met.
translations/en.json, translations/ja.json Added new localization keys: "feature", "noOfScans", and "planType".

Possibly related PRs

  • refactor service status page #1391: The changes in the main PR, which involve a redesign of the license detail component using <AkStack> and other components, are related to the retrieved PR that also refactors a component's layout to utilize <AkStack> and <AkTable>, indicating a shared approach to modernizing component structures.

Suggested Reviewers

  • future-pirate-king

Poem

I'm a rabbit in the code forest, hopping all around,
Seeing templates and styles so fresh, where new patterns abound.
CSS and TypeScript mix, creating a joyful maze,
With stack-based layouts and updated keys that amaze.
My whiskers twitch with delight, as each change is so neat,
Happy hops through the code, where every fix is a treat!
🥕🐇💻

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm warn config production Use --omit=dev instead.
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @storybook/[email protected]
npm error Found: [email protected]
npm error node_modules/ember-source
npm error dev ember-source@"~5.12.0" from the root project
npm error peer ember-source@">= 3.28.12" from @ember-data/[email protected]
npm error node_modules/@ember-data/tracking
npm error peer @ember-data/tracking@"5.3.9" from @ember-data/[email protected]
npm error node_modules/@ember-data/model
npm error peer @ember-data/model@"5.3.9" from @ember-data/[email protected]
npm error node_modules/@ember-data/debug
npm error @ember-data/debug@"5.3.9" from [email protected]
npm error node_modules/ember-data
npm error 2 more (ember-cli-mirage, ember-data)
npm error peer @ember-data/tracking@"5.3.9" from @ember-data/[email protected]
npm error node_modules/@ember-data/store
npm error peer @ember-data/store@"5.3.9" from @ember-data/[email protected]
npm error node_modules/@ember-data/adapter
npm error @ember-data/adapter@"5.3.9" from [email protected]
npm error node_modules/ember-data
npm error 8 more (@ember-data/debug, @ember-data/graph, ...)
npm error 1 more (ember-data)
npm error 24 more (@ember/render-modifiers, @ember/test-helpers, ...)
npm error
npm error Could not resolve dependency:
npm error peer ember-source@"~3.28.1 || ^4.0.0" from @storybook/[email protected]
npm error node_modules/@storybook/ember
npm error dev @storybook/ember@"8.4.6" from the root project
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/ember-source
npm error peer ember-source@"~3.28.1 || ^4.0.0" from @storybook/[email protected]
npm error node_modules/@storybook/ember
npm error dev @storybook/ember@"8.4.6" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /.npm/_logs/2025-02-19T10_42_32_535Z-eresolve-report.txt
npm error A complete log of this run can be found in: /.npm/_logs/2025-02-19T10_42_32_535Z-debug-0.log


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c81cbe2 and 5eaef1b.

📒 Files selected for processing (7)
  • app/components/license-detail/index.hbs (1 hunks)
  • app/components/license-detail/index.scss (1 hunks)
  • app/components/license-detail/index.ts (2 hunks)
  • app/styles/_component-variables.scss (1 hunks)
  • app/templates/authenticated/dashboard/billing.hbs (1 hunks)
  • translations/en.json (3 hunks)
  • translations/ja.json (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • app/templates/authenticated/dashboard/billing.hbs
  • app/styles/_component-variables.scss
  • app/components/license-detail/index.scss
  • app/components/license-detail/index.hbs
  • app/components/license-detail/index.ts
  • translations/ja.json
  • translations/en.json
⏰ Context from checks skipped due to timeout of 90000ms (13)
  • GitHub Check: Run Integration Tests - Part 8
  • GitHub Check: Run Integration Tests - Part 7
  • GitHub Check: Run Integration Tests - Part 6
  • GitHub Check: Run Integration Tests - Part 5
  • GitHub Check: Run Integration Tests - Part 4
  • GitHub Check: Run Integration Tests - Part 3
  • GitHub Check: Run Integration Tests - Part 2
  • GitHub Check: Run Integration Tests - Part 1
  • GitHub Check: Run Acceptance Tests
  • GitHub Check: Run Unit Tests
  • GitHub Check: Run Linting
  • GitHub Check: Publish to Cloudflare Pages
  • GitHub Check: Cloudflare Pages

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.

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

@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)
app/components/license-detail/index.ts (2)

17-23: Consider adding date format validation.

While the optional chaining is good for null safety, consider adding validation for the date format to handle potential invalid dates.

  get startDate() {
+   const date = this.args.license?.startDate;
+   if (!date || !dayjs(date).isValid()) {
+     return this.intl.t('notAvailable');
+   }
    return dayjs(this.args.license?.startDate).format('DD MMM YYYY');
  }

  get expiryDate() {
+   const date = this.args.license?.expiryDate;
+   if (!date || !dayjs(date).isValid()) {
+     return this.intl.t('notAvailable');
+   }
    return dayjs(this.args.license?.expiryDate).format('DD MMM YYYY');
  }

25-49: Consider extracting feature details into a separate method.

The feturesDetails getter (note the typo in the name) contains complex conditional logic. Consider extracting it into a separate method for better maintainability.

+ private getFeatureDetails(isLimitedScans: boolean) {
+   return isLimitedScans
+     ? [
+         {
+           label: this.intl.t('noOfScans'),
+           value: this.args.license?.perScanQuantity,
+         },
+         {
+           label: this.intl.t('planType'),
+           value: this.args.license?.perScanDescription,
+         },
+       ]
+     : [
+         {
+           label: this.intl.t('noOfApps'),
+           value: this.args.license?.perAppQuantity,
+         },
+         {
+           label: this.intl.t('planType'),
+           value: this.args.license?.perAppDescription,
+         },
+       ];
+ }

- get feturesDetails() {
+ get featureDetails() {
-   if (this.args.license?.isLimitedScans) {
-     return [/*...*/];
-   }
-   return [/*...*/];
+   return this.getFeatureDetails(this.args.license?.isLimitedScans ?? false);
  }
translations/en.json (1)

940-940: New Localization Key: "noOfScans"

The "noOfScans": "No of Scans" entry succinctly communicates a scan count. Verify with the UI/UX team if the phrasing is final—sometimes, "Number of Scans" or "No. of Scans" might be preferred for clarity.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63e9244 and 0f838da.

📒 Files selected for processing (7)
  • app/components/license-detail/index.hbs (1 hunks)
  • app/components/license-detail/index.scss (1 hunks)
  • app/components/license-detail/index.ts (2 hunks)
  • app/styles/_component-variables.scss (1 hunks)
  • app/templates/authenticated/dashboard/billing.hbs (1 hunks)
  • translations/en.json (3 hunks)
  • translations/ja.json (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/templates/authenticated/dashboard/billing.hbs
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Run E2E Tests (5)
  • GitHub Check: Run E2E Tests (4)
  • GitHub Check: Run E2E Tests (3)
  • GitHub Check: Run E2E Tests (2)
  • GitHub Check: Run E2E Tests (1)
  • GitHub Check: Setup & Build Application
  • GitHub Check: Publish to Cloudflare Pages
  • GitHub Check: Setup & Build Application
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (8)
app/components/license-detail/index.hbs (2)

1-20: LGTM! The header section is well structured.

The header layout using AkStack with justified content and aligned items provides a clean and responsive design. The conditional rendering of license type is handled appropriately.


22-42: LGTM! The content section uses a consistent and maintainable pattern.

The use of {{#each}} with AkStack components creates a scalable and maintainable structure for displaying license sections. The consistent spacing and typography enhance readability.

app/components/license-detail/index.ts (2)

1-16: LGTM! Proper type imports and service injection.

The code correctly imports types and injects the intl service for internationalization.


51-81: LGTM! Well-structured license sections getter.

The licenseSections getter provides a clean and maintainable way to organize the license information into sections.

app/components/license-detail/index.scss (1)

1-15: LGTM! Clean and maintainable styles.

The styles are well-organized and use CSS variables for colors and consistent spacing. The use of em units for padding and margin ensures proper scaling.

translations/en.json (2)

471-471: New Localization Key: "feature"

The addition of the "feature": "Feature" key is clear and straightforward. It aligns with the established style for translation values in the file. Please ensure that any UI component referencing this key (likely related to the new license page UI) provides adequate context for translators if needed.


1144-1144: New Localization Key: "planType"

The "planType": "Plan Type" key is a valuable addition to support the new License Page UI elements. Ensure that all components referencing this key consistently follow the same naming conventions across both localization files (e.g., English and Japanese).

app/styles/_component-variables.scss (1)

1999-2002: Update to License Detail Background Color

A new custom property --license-detail-background-color is introduced and set to var(--common-white). This change replaces the previously defined --license-detail-success-light and --license-detail-primary-light variables. Please verify that:

  • The updated variable is consistently used throughout the license detail component as per the new UI design.
  • All references to the now-removed variables have been updated across the codebase to avoid styling inconsistencies.

Copy link

cloudflare-workers-and-pages bot commented Feb 19, 2025

Deploying irenestaging with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5eaef1b
Status: ✅  Deploy successful!
Preview URL: https://1ea7dc27.irenestaging.pages.dev
Branch Preview URL: https://pd-1707-update-license-page.irenestaging.pages.dev

View logs

Copy link

cypress bot commented Feb 19, 2025

Irene    Run #602

Run Properties:  status check failed Failed #602  •  git commit 2affe1b2ac ℹ️: Merge 0f838da7d1bee30d20993fe78d8b9856a67fc480 into 63e9244e8aa4db5fbcc9d5001076...
Project Irene
Branch Review PD-1707-Update-License-Page-UI
Run status status check failed Failed #602
Run duration 07m 34s
Commit git commit 2affe1b2ac ℹ️: Merge 0f838da7d1bee30d20993fe78d8b9856a67fc480 into 63e9244e8aa4db5fbcc9d5001076...
Committer SmitGala
View all properties for this run ↗︎

Test results
Tests that failed  Failures 2
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 1
Tests that passed  Passing 29
View all changes introduced in this branch ↗︎

Tests for review

Failed  upload-app.spec.ts • 1 failed test

View Output

Test Artifacts
Upload App > It successfully uploads an apk file Test Replay Screenshots
Failed  dynamic-scan.spec.ts • 1 failed test

View Output

Test Artifacts
Dynamic Scan > it tests dynamic scan for an apk file: 58062 Test Replay Screenshots

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

🧹 Nitpick comments (1)
app/components/license-detail/index.ts (1)

30-53: Consider adding null checks for optional properties.

While optional chaining is used for accessing properties, the array is still returned even if this.license is null. Consider adding a null check to return an empty array in such cases.

   get featuresDetails() {
+    if (!this.license) {
+      return [];
+    }
+
     if (this.license?.isLimitedScans) {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0f838da and c81cbe2.

📒 Files selected for processing (7)
  • app/components/license-detail/index.hbs (1 hunks)
  • app/components/license-detail/index.scss (1 hunks)
  • app/components/license-detail/index.ts (2 hunks)
  • app/styles/_component-variables.scss (1 hunks)
  • app/templates/authenticated/dashboard/billing.hbs (1 hunks)
  • translations/en.json (3 hunks)
  • translations/ja.json (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • app/templates/authenticated/dashboard/billing.hbs
  • app/components/license-detail/index.scss
  • translations/ja.json
  • app/styles/_component-variables.scss
  • translations/en.json
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Publish to Cloudflare Pages
  • GitHub Check: Setup & Build Application
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (4)
app/components/license-detail/index.hbs (2)

1-20: LGTM! Clean and modern header implementation.

The header section effectively uses modern components and provides clear visual hierarchy with proper spacing.


22-42: LGTM! Well-structured and maintainable body implementation.

The body section effectively uses iteration and modern components to create a clean, maintainable layout. The use of AkDivider provides clear visual separation between sections.

app/components/license-detail/index.ts (2)

1-7: LGTM! Clean imports following previous feedback.

The imports are well-organized and follow the previous review feedback about using direct service import.


17-19: LGTM! License getter added as requested.

The license getter has been added as suggested in the previous review.

@SmitGala SmitGala force-pushed the PD-1707-Update-License-Page-UI branch from c81cbe2 to 5eaef1b Compare February 19, 2025 10:39
Copy link

@Yibaebi Yibaebi merged commit 5e15ce2 into develop Feb 19, 2025
19 checks passed
@future-pirate-king future-pirate-king deleted the PD-1707-Update-License-Page-UI branch February 20, 2025 05:41
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