Skip to content

Conversation

@Ritika8081
Copy link
Member

@Ritika8081 Ritika8081 commented Nov 18, 2025

@lorforlinux please review my pull request this includes following changes :

  • Updated next.js version.
  • Updated other versions of other dependencies.
  • fixed some syntax error and state update issue.
  • fixed all build failures.
  • fix contributor section and zip toast.
  • fixed time based plotting for npg lite ble.

Summary by CodeRabbit

  • New Features

    • Added PWA support (web manifest + manifest wiring) and a new build script to generate the manifest.
  • Bug Fixes

    • Improved data-loss detection and stability by making internal counters more robust.
    • Better channel selection persistence and more reliable worker synchronization.
    • Improved user feedback for data export (toasts on success/error).
  • Updates

    • Upgraded Next.js, React, and several UI library packages; added glob and removed an unused Tailwind plugin.

@coderabbitai
Copy link

coderabbitai bot commented Nov 18, 2025

Walkthrough

Adds a PWA manifest and a generate-manifest script, upgrades Next/React/Radix UI and other deps, replaces several local counters with React refs across components, renames sampling rate refs, improves channel toggle persistence and worker sync, and removes in-worker UI to return generated ZIP/Blob to the main thread.

Changes

Cohort / File(s) Change Summary
Dependency & Build
package.json
Added generate-manifest script; upgraded next to ^16.0.3, react/react-dom to 18.3.1, multiple @radix-ui packages to newer versions; added [email protected]; removed tailwindcss-textshadow.
PWA manifest
public/manifest.json, src/app/layout.tsx
Added public/manifest.json; introduced manifestHref computed path and updated metadata.manifest and head link to use it.
TypeScript config
tsconfig.json
Changed JSX runtime to react-jsx; added .next/dev/types/**/*.ts to include.
Counter → refs
src/components/Canvas.tsx, src/components/DataPass.tsx, src/components/FFT.tsx
Replaced local mutable counters with React refs (previousCounterRef, samplesReceivedRef, etc.); updated all comparisons/increments to use .current; FFT adds overflow protection.
Sampling ref rename & NPG changes
src/app/npg-lite/page.tsx, src/app/muscle-strength/page.tsx
Renamed sampingraterefsamplingrateref and updated usages; introduced local dpCount computed from samplingrateref.current and moved setManuallySelected(true) to run after state updates; added type="button" to time-base buttons.
Connection, worker sync & persistence
src/components/Connection.tsx, workers/indexedDBWorker.ts
toggleChannel persists selected channels to localStorage with try/catch; sets manuallySelected after state update; setCanvasCountInWorker memoized and guarded to post only on actual changes and synced via useEffect; worker no longer emits UI toasts — returns generated Blob to main thread; added toast notifications in main thread for ZIP success/error.
UI composition & accessibility
src/components/Contributors.tsx
Reordered Tooltip/Dialog trigger nesting and added DialogTitle with sr-only for accessible dialog labeling.

Sequence Diagram(s)

sequenceDiagram
    participant UI as Browser UI
    participant Worker as indexedDBWorker
    participant Storage as localStorage

    rect rgba(135,206,250,0.12)
    UI->>Storage: toggleChannel -> persist selectedChannels (try/catch)
    Note right of Storage: Persistence may warn on failure
    end

    rect rgba(144,238,144,0.12)
    UI->>Worker: request saveAllDataAsZip
    Worker-->>UI: return generated Blob (ZIP)
    UI->>UI: show toast success / error
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Files needing extra attention:
    • src/components/{Canvas,DataPass,FFT}.tsx — ensure all .current reads/writes are correct and no stale closures remain.
    • src/components/Connection.tsx — verify useEffect dependencies and correctness of guarded setCanvasCountInWorker.
    • src/app/npg-lite/page.tsx — check ordering change for setManuallySelected(true) and dpCount propagation.
    • workers/indexedDBWorker.ts — confirm Blob return contract and main-thread handling aligns with new toast flow.

