Skip to content

Build next#1

Open
JoaoVijales wants to merge 53 commits intomainfrom
build-next
Open

Build next#1
JoaoVijales wants to merge 53 commits intomainfrom
build-next

Conversation

@JoaoVijales
Copy link
Owner

No description provided.

This commit introduces a major refactoring of the workout session management and enhances the user's workout history.

Key changes include:

- A new  hook to manage the active workout state, including exercise progression, set tracking, and personal record (PR) updates.
- The  is refactored to use the  hook, simplifying its logic.
- The  now displays detailed information about past workouts, including individual exercises and sets.
- The  hook is improved with separate  calls for more robust data fetching and state management.
- API functions and Supabase types are updated to support the new data structures for workout sessions, exercises, and sets.
- The workout selection logic in  is streamlined.
\nThis commit refactors the application to use Supabase for user authentication,
session management, and user profile data. Key changes include:
- Login, Register, and Forgot Password screens now interact with Supabase auth.
- User data fetching and updating (, ) are updated to
  rely on the active Supabase session.
- Onboarding flow now correctly updates user profiles in Supabase.
- Added email verification banner.
- Removed hardcoded user IDs and introduced dynamic user identification via Supabase session.
- Various API calls (, , etc.) no longer
  require explicit  parameters, as they now derive user context from the
  Supabase session.
- Cycle phase calculation in CalendarScreen updated to use new  parameter.
This commit enhances the menstrual cycle tracking by automatically creating an initial cycle record if a  date is present but no cycle data exists in the database.

Key changes:
- In , added logic to check for the existence of menstrual cycles.
- If no cycles are found, a new  is created using the  date from the user's profile.
- The  function now uses the  from the most recent cycle, ensuring more accurate phase tracking.
- An unused import was also removed from .
This commit addresses several critical bugs related to the active workout screen and the menstrual cycle phase calculation.

Key Changes:

- **Workout Input Fix:**
  - In , resolved a bug where users could not input reps and weights. The component now correctly uses the central state from the  hook instead of a non-functional local state.
  - The weight input is now conditionally rendered, appearing only for exercises that are not bodyweight-only (where  is not 'peso corporal').

- **Cycle Calculation Fixes:**
  - In , fixed a race condition that caused incorrect phase calculations. The data processing  now correctly depends on  and handles state updates atomically.
  - Corrected a data inconsistency where  was not being updated with the latest cycle's start date, ensuring all components have access to fresh and consistent cycle data.

- **Data Model & API:**
  - Updated the  type in  to include the  property.
  - Modified the  function in  to correctly populate this  property, enabling the conditional rendering logic.
This commit introduces several improvements to workout session handling, including:
- Upgraded 'uuid' dependency to v13.0.0 and added '@types/uuid'.
- Updated 'public/index.html' language to 'pt-br'.
- Refactored 'reference_files/bd_base.sql' to remove 'users' table (relying on auth.users),
  standardized UUID references for user_id, and refined table definitions.
- Renamed 'updateWokoutFeedBack' to 'updateWorkoutFeedBack' in 'src/components/FeedbackScreen.tsx' and 'src/components/WorkoutActiveScreen.tsx'.
- Added 'uuidv4' for generating unique IDs in 'src/hooks/useWorkoutSession.ts' to ensure proper
  session and exercise set tracking.
- Removed PR related logic from useWorkoutSession hook.
- Ensured load calculations are triggered on exercise set updates.
- Refactored logic to generate new IDs and set timestamps to preserve existing data.
This commit introduces a new feature to display user's workout statistics on the home screen.
- The HomeScreen.tsx component now calculates and displays the number of workouts this week, workout consistency, and current streak.
- Added getWorkoutsThisWeek, getConsistency, and getStreak utility functions to src/utils/stats.ts.
- These stats are calculated using the workoutHistory from the useFlowFit context.
This commit introduces a new 'user_plan' table in the database schema and defines row-level security policies for it.
- Added  table to  to store user plan information (free/basic).
- Defined  and  policies for the  table in  to control data insertion.
@vercel
Copy link

vercel bot commented Nov 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
app-treino-feminino Ready Ready Preview Comment Nov 27, 2025 8:14pm
flowfit_app_teste Error Error Nov 27, 2025 8:14pm

- Refactor Stripe webhook for improved robustness, error handling, and idempotency.

- Enhance the UI of the Login and Register screens for a better user experience.
…ooks

This commit introduces comprehensive unit tests for the  and  custom hooks, enhancing code reliability and maintainability.

Key changes include:
- Unit tests for  covering initial state, data fetching (authenticated/unauthenticated, with/without profile), cycle phase calculation, error handling, and state clearing on sign-out.
- Unit tests for  covering session initiation, adding/updating exercise sets, finishing a workout, and placeholder function calls.
- Bug fix in  to conditionally fetch user plans only when a profile exists.
- Introduction of a manual mock for the 9cc74335-18e7-444f-8ce1-f3fe86bafbfd package to resolve ES Modules parsing issues in Jest.
- Updates to  to potentially better handle module transformations (though the manual mock for 07e60c4e-b20c-4dda-ab9a-cf8337402001 was the primary fix).
- Updates to  to reflect the progress on testing custom hooks and the initiation of UI component testing.
- Also includes updates to , , , and  from previous sessions or dependencies.
Adds the necessary database tables (stripe_events, stripe_unmatched_sessions) and Row Level Security policies to support Stripe webhooks.

This allows the application to process events from Stripe, such as successful payments and subscription updates, and link them to user accounts.

The user_plans_schema.sql file has been removed as its contents were consolidated into bd_base.sql.
Overhauled the UI of 'src/components/SettingsScreen.tsx' to align with the polished design found in 'reference_files/flowfit_mvp_frontend.tsx'.

Changes include:
- Replaced the basic form structure with a card-based layout for settings categories.
- Implemented styled toggle switches for preferences and appropriately styled navigation buttons.
- Integrated dynamic display of user profile data (e.g., last period, cycle regularity).
- Connected the 'Sair' (Logout) button to the application's signOut function.

This refactoring addresses the 'broken styles' issue by providing a modern and consistent user interface for the settings page.
This commit addresses several issues across the application:

1.  **HomeScreen Loading Bug:**
    - Modified useFlowFitData.ts to fetch the todayWorkoutState after the user profile is loaded. This resolves the issue where the HomeScreen would get stuck on a "Loading cycle information..." message because the workout data was never fetched.

2.  **CalendarScreen Bugs:**
    - Added a useEffect to CalendarScreen.tsx to ensure menstrualCycles are fetched when the component mounts.
    - Replaced dynamic Tailwind CSS class generation with a static color map to fix broken styles for cycle day indicators.
    - Ensured fetchMenstrualCycles is called after adding a new period to keep the view updated.
    - Standardized navigation and date comparison logic for better reliability.

3.  **HistoryScreen Data Bug:**
    - Corrected the data fetching logic in fetchDetailsForSession. The function now correctly queries the workout_exercises table to find the appropriate exercise_id before fetching exercise details, fixing a bug where session details would fail to load.
Consolidated loading conditions for userData, currentPhase, and todayWorkoutState to prevent infinite loading state.
- Corrects the logic for displaying hormonal phase indicators in the calendar.
- Ensures that colored dots representing each phase are always visible.
- Resolves a build error related to the 'cycle_length' property.
- Refactors the loading state management on the home screen.
- Addresses the infinite re-render loop in HomeScreen by utilizing the 'loading' state from the useFlowFit hook.
- Adds console.log statements to HomeScreen for debugging 'loading', 'userData', and 'todayWorkoutState'.
- Adds console.log statements to useFlowFitData.ts for debugging 'userProfile' and 'userData' changes.
- Implemented robust loading state management in HomeScreen by utilizing the 'loading' state from the useFlowFit hook, resolving the infinite re-render loop.
- Corrected the data population logic in useFlowFitData.ts to ensure 'userData' is properly constructed and set after fetching user profile information.
- Updated the 'UserData' interface in types.ts to accurately reflect nullable properties, resolving TypeScript build errors related to 'cycleDay' and other fields.
- Added necessary non-null assertions in HomeScreen to guide TypeScript's type inference after null checks.
- Applied comprehensive styling to FeedbackScreen.tsx based on the flowfit_mvp_frontend reference.
- Adapted state management to include multi-select symptom options, improving user feedback collection.
- Integrated existing 'useWorkoutSession' hook and 'onClose' prop within the new UI structure.
- Applied comprehensive styling to HistoryScreen.tsx based on the flowfit_mvp_frontend reference.
- Integrated existing data fetching and display logic with the new UI structure, including current week progress, cycle insights, and workout session list with detailed view.
- Adapted data mapping for dynamic content from 'userWorkoutSessions' and 'sessionDetails'.
- Moved the bottom navigation bar implementation from FlowFitApp.tsx to individual screen components (starting with SettingsScreen.tsx) to improve component encapsulation and allow for screen-specific navigation control.
- Updated SettingsScreenProps to include an onNavigate prop for handling screen transitions.
- Removed the global footer from FlowFitApp.tsx.
- Ensures that 'startWorkoutSession' from 'useWorkoutSession' is called when the 'Começar Treino' button is clicked in HomeScreen.tsx.
- This resolves the bug where 'currentWorkoutSession' was not properly initialized, causing data not to be sent from the Feedback page.
- Added console.log statements to the 'finishWorkoutSession' function in useWorkoutSession.ts to trace its execution and state, helping to diagnose why feedback data is not being sent.
- Corrected the import statement for 'useMemo' in HomeScreen.tsx to resolve the TypeScript error 'Cannot find name useMemo'.
- Added console.log statements to the 'startWorkoutSession' function in useWorkoutSession.ts to display 'userProfile?.id' and 'currentPhase'.
- This helps verify the values being used in the 'addUserWorkoutSession' call, aiding in the investigation of the Row-Level Security policy issue.
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.

1 participant