#73 move workout to new mehtod
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 51s
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 51s
This commit is contained in:
@@ -1,65 +0,0 @@
|
||||
package template
|
||||
|
||||
templ App() {
|
||||
<main class="mx-2">
|
||||
<form
|
||||
class="max-w-xl mx-auto flex flex-col gap-4 justify-center mt-10"
|
||||
>
|
||||
<h2 class="text-4xl mb-8">Track your workout</h2>
|
||||
<input
|
||||
id="date"
|
||||
type="date"
|
||||
class="input input-bordered"
|
||||
value=""
|
||||
name="date"
|
||||
/>
|
||||
<select class="select select-bordered w-full" name="type">
|
||||
<option>Push Ups</option>
|
||||
<option>Pull Ups</option>
|
||||
</select>
|
||||
<input
|
||||
type="number"
|
||||
class="input input-bordered"
|
||||
placeholder="Sets"
|
||||
name="sets"
|
||||
/>
|
||||
<input
|
||||
type="number"
|
||||
class="input input-bordered"
|
||||
placeholder="Reps"
|
||||
name="reps"
|
||||
/>
|
||||
<button class="btn btn-primary self-end">Save</button>
|
||||
</form>
|
||||
<!-- <div class="overflow-x-auto mx-auto max-w-screen-lg"> -->
|
||||
<!-- <h2 class="text-4xl mt-14 mb-8">Workout history</h2> -->
|
||||
<!-- <table class="table table-auto max-w-full"> -->
|
||||
<!-- <thead> -->
|
||||
<!-- <tr> -->
|
||||
<!-- <th>Date</th> -->
|
||||
<!-- <th>Type</th> -->
|
||||
<!-- <th>Sets</th> -->
|
||||
<!-- <th>Reps</th> -->
|
||||
<!-- <th></th> -->
|
||||
<!-- </tr> -->
|
||||
<!-- </thead> -->
|
||||
<!-- -->
|
||||
<!-- <tbody> -->
|
||||
<!-- <tr> -->
|
||||
<!-- <th>{workout.date}</th> -->
|
||||
<!-- <th>{workout.type}</th> -->
|
||||
<!-- <th>{workout.sets}</th> -->
|
||||
<!-- <th>{workout.reps}</th> -->
|
||||
<!-- <th> -->
|
||||
<!-- <div class="tooltip" data-tip="Delete Entry"> -->
|
||||
<!-- <button on:click={() => deleteWorkout(workout.id)}> -->
|
||||
<!-- <MdiDelete class="text-gray-400 text-lg"></MdiDelete> -->
|
||||
<!-- </button> -->
|
||||
<!-- </div> -->
|
||||
<!-- </th> -->
|
||||
<!-- </tr> -->
|
||||
<!-- </tbody> -->
|
||||
<!-- </table> -->
|
||||
<!-- </div> -->
|
||||
</main>
|
||||
}
|
||||
@@ -3,11 +3,11 @@ package auth
|
||||
templ SignInOrUp(isSignIn bool) {
|
||||
<form
|
||||
class="max-w-xl px-2 mx-auto flex flex-col gap-4 h-full justify-center"
|
||||
method="POST"
|
||||
hx-target="#sign-in-or-up-error"
|
||||
if isSignIn {
|
||||
action="/api/auth/signin"
|
||||
hx-post="/api/auth/signin"
|
||||
} else {
|
||||
action="/api/auth/signup"
|
||||
hx-post="/api/auth/signup"
|
||||
}
|
||||
>
|
||||
<h2 class="text-6xl mb-10">
|
||||
@@ -61,5 +61,12 @@ templ SignInOrUp(isSignIn bool) {
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
@Error("")
|
||||
</form>
|
||||
}
|
||||
|
||||
templ Error(message string) {
|
||||
<p class="text-error text-right" id="sign-in-or-up-error">
|
||||
{ message }
|
||||
</p>
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package auth
|
||||
|
||||
templ UserComp(user string) {
|
||||
<div id="user-info" class="flex gap-5">
|
||||
<div id="user-info" class="flex gap-5 items-center">
|
||||
if user != "" {
|
||||
<a hx-get="/api/auth/signout" hx-target="#user-info" class="btn btn-sm">Sign Out</a>
|
||||
<!-- <a href="/api/auth/signout" class="btn btn-sm">Sign Out</a> -->
|
||||
{ user }
|
||||
<p>{ user }</p>
|
||||
} else {
|
||||
<a href="/auth/signup" class="btn btn-sm">Sign Up</a>
|
||||
<a href="/auth/signin" class="btn btn-sm">Sign In</a>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package workout
|
||||
|
||||
templ Workout() {
|
||||
templ WorkoutComp() {
|
||||
<main class="mx-2">
|
||||
<form
|
||||
class="max-w-xl mx-auto flex flex-col gap-4 justify-center mt-10"
|
||||
hx-post="/api/workout"
|
||||
>
|
||||
<h2 class="text-4xl mb-8">Track your workout</h2>
|
||||
<input
|
||||
@@ -31,35 +32,48 @@ templ Workout() {
|
||||
/>
|
||||
<button class="btn btn-primary self-end">Save</button>
|
||||
</form>
|
||||
<!-- <div class="overflow-x-auto mx-auto max-w-screen-lg"> -->
|
||||
<!-- <h2 class="text-4xl mt-14 mb-8">Workout history</h2> -->
|
||||
<!-- <table class="table table-auto max-w-full"> -->
|
||||
<!-- <thead> -->
|
||||
<!-- <tr> -->
|
||||
<!-- <th>Date</th> -->
|
||||
<!-- <th>Type</th> -->
|
||||
<!-- <th>Sets</th> -->
|
||||
<!-- <th>Reps</th> -->
|
||||
<!-- <th></th> -->
|
||||
<!-- </tr> -->
|
||||
<!-- </thead> -->
|
||||
<!-- -->
|
||||
<!-- <tbody> -->
|
||||
<!-- <tr> -->
|
||||
<!-- <th>{workout.date}</th> -->
|
||||
<!-- <th>{workout.type}</th> -->
|
||||
<!-- <th>{workout.sets}</th> -->
|
||||
<!-- <th>{workout.reps}</th> -->
|
||||
<!-- <th> -->
|
||||
<!-- <div class="tooltip" data-tip="Delete Entry"> -->
|
||||
<!-- <button on:click={() => deleteWorkout(workout.id)}> -->
|
||||
<!-- <MdiDelete class="text-gray-400 text-lg"></MdiDelete> -->
|
||||
<!-- </button> -->
|
||||
<!-- </div> -->
|
||||
<!-- </th> -->
|
||||
<!-- </tr> -->
|
||||
<!-- </tbody> -->
|
||||
<!-- </table> -->
|
||||
<!-- </div> -->
|
||||
<div hx-get="/api/workout" hx-trigger="load"></div>
|
||||
</main>
|
||||
}
|
||||
|
||||
type Workout struct {
|
||||
Id string
|
||||
Date string
|
||||
Type string
|
||||
Sets string
|
||||
Reps string
|
||||
}
|
||||
|
||||
templ WorkoutListComp(workouts []Workout) {
|
||||
<div class="overflow-x-auto mx-auto max-w-screen-lg">
|
||||
<h2 class="text-4xl mt-14 mb-8">Workout history</h2>
|
||||
<table class="table table-auto max-w-full">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Type</th>
|
||||
<th>Sets</th>
|
||||
<th>Reps</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
for _,w := range workouts {
|
||||
<tr>
|
||||
<th>{ w.Date }</th>
|
||||
<th>{ w.Type }</th>
|
||||
<th>{ w.Sets }</th>
|
||||
<th>{ w.Reps }</th>
|
||||
<th>
|
||||
<div class="tooltip" data-tip="Delete Entry">
|
||||
<button hx-delete="api/workout/{w.id}">
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user