-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed commit of the following: commit 0ff9748a62ac22ad261eeb7c6f40f470011ffd4e Author: Ethan Swan <[email protected]> Date: Sun Sep 3 19:54:05 2023 -0500 Add and run prettier. commit 0f143ccbf7c90ce4110e36ac412752668738c9b5 Author: Ethan Swan <[email protected]> Date: Sun Sep 3 19:40:54 2023 -0500 Remove obsolete log page. commit d3fc08dc56543ca73b1bd4fb2d98570b9b2ad6fc Author: Ethan Swan <[email protected]> Date: Sun Sep 3 19:40:33 2023 -0500 Touch up all kinds of stuff.
- Loading branch information
Showing
85 changed files
with
1,438 additions
and
1,067 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
{ | ||
"extends": [ | ||
"next/core-web-vitals", | ||
"plugin:storybook/recommended" | ||
] | ||
"extends": ["next/core-web-vitals", "plugin:storybook/recommended"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/public | ||
/.vercel | ||
/.tsbuild | ||
/build | ||
/.next | ||
/node_modules | ||
.infisical.json | ||
/.vercel_build | ||
/.github |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ while true; do | |
fi | ||
sleep 30 | ||
done | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,62 @@ | ||
'use client' | ||
"use client"; | ||
|
||
import { Workout, WorkoutType } from "@/lib/resources/apiTypes"; | ||
|
||
import { createNewWorkout } from "@/lib/resources/workouts/createNewWorkout"; | ||
import { useRouter } from 'next/navigation'; | ||
import { useRouter } from "next/navigation"; | ||
|
||
async function createAndStartWorkout(workoutTypeId: string): Promise<Workout> { | ||
const workout: Workout = { | ||
workout_type_id: workoutTypeId, | ||
status: 'in-progress', | ||
start_time: new Date() // start the workout right now. | ||
} | ||
return await createNewWorkout({workout}); | ||
status: "in-progress", | ||
start_time: new Date(), // start the workout right now. | ||
}; | ||
return await createNewWorkout({ workout }); | ||
} | ||
|
||
export default function NewWorkoutPanel({workoutTypes}: { workoutTypes: WorkoutType[] }) { | ||
export default function NewWorkoutPanel({ | ||
workoutTypes, | ||
}: { | ||
workoutTypes: WorkoutType[]; | ||
}) { | ||
const router = useRouter(); | ||
const newWorkoutCards = workoutTypes.slice(0, 4).map((workoutType, index) => { | ||
const onClick = () => { | ||
if (!workoutType.id) throw new Error('Workout type id is null') | ||
createAndStartWorkout(workoutType.id).then(workout => router.push(`/live/workouts/${workout.id}`)); | ||
if (!workoutType.id) throw new Error("Workout type id is null"); | ||
createAndStartWorkout(workoutType.id).then((workout) => | ||
router.push(`/live/workouts/${workout.id}`), | ||
); | ||
}; | ||
return <NewWorkoutButton name={workoutType.name} onClick={onClick} key={index} /> | ||
}) | ||
return ( | ||
<NewWorkoutButton name={workoutType.name} onClick={onClick} key={index} /> | ||
); | ||
}); | ||
return ( | ||
<div className="w-full pt-2"> | ||
{ workoutTypes && <h2 className="text-gray-900 text-lg lg:text-2xl">New Workout by Type</h2> } | ||
{workoutTypes && ( | ||
<h2 className="text-gray-900 text-lg lg:text-2xl"> | ||
New Workout by Type | ||
</h2> | ||
)} | ||
<div className="flex flex-row flex-wrap mt-2 gap-2 lg:gap-4"> | ||
{ newWorkoutCards } | ||
{newWorkoutCards} | ||
</div> | ||
</div> | ||
) | ||
); | ||
} | ||
|
||
type NewWorkoutButtonProps = { | ||
name: string; | ||
onClick: () => void; | ||
} | ||
}; | ||
|
||
function NewWorkoutButton({name, onClick}: NewWorkoutButtonProps) { | ||
function NewWorkoutButton({ name, onClick }: NewWorkoutButtonProps) { | ||
return ( | ||
<button className="flex flex-col font-bold" onClick={onClick}> | ||
<div className="w-32 h-16 rounded-lg shadow-lg flex flex-row justify-between items-center px-2"> | ||
<p>{name}</p> | ||
<i className="fi fi-sr-arrow-alt-circle-right text-3xl inline-flex align-[-0.2rem] text-gold" /> | ||
</div> | ||
</button> | ||
) | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 10 additions & 6 deletions
16
app/(protected)/live/workouts/[workoutId]/CreateNewExerciseGroupWidget.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
'use client' | ||
"use client"; | ||
|
||
export default function CreateNewExerciseGroupWidget({ onClick }: { onClick: () => void}) { | ||
export default function CreateNewExerciseGroupWidget({ | ||
onClick, | ||
}: { | ||
onClick: () => void; | ||
}) { | ||
return ( | ||
<div className="rounded-lg p-2 lg:p-4 mt-3 whitespace-nowrap flex justify-start"> | ||
<button | ||
className='flex flex-row justify-center items-center text-gold | ||
py-2 m-2 gap-2 text-lg' | ||
className="flex flex-row justify-center items-center text-gold | ||
py-2 m-2 gap-2 text-lg" | ||
onClick={onClick} | ||
> | ||
<i className="fi fi-sr-square-plus inline-flex align-[-0.2rem] text-2xl" /> | ||
<p>New exercise</p> | ||
</button> | ||
</div> | ||
) | ||
} | ||
); | ||
} |
Oops, something went wrong.