Possibly related PRs

Poem

🐰 I hopped through refs and tiny swaps,
Saved counts that once would fade.
A manifest for doors and apps,
Zip blobs sent the proper way—
My code carrots gleam today. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main objectives of the PR: upgrading Next.js and dependencies, and resolving build failures.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/Connection.tsx (1)

361-379: setCanvasCountInWorker sends a stale canvasCount value to the worker

Here you compute newCount from selectedChannels.length and only update the parent when it differs, but the value you send to the worker is still canvasElementCountRef.current, which lags behind newCount until the separate useEffect syncing the ref runs. As a result, the worker can briefly receive an out‑of‑date canvasCount while the parent state has already moved on.

You can avoid this desync by basing both the parent update and the worker message on the same newCount:

-    const setCanvasCountInWorker = (canvasCount: number) => {
+    const setCanvasCountInWorker = () => {
         if (!workerRef.current) {
             initializeWorker();
         }
-        // Update parent canvasCount only when it differs to avoid unnecessary rerenders
-        const newCount = selectedChannels.length;
-        if (typeof setCanvasCount === 'function' && newCount !== canvasCount) {
-            setCanvasCount(newCount);
-        }
-
-        // Send canvasCount independently to the worker
-        workerRef.current?.postMessage({ action: 'setCanvasCount', canvasCount: canvasElementCountRef.current });
+        // Update parent canvasCount only when it differs to avoid unnecessary rerenders
+        const newCount = selectedChannels.length;
+        if (typeof setCanvasCount === 'function' && newCount !== canvasElementCountRef.current) {
+            setCanvasCount(newCount);
+        }
+
+        // Send the same count to the worker to keep it in sync
+        workerRef.current?.postMessage({ action: 'setCanvasCount', canvasCount: newCount });
     };
@@
-    useEffect(() => {
-        setCanvasCountInWorker(canvasElementCountRef.current);
+    useEffect(() => {
+        setCanvasCountInWorker();
         // eslint-disable-next-line react-hooks/exhaustive-deps
     }, [selectedChannels.length]);

(Adjust any other call sites of setCanvasCountInWorker accordingly if they exist.)

🧹 Nitpick comments (3)
src/components/Connection.tsx (2)

282-318: Avoid side‑effects inside the setSelectedChannels updater; manual flag placement looks good

Moving setManuallySelected(true) outside the state updater is a good change for clearer semantics of “manual” selection. However, the setSelectedChannels functional updater now performs side‑effects (localStorage access, portRef.current?.getInfo()) inside the updater callback. React may invoke updater functions more than once (especially under StrictMode/concurrent rendering), so these side‑effects can run multiple times with the same arguments and are harder to reason about.

Consider:

  • Keeping the updater purely functional, and
  • Persisting sortedChannels via a useEffect that depends on [selectedChannels, devicenameref.current], or by computing the next selection outside the updater and performing the persistence after calling setSelectedChannels.

Also, portInfo is only used as a truthy guard; if you intend to key devices by (usbVendorId, usbProductId) (as in the earlier useEffect), consider reusing that predicate here for consistency with other saved‑device lookups.


420-440: ZIP toasts are good; consider centralizing worker message handling

The success/error toasts on ZIP creation are a nice UX improvement and hook into the worker response correctly. One thing to be aware of: this function assigns workerRef.current.onmessage inside saveAllDataAsZip, and other worker operations (e.g., saveDataByFilename, getFileCountFromIndexedDB, delete functions) also overwrite onmessage. If any of these are triggered around the same time, the last assignment wins and earlier handlers may never see their responses.

Longer‑term, consider a pattern like:

  • A single workerRef.current.onmessage (or addEventListener("message", ...)) registered once, and
  • Routing based on event.data.action to the appropriate handler, or using per‑request IDs.

Optionally, you could also surface a generic toast.error in the outer catch to cover unexpected exceptions.

package.json (1)

15-48: Verify framework and tooling compatibility after major version bumps

This block upgrades a large set of Radix UI deps plus the core stack (next → ^16.0.3, react/react-dom → 18.3.1). Given the size of the jump:

  • Please double‑check the expected React peer version for your targeted Next.js release. The provided Next 15 documentation in this PR’s context notes that Next 15 expects React 19 as a minimum; your config currently uses a newer Next (16.x) with React 18.3.1, so it’s worth confirming that this combo is officially supported for your exact Next version.
  • Consider aligning eslint-config-next (still pinned at 14.2.3) with the Next.js major you’re running, so lint rules match the runtime’s behavior.

As per library documentation provided in the PR context.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cadacc6 and 2f70ec8.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • src/app/favicon.ico is excluded by !**/*.ico
📒 Files selected for processing (11)
  • package.json (2 hunks)
  • public/manifest.json (1 hunks)
  • src/app/layout.tsx (1 hunks)
  • src/app/npg-lite/page.tsx (1 hunks)
  • src/components/Canvas.tsx (2 hunks)
  • src/components/Connection.tsx (5 hunks)
  • src/components/Contributors.tsx (2 hunks)
  • src/components/DataPass.tsx (2 hunks)
  • src/components/FFT.tsx (3 hunks)
  • tsconfig.json (2 hunks)
  • workers/indexedDBWorker.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-01-25T08:14:49.164Z
Learnt from: Ritika8081
Repo: upsidedownlabs/Chords-Web PR: 74
File: src/components/Connection.tsx:432-454
Timestamp: 2025-01-25T08:14:49.164Z
Learning: For the Chords-Web project, the user prefers simpler Web Worker implementations without additional type safety or error handling layers.

Applied to files:

  • workers/indexedDBWorker.ts
🧬 Code graph analysis (2)
src/components/Connection.tsx (1)
src/components/ui/tooltip.tsx (1)
  • Tooltip (30-30)
src/app/layout.tsx (1)
scripts/generateManifest.mjs (1)
  • basePath (16-16)
🔇 Additional comments (13)
src/components/Contributors.tsx (3)

16-16: LGTM! DialogTitle import added for accessibility.

The addition of DialogTitle to the imports is appropriate and is correctly used below to provide an accessible title for the dialog, which may be required in Next.js 15 or updated Radix UI versions.


81-81: Excellent accessibility improvement!

The addition of DialogTitle with the sr-only class properly addresses accessibility requirements, likely introduced in Next.js 15 or updated Radix UI versions. This ensures screen readers can announce the dialog's purpose without affecting the visual layout.


65-79: I need to verify the tooltip and dialog interaction pattern in the actual codebase. Let me gather information:

I found critical documentation about this pattern. The correct nesting places the Tooltip wrapper outside, with TooltipTrigger wrapping DialogTrigger, and both using asChild to pass event handlers to the Button element. Let me verify this matches your actual code:

No issues found with the tooltip and dialog interaction pattern.

The code correctly places the outermost wrapper (Tooltip) outside, with the Button element inside both DialogTrigger and TooltipTrigger using asChild. This nesting order follows the documented best practice for combining Tooltip and Dialog components in shadcn/ui. The pattern allows tooltips to appear on hover while dialogs open on click without event propagation conflicts.

tsconfig.json (2)

38-40: LGTM: Include paths expanded appropriately.

The addition of .next/dev/types/**/*.ts, out/types/**/*.ts, and scripts/generateManifest.mjs aligns with Next.js 15's type generation and build artifacts.


18-18: Modern JSX transform is correctly configured.

The change to "react-jsx" is compatible with React 18.3.1 and Next.js 16.0.3, and aligns with modern React best practices. No issues detected.

src/app/npg-lite/page.tsx (1)

787-803: LGTM: Manual selection flag updated after state stabilizes.

Moving setManuallySelected(true) outside the setSelectedChannels updater ensures the flag is set after the state update completes, providing clearer sequencing and avoiding potential race conditions.

src/components/DataPass.tsx (1)

23-46: LGTM: Counter tracking refactored to use React ref.

The refactor from a local let variable to useRef is the correct pattern for maintaining mutable counter state across renders without triggering re-renders. All references to previousCounter.current are correctly updated.

src/components/Canvas.tsx (1)

43-178: LGTM: Counter tracking refactored to use React ref.

Consistent with the refactoring pattern applied across other components (DataPass.tsx, FFT.tsx), this change correctly migrates from a local mutable variable to a React ref for loss detection tracking. All references are properly updated to use .current.

workers/indexedDBWorker.ts (2)

258-261: LGTM: Correct separation of worker and UI concerns.

The comment correctly identifies that workers must not access UI. Returning the blob to the main thread for user feedback is the proper architecture for web workers.

Based on learnings: The user prefers simpler Web Worker implementations without additional layers.


195-222: Indentation adjustments present but logic unchanged.

The indentation changes in the CSV row construction are cosmetic and don't alter the logic.

src/components/FFT.tsx (1)

73-220: LGTM: Counter tracking refactored with overflow protection.

The refactor from a local variable to useRef is consistent with the pattern across the codebase. The addition of overflow protection at Lines 218-219 is good defensive programming, preventing potential integer overflow issues during long-running sessions.

public/manifest.json (1)

1-26: All referenced assets exist in the public directory.

Verification confirms that all three image assets referenced in the manifest (chords-logo-192x192.png, chords-logo-512x512.png, and screenshot-chords.png) are present in the public directory. The PWA manifest configuration is properly supported by the required asset files.

src/components/Connection.tsx (1)

1557-1665: Tooltip wrapping for the connection control looks correct

The TooltipProviderTooltipTooltipTrigger asChild structure around the connection Popover/Button chain is consistent with the shadcn/Radix tooltip pattern, and the dynamic label (“Connect/Disconnect Device”) provides clear affordance without impacting the interaction.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
package.json (1)

67-67: Update eslint-config-next to match Next.js major version.

eslint-config-next is pinned to version 14.2.3, but Next.js is now at ^16.0.3. To ensure consistent linting rules and avoid potential breakage, update eslint-config-next to match Next.js 16.x.

-   "eslint-config-next": "14.2.3",
+   "eslint-config-next": "^16.0.0",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f70ec8 and 7ad1c24.

📒 Files selected for processing (2)
  • package.json (2 hunks)
  • src/app/layout.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • src/app/layout.tsx
🔇 Additional comments (1)
package.json (1)

45-45: I need one more clarification before finalizing the review. The web search results indicate Next.js 16 "targets React 19," but I need to confirm whether this is a hard requirement or if React 18 is still compatible.

Address React version compatibility concern for Next.js 16 upgrade.

Next.js 16 uses the latest React Canary release, which includes React 19.2 features, and the official upgrade guide recommends npm install next@latest react@latest react-dom@latest. However, Next.js suggests using, at a minimum, [email protected] and [email protected], and official documentation does not explicitly state that React 18 is unsupported in Next.js 16.

The concern is that pinning React to 18.3.1 (instead of upgrading to React 19.x) may cause compatibility issues with Next.js 16's new features, particularly those relying on React 19.2 APIs. Additionally, clarify the rationale for exact version pinning without caret (18.3.1 vs ^18.3.1), especially since other dependencies use caret versioning.

Review the async-only API changes in Next.js 16 to ensure your codebase handles the required await patterns correctly regardless of React version.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/Connection.tsx (1)

361-373: Clarify the canvas count logic.

The function uses three different count values which creates confusion:

  1. The canvasCount parameter (used for comparison)
  2. newCount from selectedChannels.length (used for parent update)
  3. canvasElementCountRef.current (sent to worker)

This makes it unclear which value is the source of truth. Additionally, the parameter name canvasCount shadows the component prop, reducing readability.

Consider refactoring to make the relationship between these values explicit:

-const setCanvasCountInWorker = (canvasCount: number) => {
+const setCanvasCountInWorker = (currentCount: number) => {
     if (!workerRef.current) {
         initializeWorker();
     }
-    // Update parent canvasCount only when it differs to avoid unnecessary rerenders
     const newCount = selectedChannels.length;
-    if (typeof setCanvasCount === 'function' && newCount !== canvasCount) {
+    if (typeof setCanvasCount === 'function' && newCount !== currentCount) {
         setCanvasCount(newCount);
     }

-    // Send canvasCount independently to the worker
-    workerRef.current?.postMessage({ action: 'setCanvasCount', canvasCount: canvasElementCountRef.current });
+    // Send the updated count to the worker
+    workerRef.current?.postMessage({ action: 'setCanvasCount', canvasCount: newCount });
 };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ad1c24 and ff19697.

📒 Files selected for processing (1)
  • src/components/Connection.tsx (4 hunks)
🔇 Additional comments (2)
src/components/Connection.tsx (2)

282-318: LGTM! Channel toggle with localStorage persistence.

The implementation correctly persists channel selections to localStorage within the state updater callback and marks the selection as manual. The try-catch wrapper ensures graceful degradation if localStorage fails.


420-440: LGTM! User feedback for ZIP operations.

The addition of toast notifications provides clear user feedback for both success and error cases when creating ZIP files, improving the user experience.

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

♻️ Duplicate comments (1)
package.json (1)

12-13: Remove duplicate script entry and move distDir to Next.js config.

You have two scripts that execute the identical command:

  • Line 7: "prebuild" runs automatically before build
  • Line 13: "generate-manifest" is redundant

Also, distDir (line 12) is a Next.js configuration property and should not be in the scripts section. Move it to next.config.js or next.config.ts.

Apply this diff to fix both issues:

  "scripts": {
    "dev": "next dev",
    "prebuild": "ts-node scripts/generateManifest.mjs",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "export": "next export",
-   "distDir": "out",
-   "generate-manifest": "ts-node scripts/generateManifest.mjs"
  },

Then ensure your next.config.js or next.config.ts contains:

/** @type {import('next').NextConfig} */
const nextConfig = {
  distDir: 'out',
  // ... other config
};
export default nextConfig;
🧹 Nitpick comments (1)
package.json (1)

67-67: Update eslint-config-next version to align with Next.js 16.

You upgraded Next.js to ^16.0.3 but eslint-config-next is pinned to 14.2.3. This version mismatch may cause ESLint configuration issues or missing rules for the newer Next.js features.

Update eslint-config-next to match your Next.js version:

-   "eslint-config-next": "14.2.3",
+   "eslint-config-next": "^16.0.3",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 29d4380 and 1e30cd8.

📒 Files selected for processing (1)
  • package.json (2 hunks)
🔇 Additional comments (1)
package.json (1)

45-45: Verify Next.js 16 compatibility and breaking changes.

Next.js 16 is a major version upgrade. Per the Next.js 15 release notes, there are breaking changes including async Request APIs (e.g., cookies(), headers(), params, searchParams now require await). Ensure your codebase has been updated to handle these breaking changes.

Please verify:

  1. All dynamic API calls (cookies(), headers(), etc.) are properly awaited throughout the codebase.
  2. GET route handlers have appropriate caching behavior configured (they no longer default to cached in Next.js 15+).
  3. All Radix UI dependencies (lines 16–32) are compatible with Next.js 16 and React 18.3.1.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
package.json (1)

68-68: Update eslint-config-next to match Next.js 16 major version.

eslint-config-next is pinned at 14.2.3, but Next.js is upgraded to 16.0.3. This major version mismatch will cause ESLint configuration compatibility issues and likely build failures during the lint step.

Update eslint-config-next to version 16.x to align with the Next.js major version.

Apply this diff:

-    "eslint-config-next": "14.2.3",
+    "eslint-config-next": "^16.0.0",
🧹 Nitpick comments (1)
package.json (1)

49-50: Consider using caret ranges for React and React-dom.

React and React-dom are pinned to exact versions (18.3.1) rather than caret ranges (e.g., ^18.3.1). While exact pinning ensures reproducibility, it prevents automatic security updates within the minor/patch range.

Evaluate whether reproducibility is prioritized over automatic security patch adoption. If security updates are important, consider using caret ranges to allow patch-level updates.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e30cd8 and 00ac3ba.

📒 Files selected for processing (1)
  • package.json (2 hunks)
🔇 Additional comments (2)
package.json (2)

46-46: Verify Next.js 16.0.3 compatibility with the entire codebase.

Next.js was upgraded from 15.3.3 to 16.0.3 (a major version jump). While the PR description mentions that build failures were resolved, Next.js 16 is a very recent release and may introduce additional breaking changes beyond those covered by Next.js 15.

Confirm that:

  • All route handlers, middleware, and dynamic APIs follow Next.js 16 patterns
  • No deprecated APIs from Next.js 15 are being used
  • The build passes with next build and there are no runtime errors

Refer to the Next.js migration guide for any breaking changes specific to version 16.


7-7: No issues found with the prebuild script change.

generateManifest.mjs is properly implemented as an ES module with no TypeScript-specific syntax. The change from ts-node to node is correct and appropriate for .mjs files. The required dotenv dependency is declared in package.json, and the script will execute correctly in normal CI/CD flows where npm install precedes the prebuild step.

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

♻️ Duplicate comments (1)
src/app/layout.tsx (1)

51-51: Remove redundant manual manifest link tag (previously flagged).

This issue was previously identified and marked as addressed in commit 7ad1c24, but the manual <link rel="manifest"> tag is still present at Line 51. In Next.js 15's App Router, the metadata.manifest property at Line 23 automatically generates the appropriate link tag, making this manual tag redundant and potentially conflicting.

Apply this diff to remove the redundant link:

-      <head><link rel="manifest" href={manifestHref} /></head>
+      <head></head>

Or remove the entire <head> element if it serves no other purpose.

🧹 Nitpick comments (2)
src/components/LandingComp/HeadSection.tsx (1)

105-117: SVG translate transform change is standards‑compliant; base transform is optional

Switching to transform="translate(0,0)" aligns with SVG’s 2D transform syntax and matches the animateTransform type of translate, so this is correct. Since from/to already drive the motion, the initial transform="translate(0,0)" is a no‑op and could be removed for slightly cleaner markup if you want, but it’s not required.

src/app/layout.tsx (1)

15-15: Simplify manifestHref to use consistent absolute paths.

The current ternary produces inconsistent path styles:

  • When basePath = "" (empty string is falsy) → "manifest.json" (relative)
  • When basePath = "/Chords-Web""/Chords-Web/manifest.json" (absolute)

Apply this diff for consistent absolute paths:

-const manifestHref = basePath ? `${basePath}/manifest.json` : "manifest.json";
+const manifestHref = `${basePath}/manifest.json`;

This produces:

  • When basePath = """/manifest.json"
  • When basePath = "/Chords-Web""/Chords-Web/manifest.json"

Both are now absolute paths from the root, ensuring consistent resolution behavior.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 00ac3ba and 3ae9e5b.

📒 Files selected for processing (5)
  • .github/workflows/deploy.yml (1 hunks)
  • public/manifest.json (1 hunks)
  • scripts/generateManifest.mjs (1 hunks)
  • src/app/layout.tsx (3 hunks)
  • src/components/LandingComp/HeadSection.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • public/manifest.json
🧰 Additional context used
🧬 Code graph analysis (1)
src/app/layout.tsx (1)
scripts/generateManifest.mjs (1)
  • basePath (16-16)
🔇 Additional comments (2)
scripts/generateManifest.mjs (1)

36-43: LGTM! Robust error handling for the build script.

The try-catch block with logging and process.exitCode = 1 ensures that manifest generation failures are visible and properly propagate to CI workflows.

.github/workflows/deploy.yml (1)

80-106: LGTM! Helpful CI diagnostics for troubleshooting.

These read-only debug steps provide valuable visibility into the manifest generation and build process, which directly supports the PR's objective to resolve build failures. The || true fallbacks prevent diagnostic failures from breaking the build.

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

🧹 Nitpick comments (1)
public/manifest.json (1)

1-13: Consider adding theme_color and background_color for improved UX.

The manifest defines the core PWA structure. However, adding theme_color and background_color properties would improve the user experience when the app is installed on a device—these colors will be displayed while the app is loading. This is optional but recommended for PWAs.

If desired, add the following properties:

{
  "name": "Chords",
  "short_name": "Chords",
  "start_url": ".",
  "display": "standalone",
+  "theme_color": "#000000",
+  "background_color": "#ffffff",
  "icons": [
    { "src": "chords-logo-192x192.png", "sizes": "192x192", "type": "image/png" },
    { "src": "chords-logo-512x512.png", "sizes": "512x512", "type": "image/png" }
  ],
  "screenshots": [
    { "src": "screenshot-chords.png", "sizes": "1280x720", "type": "image/png", "form_factor": "wide" }
  ]
}

Adjust the color values (#000000 and #ffffff) to match your app's branding guidelines.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ae9e5b and 8b7cd95.

📒 Files selected for processing (2)
  • public/manifest.json (1 hunks)
  • src/app/layout.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/app/layout.tsx
🔇 Additional comments (1)
public/manifest.json (1)

6-12: Assets verified—no issues found.

All three image files referenced in the manifest (chords-logo-192x192.png, chords-logo-512x512.png, and screenshot-chords.png) exist in the public/ directory. The PWA manifest is properly configured.

@Ritika8081
Copy link
Member Author

I have updated version of glob to 10.5.0 and eslint-config-next to 16.0.3. fixed #103

@Ritika8081
Copy link
Member Author

Ritika8081 commented Nov 19, 2025

I have updated version of next.js from15.3.3 to 16.0.3. and js-yaml from 4.1.0 to 4.1.1. fixed #98 fixed #101

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/app/npg-lite/page.tsx (1)

598-611: Fix invalid else syntax at line 607 in src/app/npg-lite/page.tsx.

The invalid syntax } else (error: any) => { breaks the build. Replace with valid conditional:

                if (blob) {
                    saveAs(blob, filename); // FileSaver.js
                    toast.success("File downloaded successfully.");
-               } else (error: any) => {
+               } else if (error) {
                    console.error("Worker error:", error);
-                   toast.error(`Error during file download: ${error.message}`);
+                   toast.error(`Error during file download: ${String(error)}`);
                }

This restores valid syntax and ensures worker-reported failures reach the UI.

src/components/Connection.tsx (1)

442-454: Fix invalid else syntax at line 451—this is a TypeScript compilation error.

The code has invalid syntax mixing else with arrow function notation: } else (error: any) => { ... }

Change line 451 from:

} else (error: any) => {

to:

} else if (error) {

This restores valid TypeScript syntax and properly checks for the error condition before attempting to access its message property.

♻️ Duplicate comments (1)
src/components/Connection.tsx (1)

361-378: Worker canvas-count sync can send a stale value; also resolves prior exhaustive-deps concern.

Wrapping setCanvasCountInWorker in useCallback tied to selectedChannels fixes the earlier stale-closure / exhaustive-deps issue, but the worker message still uses canvasElementCountRef.current, which can lag behind selectedChannels.length for the render where the change occurs.

To keep React state, the ref, and the worker in lockstep, consider:

 const setCanvasCountInWorker = useCallback((canvasCount: number) => {
     if (!workerRef.current) {
         initializeWorker();
     }
-    // Update parent canvasCount only when it differs to avoid unnecessary rerenders
-    const newCount = selectedChannels.length;
-    if (typeof setCanvasCount === 'function' && newCount !== canvasCount) {
-        setCanvasCount(newCount);
-    }
-
-    // Send canvasCount independently to the worker
-    workerRef.current?.postMessage({ action: 'setCanvasCount', canvasCount: canvasElementCountRef.current });
+    // Derive the new count from the latest selectedChannels
+    const newCount = selectedChannels.length;
+    if (typeof setCanvasCount === 'function' && newCount !== canvasCount) {
+        setCanvasCount(newCount);
+    }
+    // Keep the ref and worker in sync with the same value
+    canvasElementCountRef.current = newCount;
+    workerRef.current?.postMessage({ action: 'setCanvasCount', canvasCount: newCount });
 }, [selectedChannels, setCanvasCount]);

This avoids the worker ever seeing an outdated canvasCount while still preventing unnecessary parent re-renders.

🧹 Nitpick comments (1)
src/app/npg-lite/page.tsx (1)

59-59: Sampling-rate–driven point counts and filter params are now consistently derived.

Using samplingrateref.current to compute dpCount, dataPointCountRef.current, grid spacing, and all filter configurations (Notch, EXGFilter, HighPassFilter) keeps the rendered window and DSP behavior tied to a single sampling-rate source. If you ever make samplingrateref dynamic, you may also want to replace the hard-coded 500 * 4 in numGridLines with the same ref for full consistency.

Also applies to: 108-111, 145-145, 195-199, 321-322, 345-352

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31c3c52 and bb4c308.

📒 Files selected for processing (3)
  • src/app/muscle-strength/page.tsx (3 hunks)
  • src/app/npg-lite/page.tsx (9 hunks)
  • src/components/Connection.tsx (8 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/app/npg-lite/page.tsx (1)
src/components/Colors.ts (1)
  • getLineColor (103-122)
🔇 Additional comments (6)
src/app/muscle-strength/page.tsx (1)

39-39: Sampling-rate ref wiring is consistent and behavior-preserving.

Initializing samplingrateref once and reusing it for dataPointCountRef and the Notch/EXG filter configuration keeps the sampling-rate–derived values in sync without changing behavior for the current defaults.

Also applies to: 647-648, 678-682

src/components/Connection.tsx (3)

282-318: Channel toggle + persistence behavior looks sound.

Moving setManuallySelected(true) after the setSelectedChannels updater and persisting sortedChannels into savedDevices (with a guarded try/catch) gives you deterministic channel ordering, prevents an empty selection, and keeps the “Select All / RESET” logic aligned with true manual interaction.


419-433: ZIP export toasts improve user feedback without changing behavior.

Adding toast.success on a successful ZIP download and toast.error on worker-reported failures makes the ZIP export path much clearer to end users, while keeping the underlying worker messaging intact.


578-579: Centralizing sampling-rate into samplingrateref keeps filter configuration coherent.

Hooking samplingrateref.current to the board’s sampling_rate (serial path) and the BLE default (500 Hz), then feeding the same ref into Notch, HighPassFilter, and EXGFilter.setbits in both readData and the BLE processing path, ensures all filters see a consistent sampling rate instead of scattered literals.

Also applies to: 1174-1175, 1306-1313

src/app/npg-lite/page.tsx (2)

791-807: Manual-selection flag is now correctly decoupled from programmatic “Select All”.

Moving setManuallySelected(true) out of the setSelectedChannels updater ensures that only explicit channel toggles mark the selection as manual, so the “Select All / RESET” button logic reflects actual user intent rather than programmatic changes.


1517-1517: Explicit type="button" on time-base controls is a safe clarification.

Adding type="button" avoids accidental form submission semantics and makes these slider-adjacent controls behave purely as UI buttons, which is future-proof even if the layout later ends up inside a <form>.

Also applies to: 1536-1536

@lorforlinux
Copy link
Member

@Ritika8081 Thank you so much for your contributions. I am merging this now! great work!

@lorforlinux lorforlinux merged commit 679746a into upsidedownlabs:main Nov 19, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants