Skip to content

[WEB-4230] refactor: Analytics code refacor, Removal of nivo charts dependencies and translations#7131

Merged
sriramveeraghanta merged 22 commits intopreviewfrom
analytics-code-splitting
Jun 5, 2025
Merged

[WEB-4230] refactor: Analytics code refacor, Removal of nivo charts dependencies and translations#7131
sriramveeraghanta merged 22 commits intopreviewfrom
analytics-code-splitting

Conversation

@JayashTripathy
Copy link
Copy Markdown
Contributor

@JayashTripathy JayashTripathy commented May 28, 2025

Description

  • Removed old analytics and migrated new analytics in that place
  • Removed all nivo charts dependencies
  • code splitting and refactor of analytics
  • updated translations

Type of Change

  • Code refactoring

Summary by CodeRabbit

  • New Features

    • Introduced a new analytics constants module with structured insight fields and enhanced filter options.
    • Added a TotalInsights component to display key analytics insights with dynamic filtering and localization support.
    • Added CSV export configuration for analytics data.
  • Improvements

    • Replaced fixed analytics labels with dynamic entity placeholders across all supported languages.
    • Updated analytics service with generalized methods for fetching advanced analytics data and charts.
    • Streamlined analytics UI components and hooks to use the updated analytics data structures and services.
    • Updated import paths and component references from analytics-v2 to the new analytics modules.
    • Simplified chart components by switching to new chart implementations and removing redundant legends.
  • Removals

    • Removed legacy analytics-v2 components, custom analytics dashboard, related graphs, and dashboard widgets.
    • Deleted multiple old analytics service files, types, and localization entries related to the deprecated analytics version.
    • Removed various UI graph components and their exports to simplify the codebase.
    • Removed numerous analytics-related components, including project modal, scope and demand views, and profile priority distribution.
  • Refactor

    • Consolidated analytics type definitions and constants for better maintainability.
    • Simplified chart components by switching to new chart implementations and removing redundant legends.
  • Localization

    • Added user role labels ("users", "admins", "guests") in all supported languages.
    • Generalized workspace analytics translation keys to support dynamic entity substitution.
    • Removed obsolete empty state translation blocks for analytics sections.

@JayashTripathy JayashTripathy marked this pull request as draft May 28, 2025 20:19
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented May 28, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

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

Walkthrough

This update removes the "analytics-v2" implementation and consolidates analytics features into a unified, non-versioned analytics module. It refactors constants, types, services, and UI components to use new, streamlined data structures and localization mechanisms. Numerous obsolete files and exports are deleted, and the codebase is updated to reference the new analytics system throughout.

Changes

Files/Groups Change Summary
packages/constants/src/analytics.ts, packages/types/src/analytics-v2.d.ts, packages/services/src/analytics/analytics.service.ts, packages/services/src/analytics/index.ts, web/ce/components/analytics-v2/tabs.ts, web/core/components/analytics-v2/index.ts, web/core/components/analytics/custom-analytics/*, web/core/components/analytics/old-page.tsx, web/core/components/analytics/project-modal/*, web/core/components/analytics/scope-and-demand/*, web/core/components/graphs/issues-by-priority.tsx, web/core/components/dashboard/widgets/issues-by-priority.tsx, web/core/components/dashboard/widgets/issues-by-state-group.tsx, web/core/components/ui/graphs/*, web/core/components/page-views/workspace-dashboard.tsx, web/core/components/profile/overview/priority-distribution/*, web/core/components/dashboard/home-dashboard-widgets.tsx, web/core/components/dashboard/index.ts, web/core/components/ui/index.ts, web/core/components/ui/graphs/index.ts, web/core/components/ui/graphs/bar-graph.tsx, web/core/components/ui/graphs/calendar-graph.tsx, web/core/components/ui/graphs/line-graph.tsx, web/core/components/ui/graphs/pie-graph.tsx, web/core/components/ui/graphs/scatter-plot-graph.tsx, web/core/components/ui/graphs/types.d.ts Deleted all analytics-v2-related files, old analytics dashboard widgets, profile priority distribution components, and graph UI components. Removed exports and re-exports related to these modules.
packages/constants/src/analytics/common.ts Added new analytics constants and types: IInsightField, insightsFields, duration filter options, chart axis values, and date keys.
packages/constants/src/index.ts, packages/types/src/index.d.ts Updated exports to use unified analytics modules instead of v2 versions.
packages/types/src/analytics.d.ts Refactored analytics types: removed detailed v2 interfaces, added generic types, and updated axis value types.
packages/services/src/index.ts Removed export of analytics service barrel file.
packages/i18n/src/locales/*/translations.json Added generic entity labels ("users", "admins", "guests"), replaced hardcoded work item phrases with {entity} placeholders, and removed obsolete empty state blocks in all locales.
web/ce/components/analytics/tabs.ts Added new analytics tab configuration with i18n keys and content components.
web/ce/store/analytics.store.ts Added new analytics store extending base analytics store.
web/core/components/analytics/total-insights.tsx Added new TotalInsights component for displaying insight cards, using new analytics constants and hooks.
web/core/components/analytics/index.ts Consolidated analytics exports to a single overview root export.
web/core/components/analytics/insight-card.tsx Changed data prop type to new unified analytics fields interface.
web/core/components/analytics/insight-table/root.tsx Updated generic type constraints and imports to use new analytics tab types.
web/core/components/analytics/insight-table/data-table.tsx, web/core/components/analytics/empty-state.tsx Updated empty state component and asset paths to match new analytics module; renamed component.
web/core/components/analytics/select/analytics-params.tsx, web/core/components/analytics/select/duration.tsx Renamed select params component and updated references to new constants.
web/core/components/analytics/overview/active-projects.tsx, web/core/components/analytics/overview/project-insights.tsx, web/core/components/analytics/analytics-filter-actions.tsx, web/core/components/analytics/work-items/priority-chart.tsx, web/core/components/analytics/work-items/workitems-insight-table.tsx, web/core/components/analytics/work-items/customized-insights.tsx, web/core/components/analytics/work-items/created-vs-resolved.tsx, web/core/components/analytics/work-items/modal/content.tsx, web/core/components/analytics/work-items/modal/index.tsx, web/core/components/issues/filters.tsx Updated imports, hooks, and service usage to reference new analytics module and types; added isEpic prop where needed.
web/app/(all)/[workspaceSlug]/(projects)/analytics/page.tsx, web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/header.tsx, web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/mobile-header.tsx, web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/issues/(list)/mobile-header.tsx, web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx, web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/mobile-header.tsx Updated import paths for analytics modal and tab components to new locations.
web/core/components/core/sidebar/progress-chart.tsx, web/core/components/cycles/active-cycle/productivity.tsx, web/core/components/modules/analytics-sidebar/issue-progress.tsx, web/ce/components/cycles/analytics-sidebar/base.tsx Removed legend for "ideal" and "current" lines from progress/burndown charts.
web/core/hooks/store/use-analytics-v2.ts, web/core/store/root.store.ts Updated analytics store import paths to new module locations.
web/core/components/dashboard/index.ts, web/core/components/dashboard/widgets/index.ts, web/core/components/graphs/index.ts, web/core/components/page-views/index.ts, web/core/components/profile/overview/priority-distribution/index.ts, web/core/components/ui/graphs/index.ts, web/core/components/ui/index.ts Removed or updated exports to reflect deleted or relocated modules.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TotalInsights
    participant useAnalytics
    participant AnalyticsService
    participant SWR
    participant InsightCard

    User->>TotalInsights: Render with analyticsType, peekView?
    TotalInsights->>useAnalytics: Get filters (duration, projects, etc.)
    TotalInsights->>SWR: Fetch analytics data (keyed by filters)
    SWR->>AnalyticsService: getAdvanceAnalytics(workspaceSlug, analyticsType, filters)
    AnalyticsService-->>SWR: Analytics data
    SWR-->>TotalInsights: Analytics data
    loop For each insight field
        TotalInsights->>InsightCard: Render with data, label, comparisonLabel
    end
Loading

Possibly related PRs

  • makeplane/plane#7005: Introduced an earlier version of insightsFields as simple string arrays; this PR extends that work by refactoring insightsFields to use structured objects with i18n support.

Suggested labels

🧹chore, 🌟improvement

Suggested reviewers

  • sriramveeraghanta

Poem

In fields of insight, data grew,
Old charts and graphs bid us adieu.
With labels fresh and types anew,
Analytics shines in streamlined view.
Translations dance, the code is light—
A rabbit hops in pure delight!
🐇✨📊


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.

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.

@JayashTripathy JayashTripathy changed the title Analytics code splitting and translation fix refactor: Analytics code splitting and translation fix May 28, 2025
@JayashTripathy JayashTripathy marked this pull request as ready for review May 28, 2025 20:21
Copy link
Copy Markdown
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: 8

🧹 Nitpick comments (10)
packages/constants/src/analytics-v2/common.ts (1)

73-94: Consider standardizing the i18n pattern across sections.

The "work-items" section uses specific i18nKeys without i18nProps, while the "overview" section uses a generic "workspace_analytics.total" key with entity substitution. This creates inconsistent translation patterns.

Consider standardizing the approach. For example, you could either:

  1. Use entity substitution consistently (recommended):
 "work-items": [
   {
     key: "total_work_items",
-    i18nKey: "workspace_analytics.total",
+    i18nKey: "workspace_analytics.total",
+    i18nProps: {
+      entity: "common.work_items",
+    },
   },
   {
     key: "started_work_items",
-    i18nKey: "workspace_analytics.started_work_items",
+    i18nKey: "workspace_analytics.started",
+    i18nProps: {
+      entity: "common.work_items",
+    },
   },
   // ... continue pattern for other fields
 ],
  1. Or use specific keys consistently by updating the overview section to use specific keys instead of entity substitution.

The first approach is more maintainable and provides better consistency across the application.

web/core/components/workspace/sidebar/projects-list-item.tsx (1)

365-370: Remove debug console.log statement.

The onClick handler correctly closes the menu when navigating to settings, but the console.log statement should be removed before production.

Apply this diff to remove the debug statement:

 <CustomMenu.MenuItem
   onClick={() => {
-    console.log("clicked settings");
     setIsMenuActive(false);
   }}
 >

The menu state management logic is correct - it properly closes the menu when the user clicks on settings.

packages/i18n/src/locales/it/translations.json (1)

1346-1361:

Details

❓ Verification inconclusive

Dynamic {entity} placeholders in workspace analytics labels
The analytics labels under workspace_analytics now correctly use {entity} for dynamic entity substitution (e.g., "backlog_work_items": "{entity} nel backlog", "total_work_items": "Totale {entity}", etc.). Ensure these placeholder names align exactly with the keys used in your constants and React components, and that the same keys are defined across all locales. Also, consider Italian grammatical agreement: past participles like “iniziati” or “completati” may need gender/number matching depending on the injected entity.

You can run:


🏁 Script executed:

#!/bin/bash
keys=(backlog_work_items started_work_items total_work_items un_started_work_items completed_work_items total)
for key in "${keys[@]}"; do
  echo "Verifying $key:"
  rg -l "\"$key\"" -n packages/i18n/src/locales/*/translations.json || echo "-> Key $key missing in some locale"
done

Length of output: 11705


Uniform placeholder keys across all locales verified

  • Ran the verification script; all of these keys—backlog_work_items, started_work_items, total_work_items, un_started_work_items, completed_work_items and total—are present in every translations.json.
  • No missing definitions detected across any of the 22 locales.

Please perform a manual review of the Italian strings to ensure past participles like “iniziati” and “completati” agree in gender and number with the injected {entity} at runtime.

packages/i18n/src/locales/es/translations.json (1)

1350-1350: Suggest refining the term “backlog” for Spanish readers

The value "{entity} en backlog" retains the English term “backlog.” For a more natural Spanish experience, consider fully translating or adapting this term (e.g., "{entity} en pendientes").

packages/i18n/src/locales/fr/translations.json (1)

869-872: Suggest aligning and grouping new user role keys alphabetically in the “common” section
The keys "users", "admins", and "guests" should be ordered consistently with the surrounding entries, and you may want to group all role-related labels together for easier maintenance. Also verify that these keys match exactly those defined in the English source and other locale files.

packages/i18n/src/locales/zh-CN/translations.json (3)

1348-1348: Verify grammar for backlog_work_items placeholder
The translation "待办的{entity}" parameterizes the entity name (e.g., “任务”) but may read awkwardly in Chinese. Consider whether “待办{entity}” or “未完成的{entity}” better fits the intended meaning after substitution.


1360-1360: Review phrasing for un_started_work_items
The string "未开始的{entity}" parameterizes work items not yet started. Confirm that this phrasing reads naturally in context and consider “尚未开始的{entity}” if it improves clarity.


1362-1363: Clarify dual total translation keys
Both "completed_work_items": "已完成的{entity}" and the generic "total": "{entity}总数" appear here alongside "total_work_items". Please verify each key’s usage in the code and consider consolidating or renaming to avoid redundancy.

packages/i18n/src/locales/ua/translations.json (1)

1349-1364: Ensure dynamic entity placeholder consistency in analytics labels

You’ve updated analytics labels (backlog_work_items, started_work_items, total_work_items, un_started_work_items, completed_work_items, total) to use the {entity} placeholder. Verify that your code supplies an i18nProps object with an entity property when rendering these keys. If the component actually passes a plural form (entityPlural), you’ll need to either rename the placeholder in the JSON to {entityPlural} or adjust the code to map correctly. Consider using ICU pluralization patterns for proper Ukrainian grammatical cases.

packages/i18n/src/locales/pl/translations.json (1)

1349-1364: Use {entity} placeholders for workspace analytics labels
Refactored analytics labels under workspace_analytics (backlog_work_items, started_work_items, total_work_items, un_started_work_items, completed_work_items, and total) to parameterize the entity name. The placement of {entity} appears grammatically correct in Polish.

Ensure that your code passes the correct singular vs. plural form through i18nProps (e.g., entity vs. entityPlural) so these translations render as intended.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 141cb17 and b0b2901.

📒 Files selected for processing (26)
  • packages/constants/src/analytics-v2/common.ts (1 hunks)
  • packages/i18n/src/locales/cs/translations.json (2 hunks)
  • packages/i18n/src/locales/de/translations.json (2 hunks)
  • packages/i18n/src/locales/en/translations.json (2 hunks)
  • packages/i18n/src/locales/es/translations.json (2 hunks)
  • packages/i18n/src/locales/fr/translations.json (2 hunks)
  • packages/i18n/src/locales/id/translations.json (2 hunks)
  • packages/i18n/src/locales/it/translations.json (2 hunks)
  • packages/i18n/src/locales/ja/translations.json (2 hunks)
  • packages/i18n/src/locales/ko/translations.json (2 hunks)
  • packages/i18n/src/locales/pl/translations.json (2 hunks)
  • packages/i18n/src/locales/pt-BR/translations.json (2 hunks)
  • packages/i18n/src/locales/ro/translations.json (2 hunks)
  • packages/i18n/src/locales/ru/translations.json (2 hunks)
  • packages/i18n/src/locales/sk/translations.json (2 hunks)
  • packages/i18n/src/locales/tr-TR/translations.json (2 hunks)
  • packages/i18n/src/locales/ua/translations.json (2 hunks)
  • packages/i18n/src/locales/vi-VN/translations.json (2 hunks)
  • packages/i18n/src/locales/zh-CN/translations.json (2 hunks)
  • packages/i18n/src/locales/zh-TW/translations.json (2 hunks)
  • web/ce/store/analytics-v2.store.ts (1 hunks)
  • web/core/components/analytics-v2/total-insights.tsx (2 hunks)
  • web/core/components/workspace/sidebar/projects-list-item.tsx (1 hunks)
  • web/core/hooks/store/use-analytics-v2.ts (1 hunks)
  • web/core/store/analytics-v2.store.ts (3 hunks)
  • web/core/store/root.store.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
web/ce/store/analytics-v2.store.ts (1)
web/core/store/analytics-v2.store.ts (1)
  • IBaseAnalyticsStoreV2 (8-26)
packages/constants/src/analytics-v2/common.ts (1)
packages/types/src/analytics-v2.d.ts (1)
  • TAnalyticsTabsV2Base (4-4)
🪛 Biome (1.9.4)
web/ce/store/analytics-v2.store.ts

[error] 9-11: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (40)
packages/constants/src/analytics-v2/common.ts (1)

4-12: Well-designed internationalization interface.

The IInsightField interface provides good structure for i18n support with flexible entity substitution through i18nProps.

web/core/hooks/store/use-analytics-v2.ts (1)

5-5: Import path correctly updated for modularization.

The path change from a relative import to the new @/plane-web/store/analytics-v2.store aligns with the analytics store restructuring mentioned in the PR objectives.

web/core/store/root.store.ts (1)

5-5: Import path correctly updated for code splitting.

The import path change aligns with the analytics store modularization and is consistent with other files in this PR.

web/ce/store/analytics-v2.store.ts (1)

3-6: Good architectural pattern for extension points.

The empty interface with explicit ESLint suppression is a clean way to provide an extension point for the CE analytics store. This follows good practices for modular architecture where the base functionality is defined in core and CE can extend as needed.

web/core/store/analytics-v2.store.ts (3)

2-2: Import added for analytics store type.

The EIssuesStoreType import aligns with the analytics refactoring mentioned in the AI summary where components now use store type enums for conditional logic.


8-8: Good refactoring to indicate base interface.

Renaming IAnalyticsStoreV2 to IBaseAnalyticsStoreV2 clearly communicates this is a base interface that other implementations can extend, supporting the modular architecture pattern.


28-28: Excellent use of abstract class pattern.

Making BaseAnalyticsStoreV2 abstract prevents direct instantiation and enforces that concrete implementations must be provided by extending modules (like the CE store). This is a solid architectural improvement.

packages/i18n/src/locales/ko/translations.json (2)

870-873: Good addition of user role translations.

The new Korean translations for "users", "admins", and "guests" support the analytics enhancements where user roles are now displayed with proper localization.


1349-1349: Excellent dynamic entity substitution pattern.

The updated Korean translations now use {entity} placeholders (e.g., "백로그 {entity}", "시작된 {entity}") which enables flexible analytics labels that can dynamically substitute different entity types. This aligns perfectly with the broader internationalization enhancement described in the AI summary.

The pattern is consistent across all affected keys and maintains grammatical correctness in Korean.

Also applies to: 1355-1356, 1361-1361, 1363-1364

packages/i18n/src/locales/zh-TW/translations.json (1)

870-873:

Details

✅ Verification successful

New common translations look accurate – verify consistency across locales

The added "applying", "users", "admins", and "guests" entries in the common section are correct. Please ensure the same keys have been introduced with matching translations in all other locale files to keep the i18n bundles in sync.


🏁 Script executed:

#!/bin/bash
# Verify that new common keys exist across all locales
set -e
for locale in packages/i18n/src/locales/*/translations.json; do
  for key in applying users admins guests; do
    if ! grep -q "\"$key\"" "$locale"; then
      echo "Missing key '$key' in $locale"
      exit 1
    fi
  done
done
echo "All locales contain the new common keys."

Length of output: 9716


All new common translations are present across all locales
Verification confirms that the keys "applying", "users", "admins", and "guests" exist in every translations.json under packages/i18n/src/locales. No further action needed.

packages/i18n/src/locales/it/translations.json (1)

867-871:

Details

✅ Verification successful

New user role keys added to common section
The translation file now includes the new keys applying, users, admins, and guests to support role-based labels. Please verify that these exact keys exist and are translated consistently across all other locale files to avoid missing translations at runtime.

Run this script to ensure presence in all locales:


🏁 Script executed:

#!/bin/bash
for key in applying users admins guests; do
  echo "Checking key: $key"
  rg -l "\"$key\"" -n packages/i18n/src/locales/*/translations.json || echo "-> Missing in some locales"
done

Length of output: 7726


All new role-based translation keys verified across all locales
I ran the suggested script and confirmed that applying, users, admins, and guests appear in every packages/i18n/src/locales/*/translations.json. No missing translations detected.

