Skip to content

Fix/replace alert with toast notepage - #935

Open
thatperplextion wants to merge 5 commits into
parthbuilds-community:mainfrom
thatperplextion:fix/replace-alert-with-toast-notepage
Open

Fix/replace alert with toast notepage#935
thatperplextion wants to merge 5 commits into
parthbuilds-community:mainfrom
thatperplextion:fix/replace-alert-with-toast-notepage

Conversation

@thatperplextion

Copy link
Copy Markdown

📋 What does this PR do?

A clear summary of the changes made.

🔗 Related Issue

Closes #

🧪 How was this tested?

Describe how you tested your changes (manual steps, screenshots, etc.)

📸 Screenshots (if UI changes)

Before / After screenshots if you changed any UI.

✅ Checklist

  • I've read the CONTRIBUTING guide
  • My code follows the project's style guidelines
  • I've tested my changes locally
  • I've linked the related issue
  • I haven't introduced any new secrets or API keys

Copilot AI lite review requested due to automatic review settings August 9, 2026 10:37
@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request refactor Improve code without changing functionality UI UI-related improvements including layouts, responsiveness, styling, animations, and UX enhancements. frontend labels Aug 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR replaces some blocking alert(...) error notifications with a reusable Toast UI in key client pages, and adds/updates JSDoc comments for several shared utilities to improve clarity and editor tooling.

Changes:

  • Replaced alert(...) usage with a Toast component in HomePage, ProductPage, and NotesPage.
  • Removed verbose client-side debug logging from ExercisePage.
  • Added JSDoc documentation to several utility modules (rewardsUtils, normalizeProduct, getAuthHeaders, formatters).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
client/src/utils/rewardsUtils.js Adds JSDoc documentation for reward-tier and formatting helpers.
client/src/utils/normalizeProduct.js Adds JSDoc describing product ID normalization behavior.
client/src/utils/getAuthHeaders.js Replaces old header comments with richer JSDoc for auth header generation.
client/src/utils/formatters.js Adds JSDoc for INR currency formatter helper.
client/src/pages/ProductPage.jsx Replaces multiple alert(...) error paths with Toast notifications.
client/src/pages/NotesPage.jsx Replaces “empty title” alert(...) with Toast notification.
client/src/pages/HomePage.jsx Replaces cart-operation alert(...) errors with Toast notifications.
client/src/pages/ExercisePage.jsx Removes client-side debug logs/warns (but still contains an alert(...) in notes flow).
Suppressed comments (1)

client/src/pages/ExercisePage.jsx:66

  • This PR’s goal is to replace alert(...) with the Toast UI, but ExercisePage still uses alert("No date selected...") in handleExerciseSelect (line ~74). This leaves an inconsistent UX and likely misses the intended replacement for the notes flow.
      setExercises(data || []);
    } catch (err) {
      setError(err.message || "Failed to load exercises. Please try again.");
      console.error("Exercise fetch error:", err);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +5 to +10
/**
* Returns authentication headers for API requests.
* In development mode, prefers a local dev token if present.
* Otherwise, uses Firebase authentication token if user is logged in.
* @returns {Promise<{Content-Type: string, Authorization?: string}>} Headers object with optional Bearer token
*/
Comment on lines +147 to +148
setToast({ message: err.message || 'Failed to add to cart', type: 'error', visible: true });
setTimeout(() => setToast(prev => ({ ...prev, visible: false })), 3000);
Comment on lines +283 to +284
setToast({ message: err.message || 'Failed to add to cart', type: 'error', visible: true });
setTimeout(() => setToast(prev => ({ ...prev, visible: false })), 3000);
Comment on lines +46 to +47
setToast({ message: 'Please enter a workout title.', type: 'error', visible: true });
setTimeout(() => setToast(prev => ({ ...prev, visible: false })), 3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request frontend refactor Improve code without changing functionality UI UI-related improvements including layouts, responsiveness, styling, animations, and UX enhancements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants