Skip to content

Commit

Permalink
New mesocycles and mesocycles database integration
Browse files Browse the repository at this point in the history
  • Loading branch information
nathhuynh committed Sep 19, 2024
1 parent 3d92db9 commit bbf07e5
Show file tree
Hide file tree
Showing 40 changed files with 2,223 additions and 1,970 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ next-env.d.ts

/dist/

.env
.env
algorithm-notes.md
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM node:22.4.1-alpine as base
WORKDIR /usr/src/app

# Copy package.json and install dependencies
COPY package*.json ./
COPY package.json package-lock.json ./
RUN npm ci

# Copy prisma directory
Expand Down
20 changes: 20 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "styles/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
}
}
2 changes: 1 addition & 1 deletion components/AddCustomExercise.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import { useState, useEffect } from 'react';
import { FaEllipsisV, FaPlus, FaDumbbell, FaEdit, FaTrashAlt } from 'react-icons/fa';
import { useExerciseOptions } from '../utils/useExerciseOptions';
import { fetchCustomExercises, createCustomExercise, updateCustomExercise, deleteCustomExercise } from '../pages/api/customExercises';
Expand Down
2 changes: 1 addition & 1 deletion components/AdminLoadExercises.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import { useState } from 'react';
import axios from 'axios';
import { useSession } from 'next-auth/react';

Expand Down
14 changes: 11 additions & 3 deletions components/CurrentWorkout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import React, { useState, useEffect, ChangeEvent } from 'react';
import { useState, useEffect, ChangeEvent } from 'react';
import { useSession } from 'next-auth/react';
import Calendar from 'react-calendar';
import 'react-calendar/dist/Calendar.css';
Expand Down Expand Up @@ -49,6 +49,7 @@ const CurrentWorkout: React.FC = () => {
// const [workoutExerciseOrder, setWorkoutExerciseOrder] = useState<string[]>(Array.from(workoutExercises.keys()));
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const [localNotes, setLocalNotes] = useState(workoutData.notes);

useEffect(() => {
setIsMounted(true);
Expand Down Expand Up @@ -114,6 +115,10 @@ const CurrentWorkout: React.FC = () => {
saveWorkoutData();
}, [workoutData, selectedDate, isMounted, session]);

useEffect(() => {
setLocalNotes(workoutData.notes);
}, [workoutData.notes]);

const handleAddSet = async (exerciseName: string, type: 'regular' | 'dropset' = 'regular') => {
setIsLoading(true);
try {
Expand Down Expand Up @@ -654,10 +659,13 @@ const CurrentWorkout: React.FC = () => {
<textarea
className="w-full p-2 border rounded text-gray-700"
rows={4}
value={workoutData.notes}
value={localNotes}
onChange={(e: ChangeEvent<HTMLTextAreaElement>) =>
setWorkoutData(prev => ({ ...prev, notes: e.target.value }))
setLocalNotes(e.target.value)
}
onBlur={() => {
setWorkoutData(prev => ({ ...prev, notes: localNotes }))
}}
></textarea>
</div>

Expand Down
Loading

0 comments on commit bbf07e5

Please sign in to comment.