Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QA feedback on the chart and card names on truncations #2219

Merged
merged 5 commits into from
Nov 12, 2024

Conversation

OchiengPaul442
Copy link
Contributor

@OchiengPaul442 OchiengPaul442 commented Nov 7, 2024

Summary of Changes (What does this PR do?)

  • Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Status of maturity (all need to be checked before merging):

  • I've tested this locally
  • I consider this code done
  • This change ready to hit production in its current state
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included issue number in the "Closes #ISSUE-NUMBER" part of the "What are the relevant tickets?" section to link the issue.
  • I've updated corresponding documentation for the changes in this PR.
  • I have written unit and/or e2e tests for my change(s).

How should this be manually tested?

  • Please include the steps to be done inorder to setup and test this PR.

What are the relevant tickets?

Screenshots (optional)

Summary by CodeRabbit

  • New Features

    • Enhanced AQNumberCard component to display site names with tooltips when truncated, improving user experience.
    • Updated legend entries in charts to include tooltips for better visibility when truncation occurs.
    • Introduced a custom hook for data fetching in the OverView component, simplifying data retrieval and error handling.
  • Bug Fixes

    • Improved handling of string truncation in chart legends, ensuring clarity and readability.
  • Chores

    • Temporarily disabled search functionality in the TopBar component while maintaining modal access.
  • Documentation

    • Added PropTypes validation for SiteCard, AddLocationCard, and AQNumberCard components to ensure proper prop usage.
    • Simplified date handling in the DataDownload component for API requests.
    • Introduced TypeScript configuration and added TypeScript as a development dependency.

Copy link

coderabbitai bot commented Nov 7, 2024

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • platform/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
📝 Walkthrough

Walkthrough

The changes in this pull request involve enhancements to several components, including AQNumberCard, Charts/components, and TopBar. The AQNumberCard component now includes state management for text truncation and improved prop validation. The Charts/components file has seen the removal of a string truncation function and updates to legend rendering with tooltips. The TopBar component has temporarily disabled the search functionality by commenting out related code, while maintaining other functionalities intact.

Changes

File Path Change Summary
platform/src/common/components/AQNumberCard/index.jsx Added useRef for site name truncation detection, introduced isTruncated state, updated rendering logic with CustomTooltip, and added PropTypes validation for SiteCard, AddLocationCard, and AQNumberCard.
platform/src/common/components/Charts/components/index.jsx Removed truncate2 function, updated renderCustomizedLegend to destructure props, enhanced legend truncation logic, and refined styling and tooltip handling.
platform/src/common/components/TopBar/index.jsx Commented out TopBarSearch component and its usage, while keeping the button functionality for opening the modal.
platform/src/common/components/Modal/dataDownload/modules/DataDownload.jsx Removed toLocalISOString function, altered date handling in handleSubmit, and added minimum: true to apiData.
platform/src/pages/Home/index.jsx Commented out a console log statement for cardCheckList, removing a debug output without affecting functionality.
platform/next-env.d.ts Added new TypeScript declaration file for Next.js types.
platform/package.json Added TypeScript as a development dependency.
platform/src/common/components/Charts/ChartContainer.jsx Simplified skeleton loader state management by deriving showSkeleton directly from chartLoading.
platform/src/pages/analytics/_components/OverView.jsx Replaced data fetching functions with useFetchAnalyticsData hook, introducing retry logic and simplifying state management.
platform/tsconfig.json Introduced new TypeScript configuration file with various compiler options.

Possibly related PRs

Suggested labels

ready for review

Suggested reviewers

  • Baalmart
  • Codebmk

🌟 In the realm of code where changes flow,
AQNumberCard shines with a new glow.
Tooltips and truncation, a user delight,
While TopBar takes a break, out of sight.
Legends now dance with a tooltip embrace,
Enhancing the UI, keeping up the pace! 🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai 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 or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

github-actions bot commented Nov 7, 2024

New next-platform changes available for preview here

1 similar comment
Copy link
Contributor

github-actions bot commented Nov 7, 2024

New next-platform changes available for preview here

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (5)
platform/src/common/components/AQNumberCard/index.jsx (3)

83-103: Consider optimizing the truncation detection.

While the implementation is solid, there are two potential performance improvements:

  1. The resize event listener could benefit from debouncing to reduce unnecessary recalculations
  2. The effect's dependency on windowWidth might cause extra rechecks when the window size changes but doesn't affect the truncation status

Consider applying this optimization:

 useEffect(() => {
+  const debounce = (fn, ms) => {
+    let timer;
+    return (...args) => {
+      clearTimeout(timer);
+      timer = setTimeout(() => fn.apply(this, args), ms);
+    };
+  };
+
   const checkTruncation = () => {
     const el = nameRef.current;
     if (el) {
       setIsTruncated(el.scrollWidth > el.clientWidth);
     }
   };
+
+  const debouncedCheck = debounce(checkTruncation, 250);

   // Initial check
   checkTruncation();

   // Re-check on window resize
-  window.addEventListener('resize', checkTruncation);
+  window.addEventListener('resize', debouncedCheck);
   return () => {
-    window.removeEventListener('resize', checkTruncation);
+    window.removeEventListener('resize', debouncedCheck);
   };
-}, [site.name, windowWidth]);
+}, [site.name]);

Line range hint 105-131: Enhance accessibility for truncated text.

The truncation implementation works well visually, but could be more accessible for screen readers.

Consider adding ARIA attributes:

 const siteNameElement = (
   <div
     ref={nameRef}
     className="text-gray-800 text-lg font-medium capitalize text-left w-full max-w-[185px] md:max-w-full lg:max-w-[185px] overflow-hidden text-ellipsis whitespace-nowrap"
+    aria-label={site.name || 'No Location Data'}
+    title={site.name || 'No Location Data'}
   >
     {site.name || '---'}
   </div>
 );

174-183: Enhance PropTypes validation.

The PropTypes implementation is good, but could be more specific for better type safety.

Consider these enhancements:

 SiteCard.propTypes = {
   site: PropTypes.shape({
     _id: PropTypes.string.isRequired,
     name: PropTypes.string,
     country: PropTypes.string,
   }).isRequired,
   onOpenModal: PropTypes.func.isRequired,
   windowWidth: PropTypes.number.isRequired,
-  pollutantType: PropTypes.string.isRequired,
+  pollutantType: PropTypes.oneOf(['pm2_5', 'pm10']).isRequired,
 };

 AQNumberCard.propTypes = {
-  className: PropTypes.string,
+  className: PropTypes.string.isRequired,
 };

Also applies to: 290-292

platform/src/common/components/Charts/components/index.jsx (2)

Line range hint 209-227: LGTM! Nice improvements to the legend rendering logic.

The changes look good:

  • Clean destructuring of props
  • Smart conditional truncation based on payload length
  • Efficient memoization of the sorted payload
  • Safe copying of the payload array using spread operator

Consider extracting the color-to-grayscale conversion into a separate utility function since it might be useful elsewhere:

const colorToGrayscale = (color) => {
  if (!color) return 0;
  const hex = color.replace('#', '');
  const r = parseInt(hex.slice(0, 2), 16);
  const g = parseInt(hex.slice(2, 4), 16);
  const b = parseInt(hex.slice(4, 6), 16);
  return 0.2126 * r + 0.7152 * g + 0.0722 * b; // ITU-R BT.709 formula
};

231-258: Consider enhancing accessibility for the tooltip implementation.

The tooltip implementation is clean and follows good practices. However, we could improve accessibility for screen readers.

Consider adding these ARIA attributes:

 <span
   className={`${shouldTruncate ? 'truncate max-w-[100px] group' : ''}`}
   title={shouldTruncate ? entry.value : null}
+  role="tooltip"
+  aria-label={entry.value}
 >
   {entry.value}
 </span>

 {shouldTruncate && (
   <div 
     className="absolute bottom-full mb-1 hidden group-hover:flex flex-col items-center"
+    role="tooltip"
+    aria-hidden={true}
   >
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between bb2cda2 and 2f3b3db.

📒 Files selected for processing (3)
  • platform/src/common/components/AQNumberCard/index.jsx (8 hunks)
  • platform/src/common/components/Charts/components/index.jsx (2 hunks)
  • platform/src/common/components/TopBar/index.jsx (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • platform/src/common/components/TopBar/index.jsx
🔇 Additional comments (2)
platform/src/common/components/AQNumberCard/index.jsx (1)

1-1: LGTM! Good addition of necessary imports.

The addition of useRef and PropTypes imports aligns well with the implementation of text truncation detection and type checking.

Also applies to: 8-8

platform/src/common/components/Charts/components/index.jsx (1)

Line range hint 1-1: Verify complete removal of truncate2 function.

The AI summary mentioned the removal of the truncate2 function. Let's verify there are no remaining references to it.

✅ Verification successful

The previous command failed because the file type wasn't recognized. Let's try with explicit file pattern matching and also use AST-based search to be thorough.


truncate2 function has been successfully removed

The comprehensive search across all JavaScript and TypeScript files, including both string-based and AST-based searches, found no remaining references to the truncate2 function. This confirms its complete removal from the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to truncate2 function
rg "truncate2" --type js --type jsx

Length of output: 63


Script:

#!/bin/bash
# Search for any remaining references to truncate2 function, using ripgrep with all possible extensions
rg "truncate2" -g "*.{js,jsx,ts,tsx}"

# Also search using ast-grep to catch any function declarations or references
ast-grep --pattern 'truncate2($_)'

Length of output: 74

Copy link
Contributor

New next-platform changes available for preview here

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
platform/src/common/components/Modal/dataDownload/modules/DataDownload.jsx (1)

153-153: Document the purpose of the 'minimum' flag.

The addition of minimum: true to the API request could have significant implications on the data returned. Please add a comment explaining:

  • The purpose of this flag
  • How it affects the response data
  • When it should be used

Add documentation above the apiData object:

      // Prepare data for API
+     // minimum: true reduces the response payload by returning only essential fields
      const apiData = {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2f3b3db and adc101a.

📒 Files selected for processing (2)
  • platform/src/common/components/Modal/dataDownload/modules/DataDownload.jsx (2 hunks)
  • platform/src/pages/Home/index.jsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • platform/src/pages/Home/index.jsx
🔇 Additional comments (2)
platform/src/common/components/Modal/dataDownload/modules/DataDownload.jsx (2)

121-121: LGTM! Clean error state management.

The error state reset is well-placed at the beginning of form submission, ensuring a clean slate for new validation checks.


144-145: 🛠️ Refactor suggestion

Consider timezone handling in date conversions.

The current implementation using toISOString() converts dates to UTC, which might not reflect the user's local timezone context. This could lead to unexpected date shifts, especially for users in different timezones.

Let's verify the impact:

Consider using a date library like date-fns or moment.js for proper timezone handling:

-        startDateTime: new Date(formData.duration.name.start).toISOString(),
-        endDateTime: new Date(formData.duration.name.end).toISOString(),
+        startDateTime: zonedTimeToUtc(new Date(formData.duration.name.start), Intl.DateTimeFormat().resolvedOptions().timeZone).toISOString(),
+        endDateTime: zonedTimeToUtc(new Date(formData.duration.name.end), Intl.DateTimeFormat().resolvedOptions().timeZone).toISOString(),

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (5)
platform/src/common/components/Charts/ChartContainer.jsx (4)

Line range hint 64-106: Consider enhancing error handling in the export functionality

The exportChart function could benefit from more specific error handling and format validation:

  • Add format validation before processing
  • Handle specific export errors (e.g., canvas creation, PDF generation)
  • Provide more detailed error messages to users

Here's a suggested improvement:

 const exportChart = useCallback(async (format) => {
   if (!chartRef.current) return;
+  const supportedFormats = ['png', 'jpg', 'pdf'];
+  if (!supportedFormats.includes(format)) {
+    CustomToast({
+      message: `Unsupported format: ${format}. Please use: ${supportedFormats.join(', ')}`,
+      type: 'error'
+    });
+    return;
+  }

   setDownloadComplete(null);
   setLoadingFormat(format);

   try {
     const canvas = await html2canvas(chartRef.current, {
       scale: 2,
       useCORS: true,
       backgroundColor: '#fff',
     });

-    if (['png', 'jpg'].includes(format)) {
+    if (format === 'png' || format === 'jpg') {
       const imgData = canvas.toDataURL(`image/${format}`, 0.8);
       const link = document.createElement('a');
       link.href = imgData;
       link.download = `airquality-data.${format}`;
       document.body.appendChild(link);
       link.click();
       document.body.removeChild(link);
     } else if (format === 'pdf') {
       const pdf = new jsPDF({
         orientation: 'landscape',
         unit: 'px',
         format: [canvas.width, canvas.height],
       });
       const imgData = canvas.toDataURL('image/png', 0.8);
       pdf.addImage(imgData, 'PNG', 0, 0, canvas.width, canvas.height);
       pdf.save('airquality-data.pdf');
-    } else {
-      throw new Error('Unsupported format');
     }

     setDownloadComplete(format);
     CustomToast({
       message: `Chart exported as ${format.toUpperCase()} successfully!`,
       type: 'success',
     });
   } catch (error) {
+    const errorMessage = error.message || `Failed to export chart as ${format.toUpperCase()}`;
     console.error('Error exporting chart:', error);
     CustomToast({
-      message: `Failed to export chart as ${format.toUpperCase()}.`,
+      message: errorMessage,
       type: 'error',
     });
   } finally {
     setLoadingFormat(null);
   }
 }, []);

Line range hint 1-249: Consider splitting this component for better maintainability

The ChartContainer component has multiple responsibilities:

  • Chart rendering
  • Export functionality
  • Dropdown handling
  • Error handling

Consider extracting these into separate components:

  • ChartExporter: Handle export functionality
  • ChartDropdown: Handle dropdown menu
  • ChartError: Handle error display

This would improve:

  • Code maintainability
  • Testing capabilities
  • Reusability
  • Component complexity

Would you like me to help create a detailed plan for this refactoring?


Line range hint 171-184: Extract ErrorOverlay into a separate component

The ErrorOverlay component could be moved to its own file for better organization and reusability.

Consider creating a new file components/ErrorOverlay.jsx:

const ErrorOverlay = ({ onRetry }) => (
  <div className="absolute top-0 left-0 w-full h-full flex flex-col items-center justify-center bg-gray-300 bg-opacity-50 z-10 p-4">
    <p className="text-red-500 font-semibold mb-2">
      Something went wrong. Please try again.
    </p>
    <button
      onClick={onRetry}
      className="mt-2 px-4 py-2 bg-red-500 text-white rounded-md hover:bg-red-600"
    >
      Try Again
    </button>
  </div>
);

export default ErrorOverlay;

Line range hint 107-166: Optimize dropdown content memoization

The renderDropdownContent callback could be optimized by:

  1. Moving the button components outside the callback
  2. Memoizing the export options separately

Here's a suggested approach:

const ExportButton = memo(({ format, loading, complete, onExport }) => (
  <button
    onClick={() => onExport(format)}
    className="flex justify-between items-center w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"
  >
    <span>Export as {format.toUpperCase()}</span>
    <span className="-mr-2 flex items-center">
      {loading === format && (
        <div className="animate-spin h-4 w-4 border-2 border-t-blue-500 border-gray-300 rounded-full" />
      )}
      {complete === format && <CheckIcon fill="#1E40AF" width={20} height={20} />}
    </span>
  </button>
));

const EXPORT_FORMATS = ['png', 'jpg', 'pdf'];

const renderDropdownContent = useCallback(
  () => (
    <>
      <button
        onClick={handleRefreshChart}
        className="flex justify-between items-center w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"
      >
        Refresh
      </button>
      <hr className="border-gray-200" />
      {EXPORT_FORMATS.map((format) => (
        <ExportButton
          key={format}
          format={format}
          loading={loadingFormat}
          complete={downloadComplete}
          onExport={exportChart}
        />
      ))}
      {/* ... rest of the content ... */}
    </>
  ),
  [exportChart, loadingFormat, downloadComplete, handleRefreshChart]
);
platform/src/pages/analytics/_components/OverView.jsx (1)

135-144: Consider handling errors after retry attempts are exhausted

After the retry mechanism has reached its limit, it would be prudent to handle the scenario where data cannot be fetched successfully. This could involve displaying a user-friendly error message or logging the error for further investigation.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between adc101a and 400b3c0.

⛔ Files ignored due to path filters (1)
  • platform/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • platform/next-env.d.ts (1 hunks)
  • platform/package.json (1 hunks)
  • platform/src/common/components/Charts/ChartContainer.jsx (1 hunks)
  • platform/src/pages/analytics/_components/OverView.jsx (5 hunks)
  • platform/tsconfig.json (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • platform/next-env.d.ts
  • platform/tsconfig.json
🔇 Additional comments (1)
platform/src/common/components/Charts/ChartContainer.jsx (1)

53-54: Nice simplification of the skeleton loader state! 👍

The direct derivation of showSkeleton from chartLoading is a cleaner approach that:

  • Eliminates unnecessary state management
  • Removes the need for useEffect and timers
  • Maintains the same visual behavior

Let's verify the skeleton loader behavior in other components:

✅ Verification successful

Skeleton loader behavior is consistent across the codebase ✅

The verification shows that the SkeletonLoader component is used consistently across the codebase:

  • In MoreInsights.jsx: Direct loading state usage
  • In ChartContainer.jsx: Our simplified loading state
  • In reports/home/page.tsx: Direct loading state usage

All implementations follow the same pattern of showing the skeleton based on a direct loading state, confirming that our simplification aligns with the codebase's patterns.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other components using SkeletonLoader to ensure consistent behavior

# Search for SkeletonLoader usage
rg "SkeletonLoader" -A 3

# Search for similar loading state patterns
ast-grep --pattern 'const showSkeleton = $_;'

Length of output: 3275

@@ -89,6 +89,7 @@
"eslint-plugin-react-hooks": "^4.6.2",
"globals": "^15.9.0",
"prettier": "^3.3.3",
"typescript": "5.6.3",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix invalid TypeScript version

The specified TypeScript version 5.6.3 is invalid. The latest stable version as of April 2024 is 5.3.3.

Apply this diff to fix the version:

-    "typescript": "5.6.3",
+    "typescript": "5.3.3",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"typescript": "5.6.3",
"typescript": "5.3.3",

🛠️ Refactor suggestion

Add missing TypeScript type definitions

Since you're adding TypeScript support, you'll need type definitions for your existing dependencies. Several key packages in your dependencies require separate @types/* packages.

Add these essential type definitions:

     "typescript": "5.3.3",
+    "@types/react": "^18.2.0",
+    "@types/react-dom": "^18.2.0",
+    "@types/node": "^20.0.0",
+    "@types/mapbox-gl": "^2.7.19",
+    "@types/pako": "^2.0.3",
+    "@types/papaparse": "^5.3.14",
+    "@types/underscore": "^1.11.15",
     "webpack": "^5.74.0"

This will provide proper type checking and better IDE support for your core dependencies.

Committable suggestion skipped: line range outside the PR's diff.

dateRange: chartData.chartDataRange,
frequency: chartData.timeFrame,
pollutant: chartData.pollutionType,
organisationName: chartData.organizationName,
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Inconsistent spelling of 'organizationName'

There's a discrepancy in the spelling of 'organizationName' when passing it to useFetchAnalyticsData. The parameter name uses 'organisationName' (with an 's'), but the variable is chartData.organizationName (with a 'z'). This inconsistency could lead to the organisationName parameter being undefined in the hook.

Apply this diff to correct the spelling:

-    organisationName: chartData.organizationName,
+    organizationName: chartData.organizationName,

Ensure that the useFetchAnalyticsData hook accepts organizationName as a parameter.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
organisationName: chartData.organizationName,
organizationName: chartData.organizationName,

Copy link
Contributor

New next-platform changes available for preview here

@Baalmart Baalmart merged commit 0bead1c into staging Nov 12, 2024
28 of 29 checks passed
@Baalmart Baalmart deleted the analytics-ui-improvements branch November 12, 2024 11:22
@Baalmart Baalmart mentioned this pull request Nov 12, 2024
1 task
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.

2 participants