packages/i18n/src/locales/es/translations.json (2)

871-874: Approve placeholder and role translations

The "applying": "Aplicando" entry and the new role keys ("users", "admins", "guests") correctly map to their Spanish equivalents and align with the updated i18n schema.


1350-1365: Parameterize analytics labels with dynamic {entity} placeholders

The added keys under workspace_analytics"backlog_work_items", "started_work_items", "total_work_items", "un_started_work_items", "completed_work_items", and "total"—all properly leverage the {entity} placeholder to support dynamic translation based on context.

packages/i18n/src/locales/sk/translations.json (2)

870-873: Add user role translations to common section
Added new keys "users", "admins", and "guests" under the common namespace to support role-based labels. These entries align with updates in other locale files.


1349-1364: Parameterize workspace analytics labels with {entity} placeholders
Workspace analytics metrics have been refactored to use {entity} placeholders for dynamic entity names. The Slovak translations correctly reflect this pattern for backlog, started, total, un_started, completed items, and the generic total count.

packages/i18n/src/locales/vi-VN/translations.json (2)

869-873: Approve the addition of common role keys in the common section.

The new translations for "applying", "users", "admins", and "guests" accurately reflect the intended Vietnamese terms and adhere to proper JSON syntax (no trailing commas).


1348-1363: Verify parameterized {entity} placeholders in workspace_analytics.

The updated keys ("backlog_work_items", "started_work_items", "total_work_items", "un_started_work_items", "completed_work_items", and "total") correctly use {entity} for dynamic substitution. Please confirm that when entity is injected (e.g., "Mục công việc"), the resulting phrases maintain proper Vietnamese grammar (e.g., "Mục công việc tồn đọng", "Tổng số Mục công việc").

packages/i18n/src/locales/zh-CN/translations.json (2)

869-872: New common translation keys added
The keys "applying", "users", "admins", and "guests" have been introduced under the common section to support dynamic analytics fields and role labels. Please verify that these keys are also present and correctly translated in all other locale files to maintain consistency across languages.


1354-1355: Check parameterized started_work_items & total_work_items
Translations "已开始的{entity}" and "{entity}总数" align with the new placeholder approach. Ensure these i18n keys match the insightsFields definitions in analytics-v2/common.ts so the labels render correctly.

packages/i18n/src/locales/ua/translations.json (1)

870-873: Verify placement and intent of 'applying' key and user role entries

The new user role keys ("users", "admins", "guests") align with other locales and translations look accurate. However, the "applying" entry sits alongside them—please confirm that this key is meant to be in the common section here and that it’s correctly consumed by the application.

packages/i18n/src/locales/ja/translations.json (1)

869-872: Translations for user roles under common are correct.
The new keys "applying", "users", "admins", and "guests" align with other locales and support the generalization of role labels in the UI.

packages/i18n/src/locales/de/translations.json (2)

868-871: Add common translation keys for user roles
The new keys "users", "admins", and "guests" (alongside "applying") are correctly introduced under the common section with accurate German translations.


1347-1362: Generalize analytics labels using {entity} placeholder
The updated workspace_analytics entries now parameterize the entity name instead of hardcoding “Arbeitselemente.” Ensure that the hyphen in "Backlog-{entity}" aligns with the English source and German grammar, and confirm that components pass the correct i18nProps.entityPlural when rendering these labels.

packages/i18n/src/locales/ro/translations.json (1)

868-871: User role translations look correct.

The added keys under common"users", "admins", and "guests"—accurately map to the intended UI labels. No issues found with the translations themselves.

packages/i18n/src/locales/tr-TR/translations.json (2)

1350-1350: Parameterized analytics labels updated
You've refactored the workspace_analytics section to use the {entity} placeholder for dynamic entity names:

  • backlog_work_items: "Backlog {entity}"
  • started_work_items: "Başlatılan {entity}"
  • total_work_items: "Toplam {entity}"
  • un_started_work_items: "Başlanmamış {entity}"
  • completed_work_items: "Tamamlanmış {entity}"
  • total: "Toplam {entity}"

Please verify:

  1. The ICU placeholder syntax {entity} matches your i18n framework requirements.
  2. The Turkish text remains idiomatic—consider whether “Backlog” should be localized further.
  3. These key names and placeholder patterns are identical across all locale files.

Also applies to: 1356-1357, 1362-1362, 1364-1365


871-874: New common keys for role labels added
You’ve introduced under common:

  • "applying": "Uygulanıyor"
  • "users": "Kullanıcılar"
  • "admins": "Yöneticiler"
  • "guests": "Misafirler"

Ensure:

  1. The key names exactly match those in other locales (case-sensitive).
  2. Their placement groups them logically with related terms.
  3. No duplicates exist elsewhere in this section.
packages/i18n/src/locales/pt-BR/translations.json (2)

870-873: LGTM! New translation keys added correctly.

The new translation keys for "users", "admins", and "guests" have been properly added to the "common" section with accurate Portuguese (Brazil) translations. These additions support the enhanced analytics UI features mentioned in the PR summary.


1349-1364: LGTM! Analytics translations properly parameterized.

The workspace analytics translation keys have been correctly updated to use {entity} placeholders, enabling dynamic entity substitution as described in the AI summary. The Portuguese translations maintain proper grammar and meaning while supporting the flexible analytics features. The parameterization pattern is consistent across all modified keys:

  • Uses {entity} placeholder appropriately
  • Maintains proper Portuguese grammar structure
  • Aligns with the internationalization refactoring goals
packages/i18n/src/locales/en/translations.json (2)

472-474: LGTM! Clean addition of entity labels.

These new common entity labels provide proper internationalization support for the analytics refactoring. The labels follow consistent naming conventions and will enable dynamic entity substitution in the UI components.


1167-1171: Excellent internationalization refactoring.

The parameterization of these analytics labels using {entity} placeholders is a smart approach that:

  • Reduces translation duplication across different entity types
  • Enables dynamic content substitution
  • Follows standard i18n interpolation patterns
  • Improves maintainability for translators

This change aligns well with the new common entity labels added above.

web/core/components/analytics-v2/total-insights.tsx (1)

5-5: Well-structured interface updates.

The addition of the storeType prop with a sensible default value maintains backward compatibility while enabling the new functionality. The import changes properly bring in the required dependencies for the refactoring.

Also applies to: 18-22

packages/i18n/src/locales/id/translations.json (3)

868-868: Inconsistency with AI summary: Undocumented applying key
The AI-generated summary only mentioned new user role keys under "common", but did not call out the addition of the "applying": "Terapkan" entry. Please confirm whether this key is intentional and used by the updated code.

Likely an incorrect or invalid review comment.


869-871: User role translations look correct
The new keys "users", "admins", and "guests" have been added under "common" with appropriate Indonesian translations. They align with the refactored analytics and role-based UI changes.


1347-1354: Analytics labels updated with dynamic {entity} placeholders
The workspace analytics section now correctly defines its labels using {entity} placeholders for dynamic substitution, matching the refactored insightsFields structure. The ICU syntax is valid across keys like "backlog_work_items", "started_work_items", "total_work_items", "un_started_work_items", "completed_work_items", and "total".

Also applies to: 1359-1362

packages/i18n/src/locales/ru/translations.json (2)

870-873:

Details

✅ Verification successful

Ensure user role keys are consistent across locales
You’ve added users, admins, and guests under the common section to support role-based analytics. Please verify that identical keys exist in all other translations.json files to maintain parity across languages.

You can run:


🏁 Script executed:

rg -n '"users":' -n packages/i18n/src/locales/*/translations.json

Length of output: 2391


🏁 Script executed:

#!/bin/bash
rg -n '"admins":' -n packages/i18n/src/locales/*/translations.json
rg -n '"guests":' -n packages/i18n/src/locales/*/translations.json

Length of output: 4808


User role keys are consistent across all locales
I’ve verified that the users, admins, and guests keys appear in every packages/i18n/src/locales/*/translations.json file, matching the entries added to the Russian locale. No further changes are needed.


1349-1364:

Details

❓ Verification inconclusive

Verify dynamic {entity} placeholders in analytics labels
The workspace_analytics section now uses {entity} placeholders in keys like backlog_work_items, started_work_items, total_work_items, un_started_work_items, completed_work_items, and total. Ensure that the updated analytics components supply an entity prop when calling translate(), and that fallback behavior handles missing props without throwing.

To check component usage:

And add a unit test example:

expect(translate('workspace_analytics.backlog_work_items', { entity: 'задачи' }))
  .toEqual('задачи в бэклоге');

🏁 Script executed:

rg -n 'translate(' -n web/core/components/analytics-v2/total-insights.tsx

Length of output: 146


🏁 Script executed:

#!/bin/bash
# Search for translate calls (with placeholders) in analytics-v2 components
rg -n "translate\\(" --glob "*.tsx" web/core/components/analytics-v2

Length of output: 69


Confirm dynamic {entity} in analytics-v2 translations
I wasn’t able to locate any translate(…) or t(…) calls using the workspace_analytics.* keys in web/core/components/analytics-v2. Please verify that:

  • Each analytics-v2 component actually references the new keys (backlog_work_items, started_work_items, total_work_items, un_started_work_items, completed_work_items, total)
  • Every translate() (or t()) invocation supplies an entity value
  • There’s safe fallback behavior (or tests) to prevent runtime errors when entity is missing

Example unit test to add:

expect(
  translate('workspace_analytics.backlog_work_items', { entity: 'задачи' })
).toEqual('задачи в бэклоге');
packages/i18n/src/locales/cs/translations.json (3)

868-868: Verify the translation for "applying".
The Czech string "Používání" may not accurately capture the intended UI context of the English key applying (e.g., applying settings vs usage). Please confirm with the design or translation guidelines to ensure this term fits the user flow.


869-871: Approve new user role translation keys.
The additions

  • "users": "Uživatelé"
  • "admins": "Administrátoři"
  • "guests": "Hosté"
    adhere to Czech pluralization and capitalization conventions consistent with this locale.

1347-1362: Parameterize workspace analytics labels with {entity} placeholders.
The new keys

  • backlog_work_items: "Backlog {entity}"
  • started_work_items: "Zahájené {entity}"
  • total_work_items: "Celkový počet {entity}"
  • un_started_work_items: "Nezahájené {entity}"
  • completed_work_items: "Dokončené {entity}"
  • total: "Celkový počet {entity}"
    enable dynamic entity substitution. Please verify:
  1. Placeholder placement reads naturally in Czech.
  2. The term “Backlog” should remain in English here or be translated per localization standards.
  3. These entries align with other locale files’ patterns.
packages/i18n/src/locales/pl/translations.json (1)

870-873:

Details

✅ Verification successful

Add dynamic entity action and user role labels to common
Introduced "applying", "users", "admins", and "guests" under the common scope to support dynamic role labels in analytics. These align with updates in other locales.

Run this command to confirm all locales are in sync:


🏁 Script executed:

rg -l '"users": "Użytkownicy"' -n packages/i18n/src/locales/*/translations.json

Length of output: 990


🏁 Script executed:

#!/bin/bash
keys=(applying users admins guests)
for key in "${keys[@]}"; do
  echo "=== Checking key: \"${key}\" ==="
  rg -H -n "\"${key}\":" packages/i18n/src/locales/*/translations.json || echo "⚠️ Key '${key}' not found in any locale"
  echo
done

Length of output: 10128


Translations synced across all locales
All four keys—applying, users, admins, and guests—are present in every packages/i18n/src/locales/*/translations.json file.

@JayashTripathy JayashTripathy changed the title refactor: Analytics code splitting and translation fix refactor: Analytics code splitting and translations May 29, 2025
@JayashTripathy JayashTripathy self-assigned this May 29, 2025
@JayashTripathy JayashTripathy marked this pull request as draft May 29, 2025 08:01
@JayashTripathy JayashTripathy removed their assignment May 29, 2025
@sriramveeraghanta
Copy link
Copy Markdown
Member

@JayashTripathy Clean up all the old components which relay on Nivo Charts. Also remove Nivo charts as dependency from the app.

@JayashTripathy JayashTripathy force-pushed the analytics-code-splitting branch from 450edc7 to 1c8628a Compare June 3, 2025 10:31
@JayashTripathy JayashTripathy marked this pull request as ready for review June 3, 2025 10:32
@JayashTripathy JayashTripathy changed the title refactor: Analytics code splitting and translations [WEB-4230] refactor: Analytics code splitting, Removal of nivo charts dependencies and translations Jun 3, 2025
@makeplane
Copy link
Copy Markdown

makeplane bot commented Jun 3, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Copy Markdown
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: 5

🔭 Outside diff range comments (1)
web/core/components/core/sidebar/progress-chart.tsx (1)

19-43: 🛠️ Refactor suggestion

Remove dead code from previous chart implementation.

The styleById object and DashedLine component are no longer used after migrating from LineGraph to AreaChart and should be removed.

-const styleById = {
-  ideal: {
-    strokeDasharray: "6, 3",
-    strokeWidth: 1,
-  },
-  default: {
-    strokeWidth: 1,
-  },
-};
-
-const DashedLine = ({ series, lineGenerator, xScale, yScale }: any) =>
-  series.map(({ id, data, color }: any) => (
-    <path
-      key={id}
-      d={lineGenerator(
-        data.map((d: any) => ({
-          x: xScale(d.data.x),
-          y: yScale(d.data.y),
-        }))
-      )}
-      fill="none"
-      stroke={color ?? "#ddd"}
-      style={styleById[id as keyof typeof styleById] || styleById.default}
-    />
-  ));
-
🧹 Nitpick comments (2)
web/core/components/analytics/total-insights.tsx (1)

50-58: Review grid layout calculation logic

The grid layout uses complex conditional logic based on peek view and the number of insights. The calculation insightsFields[analyticsType].length % 5 === 0 determines whether to use 5 or 4 columns on large screens.

Consider extracting this grid calculation logic into a helper function for better readability:

+const getGridClasses = (analyticsType: TAnalyticsTabsBase, peekView?: boolean) => {
+  if (peekView) return "grid-cols-2";
+  
+  const fieldCount = insightsFields[analyticsType].length;
+  return fieldCount % 5 === 0 
+    ? "gap-10 lg:grid-cols-5" 
+    : "gap-8 lg:grid-cols-4";
+};

  className={cn(
    "grid grid-cols-1 gap-8 sm:grid-cols-2 md:gap-10",
-   !peekView
-     ? insightsFields[analyticsType].length % 5 === 0
-       ? "gap-10 lg:grid-cols-5"
-       : "gap-8 lg:grid-cols-4"
-     : "grid-cols-2"
+   getGridClasses(analyticsType, peekView)
  )}
packages/types/src/analytics.d.ts (1)

26-49: Well-structured type definitions!

The chart and table types are comprehensive and follow good patterns:

  • IChartResponse leverages the generic TChartData type effectively
  • WorkItemInsightColumns captures all necessary work item states
  • AnalyticsTableDataMap provides a clean extensibility pattern

Consider adding JSDoc comments to document the purpose of each interface, especially for WorkItemInsightColumns where the relationship between project__name and display_name might not be immediately clear to other developers.

Example documentation:

+/**
+ * Represents the columns/metrics for work item insights in analytics tables.
+ * @property display_name - Used instead of project__name when displaying in peek view
+ */
 export interface WorkItemInsightColumns {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b0b2901 and 1c8628a.

📒 Files selected for processing (107)
  • packages/constants/src/analytics.ts (0 hunks)
  • packages/constants/src/analytics/common.ts (1 hunks)
  • packages/constants/src/index.ts (1 hunks)
  • packages/i18n/src/locales/cs/translations.json (2 hunks)
  • packages/i18n/src/locales/de/translations.json (3 hunks)
  • packages/i18n/src/locales/en/translations.json (4 hunks)
  • packages/i18n/src/locales/es/translations.json (2 hunks)
  • packages/i18n/src/locales/fr/translations.json (2 hunks)
  • packages/i18n/src/locales/id/translations.json (2 hunks)
  • packages/i18n/src/locales/it/translations.json (2 hunks)
  • packages/i18n/src/locales/ja/translations.json (2 hunks)
  • packages/i18n/src/locales/ko/translations.json (2 hunks)
  • packages/i18n/src/locales/pl/translations.json (2 hunks)
  • packages/i18n/src/locales/pt-BR/translations.json (2 hunks)
  • packages/i18n/src/locales/ro/translations.json (2 hunks)
  • packages/i18n/src/locales/ru/translations.json (2 hunks)
  • packages/i18n/src/locales/sk/translations.json (2 hunks)
  • packages/i18n/src/locales/tr-TR/translations.json (2 hunks)
  • packages/i18n/src/locales/ua/translations.json (2 hunks)
  • packages/i18n/src/locales/vi-VN/translations.json (2 hunks)
  • packages/i18n/src/locales/zh-CN/translations.json (2 hunks)
  • packages/i18n/src/locales/zh-TW/translations.json (2 hunks)
  • packages/services/src/analytics/analytics.service.ts (0 hunks)
  • packages/services/src/analytics/index.ts (0 hunks)
  • packages/services/src/index.ts (0 hunks)
  • packages/types/src/analytics-v2.d.ts (0 hunks)
  • packages/types/src/analytics.d.ts (1 hunks)
  • packages/types/src/index.d.ts (1 hunks)
  • web/app/(all)/[workspaceSlug]/(projects)/analytics/page.tsx (1 hunks)
  • web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/header.tsx (1 hunks)
  • web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/mobile-header.tsx (1 hunks)
  • web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/issues/(list)/mobile-header.tsx (1 hunks)
  • web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx (1 hunks)
  • web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/mobile-header.tsx (1 hunks)
  • web/ce/components/analytics-v2/tabs.ts (0 hunks)
  • web/ce/components/analytics/tabs.ts (1 hunks)
  • web/ce/components/cycles/analytics-sidebar/base.tsx (0 hunks)
  • web/ce/store/analytics.store.ts (1 hunks)
  • web/core/components/analytics-v2/index.ts (0 hunks)
  • web/core/components/analytics/analytics-filter-actions.tsx (1 hunks)
  • web/core/components/analytics/custom-analytics/custom-analytics.tsx (0 hunks)
  • web/core/components/analytics/custom-analytics/graph/custom-tooltip.tsx (0 hunks)
  • web/core/components/analytics/custom-analytics/graph/index.tsx (0 hunks)
  • web/core/components/analytics/custom-analytics/index.ts (0 hunks)
  • web/core/components/analytics/custom-analytics/main-content.tsx (0 hunks)
  • web/core/components/analytics/custom-analytics/select-bar.tsx (0 hunks)
  • web/core/components/analytics/custom-analytics/select/index.ts (0 hunks)
  • web/core/components/analytics/custom-analytics/select/project.tsx (0 hunks)
  • web/core/components/analytics/custom-analytics/select/segment.tsx (0 hunks)
  • web/core/components/analytics/custom-analytics/select/x-axis.tsx (0 hunks)
  • web/core/components/analytics/custom-analytics/select/y-axis.tsx (0 hunks)
  • web/core/components/analytics/custom-analytics/sidebar/index.ts (0 hunks)
  • web/core/components/analytics/custom-analytics/sidebar/projects-list.tsx (0 hunks)
  • web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx (0 hunks)
  • web/core/components/analytics/custom-analytics/sidebar/sidebar.tsx (0 hunks)
  • web/core/components/analytics/custom-analytics/table.tsx (0 hunks)
  • web/core/components/analytics/empty-state.tsx (2 hunks)
  • web/core/components/analytics/index.ts (1 hunks)
  • web/core/components/analytics/insight-card.tsx (1 hunks)
  • web/core/components/analytics/insight-table/data-table.tsx (3 hunks)
  • web/core/components/analytics/insight-table/root.tsx (2 hunks)
  • web/core/components/analytics/old-page.tsx (0 hunks)
  • web/core/components/analytics/overview/active-projects.tsx (2 hunks)
  • web/core/components/analytics/overview/project-insights.tsx (3 hunks)
  • web/core/components/analytics/project-modal/header.tsx (0 hunks)
  • web/core/components/analytics/project-modal/index.ts (0 hunks)
  • web/core/components/analytics/project-modal/main-content.tsx (0 hunks)
  • web/core/components/analytics/project-modal/modal.tsx (0 hunks)
  • web/core/components/analytics/scope-and-demand/demand.tsx (0 hunks)
  • web/core/components/analytics/scope-and-demand/index.ts (0 hunks)
  • web/core/components/analytics/scope-and-demand/leaderboard.tsx (0 hunks)
  • web/core/components/analytics/scope-and-demand/scope-and-demand.tsx (0 hunks)
  • web/core/components/analytics/scope-and-demand/scope.tsx (0 hunks)
  • web/core/components/analytics/scope-and-demand/year-wise-issues.tsx (0 hunks)
  • web/core/components/analytics/select/analytics-params.tsx (2 hunks)
  • web/core/components/analytics/select/duration.tsx (3 hunks)
  • web/core/components/analytics/total-insights.tsx (1 hunks)
  • web/core/components/analytics/work-items/created-vs-resolved.tsx (2 hunks)
  • web/core/components/analytics/work-items/customized-insights.tsx (2 hunks)
  • web/core/components/analytics/work-items/modal/content.tsx (2 hunks)
  • web/core/components/analytics/work-items/modal/index.tsx (2 hunks)
  • web/core/components/analytics/work-items/priority-chart.tsx (6 hunks)
  • web/core/components/analytics/work-items/workitems-insight-table.tsx (2 hunks)
  • web/core/components/core/sidebar/progress-chart.tsx (2 hunks)
  • web/core/components/cycles/active-cycle/productivity.tsx (1 hunks)
  • web/core/components/dashboard/home-dashboard-widgets.tsx (0 hunks)
  • web/core/components/dashboard/index.ts (0 hunks)
  • web/core/components/dashboard/widgets/index.ts (0 hunks)
  • web/core/components/dashboard/widgets/issues-by-priority.tsx (0 hunks)
  • web/core/components/dashboard/widgets/issues-by-state-group.tsx (0 hunks)
  • web/core/components/graphs/index.ts (0 hunks)
  • web/core/components/graphs/issues-by-priority.tsx (0 hunks)
  • web/core/components/issues/filters.tsx (2 hunks)
  • web/core/components/modules/analytics-sidebar/issue-progress.tsx (0 hunks)
  • web/core/components/page-views/index.ts (0 hunks)
  • web/core/components/page-views/workspace-dashboard.tsx (0 hunks)
  • web/core/components/profile/overview/priority-distribution/index.ts (0 hunks)
  • web/core/components/profile/overview/priority-distribution/main-content.tsx (0 hunks)
  • web/core/components/profile/overview/priority-distribution/priority-distribution.tsx (0 hunks)
  • web/core/components/ui/graphs/bar-graph.tsx (0 hunks)
  • web/core/components/ui/graphs/calendar-graph.tsx (0 hunks)
  • web/core/components/ui/graphs/index.ts (0 hunks)
  • web/core/components/ui/graphs/line-graph.tsx (0 hunks)
  • web/core/components/ui/graphs/pie-graph.tsx (0 hunks)
  • web/core/components/ui/graphs/scatter-plot-graph.tsx (0 hunks)
  • web/core/components/ui/graphs/types.d.ts (0 hunks)
  • web/core/components/ui/index.ts (0 hunks)
💤 Files with no reviewable changes (56)
  • web/core/components/profile/overview/priority-distribution/index.ts
  • packages/services/src/index.ts
  • web/core/components/ui/index.ts
  • web/core/components/page-views/index.ts
  • web/core/components/modules/analytics-sidebar/issue-progress.tsx
  • web/core/components/graphs/index.ts
  • packages/services/src/analytics/index.ts
  • web/core/components/dashboard/index.ts
  • web/ce/components/cycles/analytics-sidebar/base.tsx
  • web/core/components/analytics-v2/index.ts
  • web/core/components/dashboard/widgets/index.ts
  • web/core/components/analytics/custom-analytics/sidebar/index.ts
  • web/core/components/analytics/custom-analytics/select/index.ts
  • web/core/components/analytics/project-modal/index.ts
  • web/core/components/analytics/scope-and-demand/index.ts
  • web/ce/components/analytics-v2/tabs.ts
  • web/core/components/analytics/custom-analytics/select/project.tsx
  • web/core/components/profile/overview/priority-distribution/priority-distribution.tsx
  • web/core/components/ui/graphs/scatter-plot-graph.tsx
  • web/core/components/analytics/project-modal/header.tsx
  • web/core/components/analytics/scope-and-demand/demand.tsx
  • web/core/components/ui/graphs/types.d.ts
  • web/core/components/ui/graphs/line-graph.tsx
  • web/core/components/analytics/custom-analytics/table.tsx
  • web/core/components/ui/graphs/index.ts
  • web/core/components/profile/overview/priority-distribution/main-content.tsx
  • web/core/components/analytics/custom-analytics/main-content.tsx
  • web/core/components/analytics/scope-and-demand/year-wise-issues.tsx
  • web/core/components/page-views/workspace-dashboard.tsx
  • web/core/components/analytics/custom-analytics/custom-analytics.tsx
  • web/core/components/ui/graphs/pie-graph.tsx
  • web/core/components/ui/graphs/calendar-graph.tsx
  • web/core/components/analytics/custom-analytics/select-bar.tsx
  • packages/types/src/analytics-v2.d.ts
  • web/core/components/analytics/project-modal/main-content.tsx
  • web/core/components/analytics/scope-and-demand/leaderboard.tsx
  • web/core/components/dashboard/widgets/issues-by-priority.tsx
  • packages/constants/src/analytics.ts
  • web/core/components/ui/graphs/bar-graph.tsx
  • web/core/components/analytics/custom-analytics/select/segment.tsx
  • web/core/components/analytics/custom-analytics/sidebar/projects-list.tsx
  • web/core/components/analytics/old-page.tsx
  • web/core/components/analytics/project-modal/modal.tsx
  • web/core/components/dashboard/home-dashboard-widgets.tsx
  • web/core/components/analytics/scope-and-demand/scope-and-demand.tsx
  • web/core/components/analytics/custom-analytics/select/y-axis.tsx
  • web/core/components/analytics/custom-analytics/graph/index.tsx
  • web/core/components/dashboard/widgets/issues-by-state-group.tsx
  • web/core/components/analytics/custom-analytics/graph/custom-tooltip.tsx
  • web/core/components/analytics/custom-analytics/index.ts
  • web/core/components/graphs/issues-by-priority.tsx
  • web/core/components/analytics/custom-analytics/sidebar/sidebar.tsx
  • web/core/components/analytics/scope-and-demand/scope.tsx
  • packages/services/src/analytics/analytics.service.ts
  • web/core/components/analytics/custom-analytics/select/x-axis.tsx
  • web/core/components/analytics/custom-analytics/sidebar/sidebar-header.tsx
✅ Files skipped from review due to trivial changes (22)
  • web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/mobile-header.tsx
  • web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/header.tsx
  • web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/mobile-header.tsx
  • web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/issues/(list)/mobile-header.tsx
  • packages/constants/src/index.ts
  • web/core/components/analytics/work-items/workitems-insight-table.tsx
  • packages/types/src/index.d.ts
  • web/app/(all)/[workspaceSlug]/(projects)/analytics/page.tsx
  • web/core/components/analytics/work-items/modal/content.tsx
  • web/core/components/cycles/active-cycle/productivity.tsx
  • web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx
  • web/core/components/analytics/insight-table/data-table.tsx
  • web/ce/components/analytics/tabs.ts
  • web/ce/store/analytics.store.ts
  • web/core/components/analytics/insight-table/root.tsx
  • web/core/components/analytics/select/duration.tsx
  • web/core/components/analytics/overview/project-insights.tsx
  • web/core/components/analytics/empty-state.tsx
  • packages/i18n/src/locales/ua/translations.json
  • packages/i18n/src/locales/tr-TR/translations.json
  • packages/constants/src/analytics/common.ts
  • packages/i18n/src/locales/cs/translations.json
🚧 Files skipped from review as they are similar to previous changes (15)
  • packages/i18n/src/locales/sk/translations.json
  • packages/i18n/src/locales/zh-TW/translations.json
  • packages/i18n/src/locales/vi-VN/translations.json
  • packages/i18n/src/locales/zh-CN/translations.json
  • packages/i18n/src/locales/it/translations.json
  • packages/i18n/src/locales/fr/translations.json
  • packages/i18n/src/locales/id/translations.json
  • packages/i18n/src/locales/de/translations.json
  • packages/i18n/src/locales/ro/translations.json
  • packages/i18n/src/locales/ja/translations.json
  • packages/i18n/src/locales/es/translations.json
  • packages/i18n/src/locales/ru/translations.json
  • packages/i18n/src/locales/pt-BR/translations.json
  • packages/i18n/src/locales/en/translations.json
  • packages/i18n/src/locales/pl/translations.json
🧰 Additional context used
🧬 Code Graph Analysis (6)
web/core/components/analytics/overview/active-projects.tsx (1)
web/core/hooks/store/use-analytics.ts (1)
  • useAnalytics (7-11)
web/core/components/analytics/analytics-filter-actions.tsx (1)
web/core/hooks/store/use-analytics.ts (1)
  • useAnalytics (7-11)
web/core/components/analytics/insight-card.tsx (1)
packages/types/src/analytics.d.ts (1)
  • IAnalyticsResponseFields (13-16)
web/core/components/analytics/work-items/modal/index.tsx (1)
web/core/hooks/store/use-analytics.ts (1)
  • useAnalytics (7-11)
web/core/components/analytics/select/analytics-params.tsx (2)
packages/types/src/analytics.d.ts (1)
  • IAnalyticsParams (51-55)
packages/constants/src/analytics/common.ts (2)
  • ANALYTICS_X_AXIS_VALUES (116-165)
  • ANALYTICS_Y_AXIS_VALUES (167-176)
packages/types/src/analytics.d.ts (1)
packages/types/src/charts/index.d.ts (1)
  • TChartData (21-24)
🔇 Additional comments (29)
web/core/components/core/sidebar/progress-chart.tsx (1)

61-99: Chart migration looks good!

The migration from LineGraph to AreaChart is implemented correctly with appropriate area configurations, axis labels, and legend styling. This aligns well with the PR objective of removing Nivo chart dependencies.

web/core/components/analytics/overview/active-projects.tsx (1)

9-9:

Details

✅ Verification successful

LGTM! Analytics hook migration completed correctly.

The migration from useAnalyticsV2 to useAnalytics is consistent and maintains the same functionality. The component only uses selectedDurationLabel from the analytics store.

Verify that the useAnalytics hook provides the same interface as useAnalyticsV2, specifically that selectedDurationLabel is available:

Also applies to: 18-18


🏁 Script executed:

#!/bin/bash
# Description: Verify that selectedDurationLabel is available in the analytics store interface

# Search for selectedDurationLabel usage in analytics store or interface definitions
rg -A 5 -B 5 "selectedDurationLabel" --type ts

Length of output: 10489


Approve Analytics Hook Migration

Confirmed that selectedDurationLabel is exposed by the useAnalytics hook (see analytics.store.ts), so the change from useAnalyticsV2 to useAnalytics maintains full compatibility. No further action required.

web/core/components/issues/filters.tsx (2)

20-20: Analytics import path updated correctly.

The import path change from ../analytics-v2/work-items/modal to ../analytics/work-items/modal aligns with the broader migration from analytics-v2 to the original analytics implementation.


104-104:

Details

✅ Verification successful

New isEpic prop added appropriately.

The addition of the isEpic prop to the WorkItemsModal component is well-implemented, using a logical comparison with EIssuesStoreType.EPIC to determine the boolean value.

Verify that the WorkItemsModal component accepts the new isEpic prop:


🏁 Script executed:

#!/bin/bash
# Description: Verify WorkItemsModal component accepts isEpic prop

# Search for the WorkItemsModal component definition and its props interface
ast-grep --pattern $'interface $_ {
  $$$
  isEpic: $_
  $$$
}'

# Also search for the component definition
rg -A 10 "WorkItemsModal.*=.*\(" --type tsx --type ts

Length of output: 148


🏁 Script executed:

#!/bin/bash
# 1. Locate any file names containing WorkItemsModal
echo "🔍 Searching for files named *WorkItemsModal*.tsx or *.ts"
rg --files | grep -E 'WorkItemsModal.*\.(tsx|ts)$' || echo "No matching filenames found"

# 2. Search for the component declaration in those files
echo "🔍 Inspecting component definition in matching files"
rg -n "const WorkItemsModal" -g "*WorkItemsModal*.{tsx,ts}" || rg -n "function WorkItemsModal" -g "*WorkItemsModal*.{tsx,ts}" || echo "No component declaration found"

# 3. Look for Props interface or type alias in the component file(s)
echo "🔍 Checking for Props interface or type alias"
rg -n -e "interface .*Props" -g "*WorkItemsModal*.{tsx,ts}" || rg -n -e "type .*Props" -g "*WorkItemsModal*.{tsx,ts}" || echo "No Props definition found"

# 4. Verify that 'isEpic' appears in the props definition or destructuring
echo "🔍 Verifying presence of 'isEpic' in props"
rg -n "isEpic" -g "*WorkItemsModal*.{tsx,ts}" || echo "'isEpic' not found in component source"

Length of output: 1821


🏁 Script executed:

#!/bin/bash
# 1. Broad search for WorkItemsModal across all files (ignoring .gitignore)
echo "🔍 Searching across all files for 'WorkItemsModal'"
rg -n -uu "WorkItemsModal" || echo "No references to 'WorkItemsModal' found"

# 2. Check for any export of WorkItemsModal
echo "🔍 Looking for export declarations of 'WorkItemsModal'"
rg -n -uu "export.*WorkItemsModal" || echo "No export of 'WorkItemsModal' found"

# 3. List all modal-related TS/TSX files to locate potential naming differences
echo "🔍 Listing all modal-related TS/TSX files"
fd -I -e tsx -e ts "*Modal*"

Length of output: 3665


🏁 Script executed:

#!/bin/bash
# Locate the Props definition in WorkItemsModal
echo "🔍 Searching for Props interface or type alias in modal/index.tsx"
rg -n -C3 "interface Props" web/core/components/analytics/work-items/modal/index.tsx \
  || rg -n -C3 "type Props" web/core/components/analytics/work-items/modal/index.tsx

# Verify if 'isEpic' appears in the Props definition or anywhere in the file
echo "🔍 Checking for 'isEpic' occurrences in modal/index.tsx"
rg -n "isEpic" web/core/components/analytics/work-items/modal/index.tsx

Length of output: 917


Verification Complete: WorkItemsModal Accepts isEpic Prop

Confirmed that in web/core/components/analytics/work-items/modal/index.tsx the Props type includes:

  • isEpic?: boolean; (line 17)
  • destructuring and usage of isEpic in the component (lines 21–31)

No further changes required—isEpic is properly declared and consumed.

web/core/components/analytics/analytics-filter-actions.tsx (1)

5-5:

Details

✅ Verification successful

Analytics hook migration implemented correctly.

The migration from useAnalyticsV2 to useAnalytics maintains the same destructured properties and functionality. The import is now more specific, referencing the exact hook file.

Verify that all required properties are available in the analytics store interface:

Also applies to: 11-11


🏁 Script executed:

#!/bin/bash
# Description: Verify analytics store interface contains required properties

# Search for the analytics store interface definition
rg -A 20 "interface.*AnalyticsStore" --type ts

# Search for specific properties used in this component
rg -A 3 -B 3 "selectedProjects|selectedDuration|updateSelectedProjects|updateSelectedDuration" --type ts

Length of output: 37005


Analytics hook migration compatibility confirmed

All destructured properties in analytics-filter-actions.tsx are defined on IBaseAnalyticsStore in web/core/store/analytics.store.ts:

  • selectedProjects: string[]
  • selectedDuration: DurationType
  • updateSelectedProjects(projects: string[]): void
  • updateSelectedDuration(duration: DurationType): void

No changes required—approving the migration.

web/core/components/analytics/insight-card.tsx (1)

3-3: Type interface migration completed successfully.

The migration from IAnalyticsResponseFieldsV2 to IAnalyticsResponseFields is appropriate and maintains compatibility. Based on the relevant code snippet, IAnalyticsResponseFields contains the required count and filter_count properties that the component uses.

Also applies to: 9-9

web/core/components/analytics/index.ts (1)

1-1: LGTM: Clean consolidation of analytics exports

The consolidation from multiple separate exports to a single root export aligns well with the analytics refactor objectives, simplifying the module structure.

web/core/components/analytics/work-items/customized-insights.tsx (3)

7-7: Good: Consistent analytics type migration

The import change from IAnalyticsV2Params to IAnalyticsParams is consistent with the broader analytics refactor.


11-11: Good: Component import aligned with analytics migration

The change from AnalyticsV2SelectParams to AnalyticsSelectParams correctly follows the analytics consolidation pattern.


22-22: Good: Type consistency maintained

The useForm hook and component usage consistently use the updated IAnalyticsParams type and AnalyticsSelectParams component.

Also applies to: 40-40

web/core/components/analytics/work-items/modal/index.tsx (3)

1-1: Good: Proper imports for analytics integration

The addition of useEffect and useAnalytics imports supports the new analytics state management functionality.

Also applies to: 6-6


17-17: Good: Clean analytics integration

The isEpic prop addition and useAnalytics hook integration properly connect the modal to the analytics state management.

Also applies to: 21-22


29-31: Good: Proper useEffect implementation

The useEffect correctly updates the analytics state when the isEpic prop changes, with appropriate dependencies and default value handling.

packages/i18n/src/locales/ko/translations.json (2)

872-874: Good: User role labels added

The addition of "users", "admins", and "guests" labels supports the enhanced analytics interface with user role categorization.


1339-1339: Good: Consistent entity parameterization

The replacement of fixed "작업 항목" (work items) with {entity} placeholder enables dynamic entity substitution in analytics labels, supporting the generalized analytics implementation.

Also applies to: 1345-1346, 1351-1351, 1353-1354

web/core/components/analytics/work-items/created-vs-resolved.tsx (2)

8-8: LGTM: Clean migration from v2 to v1 analytics

The import updates consistently remove the "V2" suffix from all analytics-related imports. The types, hooks, services, and components are all properly updated to use the unified analytics implementation.

Also applies to: 11-11, 14-14, 17-17, 20-20


31-41:

Details

✅ Verification successful

Verify service method signature compatibility

The API call has been updated to use the non-v2 service. Ensure that getAdvanceAnalyticsCharts<IChartResponse> has the same method signature and parameters as the previous v2 implementation.


🏁 Script executed:

#!/bin/bash
# Description: Verify the AnalyticsService method signature matches expected interface
# Expected: getAdvanceAnalyticsCharts method should exist with compatible signature

# Search for the service method definition
ast-grep --pattern 'class AnalyticsService {
  $$$
  getAdvanceAnalyticsCharts($$$) {
    $$$
  }
  $$$
}'

# Also search for any interface definitions
rg -A 10 "getAdvanceAnalyticsCharts"

Length of output: 4245


Service method signature verified

The getAdvanceAnalyticsCharts definition in web/core/services/analytics.service.ts is:

async getAdvanceAnalyticsCharts<T>(
  workspaceSlug: string,
  tab: TAnalyticsGraphsBase,
  params?: Record<string, any>,
  isPeekView?: boolean
): Promise<T> {  }

which exactly matches how it’s invoked in created-vs-resolved.tsx. No further changes are needed.

web/core/components/analytics/select/analytics-params.tsx (3)

6-6: LGTM: Proper import updates for unified analytics

The imports correctly reference the new unified analytics constants and types. The relevant code snippets confirm that ANALYTICS_X_AXIS_VALUES, ANALYTICS_Y_AXIS_VALUES, and IAnalyticsParams are properly defined in the new analytics module.

