Skip to content

Wellness dashboard api - #2094

Open
Yuvraj-Sarathe wants to merge 17 commits into
SB2318:mainfrom
Yuvraj-Sarathe:wellness-dashboard-api
Open

Wellness dashboard api#2094
Yuvraj-Sarathe wants to merge 17 commits into
SB2318:mainfrom
Yuvraj-Sarathe:wellness-dashboard-api

Conversation

@Yuvraj-Sarathe

Copy link
Copy Markdown

PR Description

The issue was easy, but I ran into multiple layered errors of pre-existing frontend when I was trying to check my results locally. I have solved those alongside the issue. So please review them as well, and hence, please give me enhanced labels for this PR!

Type of Change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update

Select your work-area

  • Frontend
  • Backend
  • Documentation
  • Others

Related Issue

#2092

Add your Work Example

even though this is a frontend PR, it does not require a screenshot.

Fixes (mention the issue number which this fixes)

#2092

Checklist

  • I have updated my branch and synced it with the project's 'develop' branch before making this PR.
  • I have optimized the file changes.
  • I have added a snapshot of my work example.
  • I have made a PR to the project's development branch.

Undertaking

  • My code follows the style guidelines of this project.

  • I have performed a self-review of my code.

  • I have commented on my code, particularly in hard-to-understand areas.

  • I have made corresponding changes to the documentation.

  • I have checked for plagiarism and ensured its authenticity.

  • I have read and followed the code of conduct for this repository. I understand that violation of this undertaking may have legal consequences.

  • I agree.

…eklyChart, and WellnessDashboardScreen

- ManualLogCard: integrates useLogWellnessMetric mutation and useGetWeeklyWellness query with Zod validation, pre-fills from today's existing data, shows loading state on Save button, displays error alerts
- WeeklyChart: replaces hardcoded data with live API data from useGetWeeklyWellness, adds water/steps metric toggle, shows loading skeleton and empty state
- WellnessDashboardScreen: adds offline banner using Redux isConnected state
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Thank you @, for creating the PR and contributing to our UltimateHealth project 💗.
Our team will review the PR and will reach out to you soon! 😇
Make sure that you have marked all the tasks that you are done with ✅.
Thank you for your patience! 😀

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Automated Review Feedback

Provide actionable comments grouped by severity:

Important

  1. Unnecessary files committed: The files REVIEW.md and DEBUG-FINDINGS.md appear to be audit/review reports. These types of temporary reports or findings documents should generally not be committed to the repository's main branch. Please remove these files from the pull request.
  2. Package Manager Setup Clarity: The package.json has been updated to use yarn run for scripts, which aligns with the presence of yarn.lock. However, the DEBUG-FINDINGS.md report (which this PR addresses) noted that yarn was not globally installed on the audit system. For a consistent developer experience, please ensure that yarn is either a globally installed prerequisite for all contributors, or consider using npm (which ships with Node.js) for all scripts, or leverage corepack enable to manage package manager versions. The current change to yarn run might break for developers who do not have yarn installed globally.

Suggestions

  1. Unused _idx parameter: In frontend/src/screens/WellnessDashboard/WeeklyChart.tsx on line 33, the _idx parameter in the map callback is unused. It can be removed for clarity:
    // Before
    return sorted.map((log, _idx) => {
    // After
    return sorted.map((log) => {
  2. Zod import style inconsistency: In frontend/src/schemas/wellnessSchemas.ts, import { z } from 'zod' is used. For consistency with other schema files in the repository (e.g., profileSchemas.ts), which typically use import * as z from 'zod', consider aligning the import style.
  3. Robust maxValue calculation: In frontend/src/screens/WellnessDashboard/WeeklyChart.tsx on line 47, the maxValue calculation uses Math.max(...chartData.map((d) => d.value), 1). While this is harmless for small arrays (like 7 weekly entries), using the spread operator with Math.max can lead to a stack overflow for very large arrays. A more robust approach for general use would be to use reduce:
    const max = chartData.reduce((max, d) => Math.max(max, d.value), 1);

Maintainer Note:

Once the initial automated feedback has been addressed, maintainer @SB2318 will review the pull request for final evaluation.

@Yuvraj-Sarathe

Copy link
Copy Markdown
Author

Automated Review Feedback

Provide actionable comments grouped by severity:

Important

  1. Unnecessary files committed: The files REVIEW.md and DEBUG-FINDINGS.md appear to be audit/review reports. These types of temporary reports or findings documents should generally not be committed to the repository's main branch. Please remove these files from the pull request.
  2. Package Manager Setup Clarity: The package.json has been updated to use yarn run for scripts, which aligns with the presence of yarn.lock. However, the DEBUG-FINDINGS.md report (which this PR addresses) noted that yarn was not globally installed on the audit system. For a consistent developer experience, please ensure that yarn is either a globally installed prerequisite for all contributors, or consider using npm (which ships with Node.js) for all scripts, or leverage corepack enable to manage package manager versions. The current change to yarn run might break for developers who do not have yarn installed globally.

Suggestions

  1. Unused _idx parameter: In frontend/src/screens/WellnessDashboard/WeeklyChart.tsx on line 33, the _idx parameter in the map callback is unused. It can be removed for clarity:
    // Before
    return sorted.map((log, _idx) => {
    // After
    return sorted.map((log) => {
  2. Zod import style inconsistency: In frontend/src/schemas/wellnessSchemas.ts, import { z } from 'zod' is used. For consistency with other schema files in the repository (e.g., profileSchemas.ts), which typically use import * as z from 'zod', consider aligning the import style.
  3. Robust maxValue calculation: In frontend/src/screens/WellnessDashboard/WeeklyChart.tsx on line 47, the maxValue calculation uses Math.max(...chartData.map((d) => d.value), 1). While this is harmless for small arrays (like 7 weekly entries), using the spread operator with Math.max can lead to a stack overflow for very large arrays. A more robust approach for general use would be to use reduce:
    const max = chartData.reduce((max, d) => Math.max(max, d.value), 1);

Maintainer Note:
Once the initial automated feedback has been addressed, maintainer @SB2318 will review the pull request for final evaluation.

Please re-review!

Also I edited more files due to local bugs i was facing in running my development locally.

Please consider that when assessing my work!

I will also like to request to add PRs like

level:advanced
type:frontend

You currently put level:frontend

@SB2318 please look into this

@SB2318

SB2318 commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Automated Review Feedback

Provide actionable comments grouped by severity:

Important

  1. Unnecessary files committed: The files REVIEW.md and DEBUG-FINDINGS.md appear to be audit/review reports. These types of temporary reports or findings documents should generally not be committed to the repository's main branch. Please remove these files from the pull request.
  2. Package Manager Setup Clarity: The package.json has been updated to use yarn run for scripts, which aligns with the presence of yarn.lock. However, the DEBUG-FINDINGS.md report (which this PR addresses) noted that yarn was not globally installed on the audit system. For a consistent developer experience, please ensure that yarn is either a globally installed prerequisite for all contributors, or consider using npm (which ships with Node.js) for all scripts, or leverage corepack enable to manage package manager versions. The current change to yarn run might break for developers who do not have yarn installed globally.

Suggestions

  1. Unused _idx parameter: In frontend/src/screens/WellnessDashboard/WeeklyChart.tsx on line 33, the _idx parameter in the map callback is unused. It can be removed for clarity:
    // Before
    return sorted.map((log, _idx) => {
    // After
    return sorted.map((log) => {
  2. Zod import style inconsistency: In frontend/src/schemas/wellnessSchemas.ts, import { z } from 'zod' is used. For consistency with other schema files in the repository (e.g., profileSchemas.ts), which typically use import * as z from 'zod', consider aligning the import style.
  3. Robust maxValue calculation: In frontend/src/screens/WellnessDashboard/WeeklyChart.tsx on line 47, the maxValue calculation uses Math.max(...chartData.map((d) => d.value), 1). While this is harmless for small arrays (like 7 weekly entries), using the spread operator with Math.max can lead to a stack overflow for very large arrays. A more robust approach for general use would be to use reduce:
    const max = chartData.reduce((max, d) => Math.max(max, d.value), 1);

Maintainer Note:
Once the initial automated feedback has been addressed, maintainer @SB2318 will review the pull request for final evaluation.

Please re-review!

Also I edited more files due to local bugs i was facing in running my development locally.

Please consider that when assessing my work!

I will also like to request to add PRs like

level:advanced type:frontend

You currently put level:frontend

@SB2318 please look into this

No issues, keep patience. I will review.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Gemini AI Code Review

Summary

This Pull Request introduces a new Wellness Dashboard feature, including API integration, data logging, and weekly visualization components. It also significantly improves the frontend's cross-platform compatibility by implementing web mocks and lazy loading for several native-only modules (e.g., Firebase, react-native-fs, react-native-share, react-native-snackbar, react-native-html-to-pdf). A critical production API URL typo in app.config.js has been fixed, and defensive optional chaining has been added in ArticleScreen.tsx.

The author's inclusion of the DEBUG-FINDINGS.md report is highly commendable, demonstrating a thorough investigation into pre-existing frontend issues. While many of these identified issues are addressed, some critical ones related to package manager consistency and incorrect native build scripts remain.

Overall, the PR delivers valuable new functionality and crucial bug fixes, but requires attention to the high-severity issues identified below before merging.

🔴 High Severity

  1. Incorrect Native Preview Scripts in package.json
    • Issue: The newly added preview, preview:android, and preview:ios scripts in package.json incorrectly use expo export --platform [platform]. expo export is designed for generating static web builds, not for creating native application bundles for internal distribution or preview. The eas.json already defines a preview profile specifically for native builds, but these scripts do not leverage it.
    • Impact:

@SB2318 SB2318 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

  1. Please delete the mocks folder
  2. Please delete the scripts
  3. Please delete DEBUG_FINDINGS.md
  4. Don't just create a hook; add proper functionality
  5. Overall, please resolve the conflicts.

@github-actions

Copy link
Copy Markdown
Contributor

Automated Review Feedback

Provide actionable comments grouped by severity:

Critical

  1. Incorrect Native Preview Scripts: The preview:android and preview:ios scripts in package.json still use expo export --platform [platform]. expo export is intended for static web builds, not for native application bundles. For native previews, you should use eas build --profile preview --platform android (or ios). This issue was previously reported and remains unaddressed, providing misleading and non-functional build instructions for native platforms.

Important

  1. Reduced Type Safety in PodcastRecorder.tsx: In frontend/src/screens/PodcastRecorder.tsx, the AppState.addEventListener callback's nextState parameter type was changed from AppStateStatus to string. AppStateStatus is a specific type ('active' | 'background' | 'inactive' | 'unknown' | 'extension') provided by React Native. Changing it to string reduces type safety and could mask potential issues if an unexpected string value is passed. Please revert this type change to AppStateStatus.

Suggestions

  1. Unused _idx parameter: In frontend/src/screens/WellnessDashboard/WeeklyChart.tsx on line 33, the _idx parameter in the map callback is unused. It can be removed for clarity:
    // Before
    return sorted.map((log, _idx) => {
    // After
    return sorted.map((log) => {
  2. Zod Import Style Consistency: In frontend/src/schemas/wellnessSchemas.ts, import { z } from 'zod' is used. For consistency with other schema files in the repository (e.g., profileSchemas.ts), which typically use import * as z from 'zod', consider aligning the import style. While import { z } from 'zod' is a common and often preferred style, maintaining a consistent approach across the repository is beneficial.
  3. Type Relaxation in PodcastSkeletonCard.tsx: In frontend/src/components/PodcastSkeletonCard.tsx, the type of shimmerX was changed from Animated.AnimatedInterpolation<number> to any. While this might resolve a type error, it reduces type safety. If possible, try to find a more specific type or add a comment explaining why any is necessary here.
  4. Package Manager Documentation: The quality script in package.json has been updated to use yarn run. This indicates a preference for yarn as the package manager. To ensure a consistent developer experience, please add a note to the repository's CONTRIBUTING.md or README.md to clarify that yarn is the recommended package manager for this project.
  5. User Feedback for Wellness Log: In frontend/src/screens/WellnessDashboard/ManualLogCard.tsx, validation and API errors are currently shown using Alert.alert. While functional, a Snackbar (which is now mocked for web and available on native) would provide a less intrusive and more transient user feedback experience for these types of messages. Consider using getSnackbar()?.show() for a smoother UX.

Maintainer Note:

Once the initial automated feedback has been addressed, maintainer @SB2318 will review the pull request for final evaluation.

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