Also applies to: 8-8


22-22: Good: Component renamed to match new analytics paradigm

The component name change from AnalyticsV2SelectParams to AnalyticsSelectParams properly reflects the removal of the versioned analytics implementation.


25-25: Verify constants structure compatibility

The component logic remains unchanged but now uses the new constants. Based on the relevant code snippets, the new constants appear to have the same structure (arrays of objects with value and label properties), which is good for compatibility.

Also applies to: 29-29, 45-45

web/core/components/analytics/work-items/priority-chart.tsx (4)

11-12: LGTM: Consistent analytics migration pattern

All analytics-related imports have been properly updated to use the unified analytics implementation. The pattern is consistent with the other migrated files.

Also applies to: 21-21, 28-28, 30-31


135-135: Good: Consistent constants usage for axis labels

The axis label lookup logic correctly uses the new unified constants. This maintains the same functionality while using the updated constants structure.

Also applies to: 139-139


60-71:

Details

✅ Verification successful

Verify service method call compatibility

The service call has been updated to use analyticsService.getAdvanceAnalyticsCharts<TChart> instead of the v2 version. The parameters appear to be the same structure, but ensure the method signature is compatible.


🏁 Script executed:

#!/bin/bash
# Description: Verify that the analytics service methods support the TChart type parameter
# Expected: Method should accept TChart as generic type parameter

# Search for service method definitions that accept generic types
ast-grep --pattern 'getAdvanceAnalyticsCharts<$_>($_) {
  $$$
}'

# Check for TChart type definition
rg -A 5 "type TChart|interface TChart"

Length of output: 2358


🏁 Script executed:

#!/bin/bash
# Locate the definition of getAdvanceAnalyticsCharts to verify its generic signature
rg -n "getAdvanceAnalyticsCharts" -A5

Length of output: 2420


Service method signature correctly supports the generic TChart

Verified that in web/core/services/analytics.service.ts lines 53–58, getAdvanceAnalyticsCharts is declared to accept a generic type parameter and return Promise. Since TChart is a valid exported type, the call in priority-chart.tsx is fully compatible—no changes needed.


240-242:

Details

✅ Verification successful

Verify customized insights translation keys

The empty state uses new translation keys for customized insights. Ensure these keys exist and follow the new translation structure with parameterized entities.


🏁 Script executed:

#!/bin/bash
# Description: Verify customized insights translation keys exist
# Expected: Keys should exist in translation files

# Search for customized insights translation keys
rg "workspace_analytics\.empty_state\.customized_insights" --type json

# Verify the translation structure in the analytics context
rg "customized_insights" --type json -A 3 -B 3

Length of output: 22144


I’d like to confirm how the "workspace_analytics" namespace is defined and where its translations live.


🏁 Script executed:

#!/bin/bash
# 1. Look for a JSON namespace for workspace_analytics
rg '"workspace_analytics"' --type json -n packages/i18n/src

# 2. See if there’s a dedicated translations file for that namespace
fd -t f workspace_analytics packages/i18n/src

# 3. Check the component to see which namespace useTranslation is using
rg 'useTranslation' -n -A 3 -B 3 web/core/components/analytics/work-items/priority-chart.tsx

Length of output: 2469


✅ Confirmed: workspace_analytics.empty_state.customized_insights Keys Exist

I’ve searched all locale files and verified that under the workspace_analytics.empty_state.customized_insights namespace both the title and description keys are defined across every supported language. No missing or malformed entries were found.

web/core/components/analytics/total-insights.tsx (3)

34-47: Good: Proper SWR data fetching with comprehensive filtering

The data fetching correctly includes all relevant filters (projects, cycles, modules) and uses proper SWR caching keys. The API call structure matches the expected analytics service interface.


5-5:

Details

✅ Verification successful

Verify insightsFields constant structure

The component relies on insightsFields[analyticsType] to determine the grid layout and render insights. Ensure this constant is properly structured with the expected properties (key, i18nKey, i18nProps).

Also applies to: 16-16


🏁 Script executed:

#!/bin/bash
# Description: Verify insightsFields constant structure and analytics types
# Expected: insightsFields should be an object with analyticsType keys and array values

# Search for insightsFields definition
ast-grep --pattern 'export const insightsFields = $_'

# Check the structure and available analytics types
rg -A 20 "insightsFields" | head -30

Length of output: 2276


InsightsFields constant structure is valid

  • Verified in packages/constants/src/analytics/common.ts that insightsFields is defined as Record<TAnalyticsTabsBase, IInsightField[]>.
  • Each analytics type (e.g., overview) maps to an array of objects containing key, i18nKey, and i18nProps as expected.

No changes required.


65-74:

Details

❓ Verification inconclusive

Verify complex translation logic

The conditional translation logic handles different entity types (epics vs work items) and uses parameterized translation keys. This is sophisticated but ensure the translation keys and structure are correct.


🏁 Script executed:

#!/bin/bash
# Description: Verify translation keys and entity parameters work correctly
# Expected: Translation keys should support entity parameters

# Check for work-items analytics type and related translations
rg "work-items" --type json

# Verify entity parameter usage in translations
rg "entity.*epics|entity.*work_items" --type json

# Check insightsFields i18nKey and i18nProps structure
rg -A 5 "i18nKey.*entity|i18nProps.*entity"

Length of output: 993


Ensure translation keys exist in localization files

I couldn’t find matching entries for the keys used in this snippet (lines 65–74 of web/core/components/analytics/total-insights.tsx):

label={
  analyticsType === "work-items"
    ? isEpic
      ? t(item.i18nKey, { entity: t("common.epics") })
      : t(item.i18nKey, { entity: t("common.work_items") })
    : t(item.i18nKey, {
        ...item.i18nProps,
        entity: item.i18nProps?.entity && t(item.i18nProps?.entity),
      })
}

• Verify that common.epics, common.work_items and any keys from item.i18nProps.entity are defined in your JSON locale files (e.g. public/locales/en/common.json).
• Update either the translation JSON or the code to keep the key names in sync and avoid missing translations.

packages/types/src/analytics.d.ts (2)

1-2: LGTM! Clean import structure.

The imports align well with the refactored analytics system, properly utilizing the new constants structure for chart axis properties.


51-55: Clean parameter interface design!

The IAnalyticsParams interface effectively uses the imported axis types and maintains consistency by using ChartXAxisProperty for both x_axis and group_by parameters.

@JayashTripathy JayashTripathy changed the title [WEB-4230] refactor: Analytics code splitting, Removal of nivo charts dependencies and translations [WEB-4230] refactor: Analytics code refacor, Removal of nivo charts dependencies and translations Jun 3, 2025
Copy link
Copy Markdown
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: 1

♻️ Duplicate comments (1)
web/core/components/core/sidebar/progress-chart.tsx (1)

14-18: ⚠️ Potential issue

Fix the division by zero issue that persists from previous reviews.

The division by zero issue mentioned in previous reviews still exists. When the distribution has only one entry, the calculation (Object.keys(distribution ?? []).length - 1) results in zero, causing division by zero.

Additionally, Object.keys(distribution ?? []) is called twice which impacts performance. Consider this optimization:

- const chartData: TChartData<string, string>[] = Object.keys(distribution ?? []).map((key, index) => ({
-   name: renderFormattedDateWithoutYear(key),
-   current: distribution[key] ?? 0,
-   ideal: totalIssues * (1 - index / (Object.keys(distribution ?? []).length - 1)),
- }));
+ const distributionKeys = Object.keys(distribution ?? []);
+ const chartData: TChartData<string, string>[] = distributionKeys.map((key, index) => ({
+   name: renderFormattedDateWithoutYear(key),
+   current: distribution[key] ?? 0,
+   ideal: distributionKeys.length > 1 
+     ? totalIssues * (1 - index / (distributionKeys.length - 1))
+     : totalIssues,
+ }));
🧹 Nitpick comments (3)
web/core/services/analytics.service.ts (3)

10-26: Consider method naming and parameter consistency.

Two observations:

  1. The method name "getAdvanceAnalytics" should likely be "getAdvancedAnalytics" for grammatical correctness.
  2. This method uses tab as a parameter key, while getAdvanceAnalyticsStats and getAdvanceAnalyticsCharts use type: tab. Consider standardizing the parameter naming across all methods.
-  async getAdvanceAnalytics<T extends IAnalyticsResponse>(
+  async getAdvancedAnalytics<T extends IAnalyticsResponse>(
     workspaceSlug: string,
     tab: TAnalyticsTabsBase,
     params?: Record<string, any>,
     isPeekView?: boolean
   ): Promise<T> {
-    return this.get(this.processUrl<TAnalyticsTabsBase>("advance-analytics", workspaceSlug, tab, params, isPeekView), {
+    return this.get(this.processUrl<TAnalyticsTabsBase>("advanced-analytics", workspaceSlug, tab, params, isPeekView), {
       params: {
-        tab,
+        type: tab,
         ...params,
       },
     })

28-51: Fix method naming for grammatical correctness.

The method name "getAdvanceAnalyticsStats" should be "getAdvancedAnalyticsStats" for grammatical correctness.

-  async getAdvanceAnalyticsStats<T>(
+  async getAdvancedAnalyticsStats<T>(

53-76: Fix method naming for grammatical correctness.

The method name "getAdvanceAnalyticsCharts" should be "getAdvancedAnalyticsCharts" for grammatical correctness.

-  async getAdvanceAnalyticsCharts<T>(
+  async getAdvancedAnalyticsCharts<T>(
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1c8628a and aeca794.

📒 Files selected for processing (5)
  • web/ce/components/cycles/analytics-sidebar/base.tsx (0 hunks)
  • web/core/components/core/sidebar/progress-chart.tsx (1 hunks)
  • web/core/components/cycles/active-cycle/productivity.tsx (1 hunks)
  • web/core/components/modules/analytics-sidebar/issue-progress.tsx (0 hunks)
  • web/core/services/analytics.service.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • web/core/components/modules/analytics-sidebar/issue-progress.tsx
  • web/ce/components/cycles/analytics-sidebar/base.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/core/components/cycles/active-cycle/productivity.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
web/core/services/analytics.service.ts (2)
packages/types/src/analytics.d.ts (3)
  • IAnalyticsResponse (9-11)
  • TAnalyticsTabsBase (4-4)
  • TAnalyticsGraphsBase (5-5)
web/core/store/router.store.ts (2)
  • workspaceSlug (69-71)
  • projectId (85-87)
🔇 Additional comments (1)
web/core/components/core/sidebar/progress-chart.tsx (1)

22-64: Well-structured AreaChart implementation with good configuration.

The refactor from the previous chart implementation to AreaChart is well-executed. The configuration includes:

  • Proper area definitions with distinct styling for current vs ideal data
  • Appropriate colors and opacity settings
  • Good accessibility with labels and legends
  • Responsive design with proper margins and sizing

The use of strokeDasharray for the ideal line effectively distinguishes it visually from the current progress line.

Copy link
Copy Markdown
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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between aeca794 and cf0c86c.

📒 Files selected for processing (3)
  • web/core/components/analytics/config.ts (1 hunks)
  • web/core/components/analytics/insight-table/root.tsx (1 hunks)
  • web/core/components/analytics/work-items/workitems-insight-table.tsx (6 hunks)
✅ Files skipped from review due to trivial changes (1)
  • web/core/components/analytics/config.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (8)
web/core/components/analytics/work-items/workitems-insight-table.tsx (5)

49-60: Good type safety improvement.

The explicit typing of columnsLabels as Record<string, string> improves type safety and makes the code more maintainable.


140-154: Well-implemented CSV export functionality.

The CSV export implementation is well-designed:

  • Properly filters out sensitive/unnecessary fields (project_id, avatar_url, assignee_id)
  • Maps column keys to localized labels
  • Uses workspace-specific configuration

The data transformation logic is clean and follows good practices.


164-164: Proper integration of export functionality.

The export callback is correctly passed to the InsightTable component, enabling CSV export functionality.


20-20:

Details

✅ Verification successful

Verify the csvConfig function exists and is properly implemented.

The import references a csvConfig function from "../config". Ensure this configuration function exists and provides appropriate CSV export settings.


🏁 Script executed:

#!/bin/bash
# Check if the csvConfig function exists
echo "Checking for csvConfig function..."
fd "config.ts" web/core/components/analytics/ | xargs cat | grep -E "(export.*csvConfig|csvConfig.*function)" -A 10

Length of output: 389


csvConfig Implementation Verified

The csvConfig function is defined and exported in web/core/components/analytics/config.ts as follows:

export const csvConfig = (workspaceSlug: string) =>
  mkConfig({
    fieldSeparator: ",",
    filename: `${workspaceSlug}-analytics`,
    decimalSeparator: ".",
    useKeysAsHeaders: true,
  });

No further changes are needed.


16-18:

Details

❓ Verification inconclusive

Verify the analytics migration is complete and functional.

The migration from useAnalyticsV2 to useAnalytics and AnalyticsV2Service to AnalyticsService aligns with the PR objectives. However, ensure that the new analytics service provides equivalent functionality.

Also applies to: 23-23


🏁 Script executed:

#!/bin/bash
# Verify that the new analytics service exists and has the required methods
echo "Checking analytics service..."
fd "analytics.service.ts" | head -1 | xargs cat | grep -E "(class AnalyticsService|getAdvanceAnalyticsStats)" -A 5

# Check if there are any remaining references to analytics-v2
echo "Checking for remaining analytics-v2 references..."
rg "analyticsV2|AnalyticsV2|useAnalyticsV2" --type tsx --type ts

Length of output: 387


🏁 Script executed:

#!/bin/bash
# Locate the new AnalyticsService implementation
analytics_file=$(fd analytics.service.ts | head -1)
echo "Analytics service file: $analytics_file"
grep -n "class AnalyticsService" "$analytics_file"
grep -n "getAdvanceAnalyticsStats" "$analytics_file"

# Confirm no lingering analytics-v2 references
echo "Checking for remaining analytics-v2 references..."
rg -E "(analyticsV2|AnalyticsV2|useAnalyticsV2)" -g "*.ts" -g "*.tsx" || echo "No analytics-v2 references found"

Length of output: 1109


Confirm AnalyticsService Completeness

We’ve located the new service at packages/services/src/cycle/cycle-analytics.service.ts, and no legacy V2 references remain. However, a direct match for getAdvanceAnalyticsStats wasn’t found in that class. Please verify that:

  • All methods from the previous AnalyticsV2Service (e.g. getAdvanceAnalyticsStats) are implemented (or correctly renamed) in AnalyticsService.
  • Their signatures and behavior match the original functionality.
web/core/components/analytics/insight-table/root.tsx (3)

8-16: Excellent generic component design.

The TypeScript generic constraints are well-implemented:

  • Properly excludes "overview" from analytics types
  • Uses mapped types for type safety
  • Clean interface definition with optional props

18-25: Good component structure with proper loading state.

The component properly handles the loading state with a dedicated TableLoader component and implements the generic type constraints correctly.


34-42: Well-integrated export functionality.

The export action is properly integrated with the table's filtered rows, ensuring only visible data is exported. The button design and icon usage are appropriate.

@JayashTripathy JayashTripathy requested a review from aaryan610 June 3, 2025 15:21
Copy link
Copy Markdown
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: 0

♻️ Duplicate comments (2)
web/core/services/analytics.service.ts (1)

78-98: Excellent improvement addressing previous type safety concerns.

The processUrl method now properly validates the project_ids parameter with comprehensive type checking and meaningful error messages. This directly addresses the past review comment about unsafe property access.

packages/types/src/analytics.d.ts (1)

14-16: 🛠️ Refactor suggestion

Type safety concern persists from previous review.

The IAnalyticsResponse interface still uses the broad [key: string]: any signature that was flagged in previous reviews. This provides no compile-time type safety and could lead to runtime errors.

🧹 Nitpick comments (1)
web/core/services/analytics.service.ts (1)

28-51: Consider consistent parameter naming.

The method correctly excludes "overview" from the tab type, but uses type: tab in the params object while other methods use different parameter names.

     return this.get(processedUrl, {
       params: {
-        type: tab,
+        tab,
         ...params,
       },
     })
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cf0c86c and 9292cee.

📒 Files selected for processing (5)
  • packages/types/src/analytics.d.ts (1 hunks)
  • web/core/components/analytics/insight-table/root.tsx (1 hunks)
  • web/core/components/analytics/work-items/workitems-insight-table.tsx (6 hunks)
  • web/core/services/analytics.service.ts (1 hunks)
  • web/package.json (0 hunks)
💤 Files with no reviewable changes (1)
  • web/package.json
✅ Files skipped from review due to trivial changes (1)
  • web/core/components/analytics/insight-table/root.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/core/components/analytics/work-items/workitems-insight-table.tsx
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/types/src/analytics.d.ts (1)
packages/types/src/charts/index.d.ts (1)
  • TChartData (21-24)
web/core/services/analytics.service.ts (2)
packages/types/src/analytics.d.ts (4)
  • IAnalyticsResponse (14-16)
  • TAnalyticsTabsBase (4-4)
  • TAnalyticsFilterParams (6-10)
  • TAnalyticsGraphsBase (5-5)
web/core/store/router.store.ts (2)
  • workspaceSlug (69-71)
  • projectId (85-87)
🔇 Additional comments (9)
web/core/services/analytics.service.ts (3)

1-3: LGTM! Updated imports align with the refactored analytics architecture.

The imports correctly reference the new unified analytics types and remove dependencies on the old analytics-v2 implementation.


10-26: Well-structured generic analytics method.

The getAdvanceAnalytics method provides good abstraction for different analytics tabs while maintaining type safety with the generic return type.


53-76: Consistent implementation with good type safety.

The getAdvanceAnalyticsCharts method follows the same pattern as the other methods, maintaining consistency in the service API.

packages/types/src/analytics.d.ts (6)

1-2: Good integration with chart types.

The imports properly integrate chart-related types from constants and the new chart data types, supporting the unified analytics architecture.


4-10: Clean and well-defined base types.

The string literal unions for analytics tabs and graphs provide good type safety, and the filter parameters interface is appropriately structured.


18-27: Well-structured response field interfaces.

The IAnalyticsResponseFields and IAnalyticsRadarEntity interfaces provide clear, type-safe structures for analytics data components.


31-34: Good use of generic chart types.

The IChartResponse interface properly leverages the imported TChartData type to provide structured chart data with schema information.


38-54: Excellent table type design.

The WorkItemInsightColumns interface provides comprehensive coverage of work item states and metadata, while the AnalyticsTableDataMap type creates a clean mapping structure for different analytics table types.


56-60: Well-integrated analytics parameters.

The IAnalyticsParams interface properly uses the imported chart axis and metric types, maintaining consistency with the chart system.

@sriramveeraghanta sriramveeraghanta merged commit 14d2d69 into preview Jun 5, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the analytics-code-splitting branch June 5, 2025 20:23
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
…ependencies and translations (#7131)

* chore: added code split for the analytics store

* chore: done some refactor

* refactor: update entity keys in analytics and translations

* chore: updated the translations

* refactor: simplify AnalyticsStoreV2 class by removing unnecessary constructor

* feat: add AnalyticsStoreV2 class and interface for enhanced analytics functionality

* feat: enhance WorkItemsModal and analytics store with isEpic functionality

* feat: integrate isEpic state into TotalInsights and WorkItemsModal components

* refactor: remove isEpic state from WorkItemsModalMainContent component

* refactor: removed old  analytics components and related services

* refactor: new analytics

* refactor: removed all nivo chart dependencies

* chore: resolved coderabbit comments

* fix: update processUrl to handle custom-work-items in peek view

* feat: implement CSV export functionality in InsightTable component

* feat: enhance analytics service with filter parameters and improve data handling in InsightTable

* feat: add new translation keys for various statuses across multiple languages

* [WEB-4246] fix: enhance analytics components to include 'isEpic' parameter for improved data fetching

* chore: update yarn.lock to remove deprecated @nivo packages and clean up unused dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants