Potion/internal/templates/pages/profile.templ
Hayden Hargreaves ae1f4f8e99 (UI/STYLE): Implemented the first rendition of the profile page.
Needs a backend wire job, but it looks pretty good. I can't really test
this page on a real mobile device either, since it requires the user to
be logged in and the testing doesn't work with google.
2025-07-12 14:22:23 -07:00

150 lines
4.4 KiB
Plaintext

package templates
import "github.com/haydenhargreaves/Potion/internal/templates/components"
import domain "github.com/haydenhargreaves/Potion/internal/domain/server"
import domain_user "github.com/haydenhargreaves/Potion/internal/domain/user"
templ userDetailsSection(user domain_user.User) {
<section class="w-full flex flex-col justify-center my-8 py-4 border-b border-gray-300">
<div class="w-full p-4 md:p-8 flex items-center gap-x-8">
<img
class="w-24 md:w-32 border-2 border-blue-500 rounded-full shadow-blue-500 shadow select-none"
src={ user.ImageUrl }
/>
<div class="flex flex-col gap-y-4">
<div class="">
<h1 class="text-md md:text-2xl font-semibold">{ user.Name }</h1>
<p class="text-xs md:text-sm">{ user.Email }</p>
</div>
<div class="flex gap-x-4">
<p class="text-xs md:text-sm"><span class="font-bold">10</span> recipes</p>
<p class="text-xs md:text-sm"><span class="font-bold">14</span> favorites</p>
</div>
</div>
</div>
</section>
}
templ recipesSection() {
<section class="p-8">
<h2 class="text-2xl font-semibold text-gray-800">My Recipes</h2>
<ul class="w-full my-2">
@recipeListItem()
@recipeListItem()
@recipeListItem()
@recipeListItem()
<a href="/" class="bg-red-500">
<li
class="w-full border-b border-gray-300 px-2 py-4 even:bg-gray-50 hover:bg-gray-100 hover:text-blue-600 duration-150 text-center"
>
See all...
</li>
</a>
</ul>
</section>
}
templ favoritesSection() {
<section class="p-8">
<h2 class="text-2xl font-semibold text-gray-800">My Favorites</h2>
<ul class="w-full my-2">
@recipeListItem()
@recipeListItem()
@recipeListItem()
@recipeListItem()
<a href={ domain.WEB_FAVORITES } class="bg-red-500">
<li
class="w-full border-b border-gray-300 px-2 py-4 even:bg-gray-50 hover:bg-gray-100 hover:text-blue-600 duration-150 text-center"
>
See all...
</li>
</a>
</ul>
</section>
}
templ activitySection() {
<section class="p-8">
<h2 class="text-2xl font-semibold text-gray-800">My Favorites</h2>
<ul class="w-full my-2">
@activityListItem()
@activityListItem()
@activityListItem()
@activityListItem()
@activityListItem()
@activityListItem()
<a href="/" class="bg-red-500">
<li
class="w-full border-b border-gray-300 px-2 py-4 even:bg-gray-50 hover:bg-gray-100 hover:text-blue-600 duration-150 text-center"
>
See all...
</li>
</a>
</ul>
</section>
}
templ recipeListItem() {
<li class="w-full border-b border-gray-300 px-2 py-4 even:bg-gray-50 hover:bg-gray-100 duration-150">
<p class="text-base md:text-lg">
<a href="" class="hover:text-blue-600 duration-100">
My Awesome Chili Recipe
</a>
</p>
<p class="hidden md:block text-sm text-gray-700 my-1.5">
Difficulty: <span class="font-semibold">Medium</span>
| Duration: <span class="font-semibold">60 min</span>
| Category: <span class="font-semibold">Dinner</span>
</p>
<p class="md:hidden text-xs md:text-sm text-gray-700 my-1">
Difficulty: <span class="font-semibold">Medium</span>
</p>
<p class="md:hidden text-xs md:text-sm text-gray-700 my-1">
Duration: <span class="font-semibold">60 min</span>
</p>
<p class="md:hidden text-xs md:text-sm text-gray-700 my-1">
Category: <span class="font-semibold">Dinner</span>
</p>
<p class="text-xs italic text-gray-500">
Tags: comfort food, spicy, beef
</p>
</li>
}
templ activityListItem() {
<li
class="w-full border-b border-gray-300 px-2 py-4 even:bg-gray-50 hover:bg-gray-100 duration-150 flex justify-between items-center"
>
<p class="text-sm md:text-base text-gray-800">
Rated "Spicy Chicken Wings"
</p>
<p class="text-xs md:text-sm text-gray-600 w-fit shrink-0">
2 days ago
</p>
</li>
}
templ logoutSection() {
<section class="w-full flex flex-col justify-center items-center py-8 border-t border-gray-300 mt-auto">
<a
href={ domain.API_AUTH_LOGOUT }
class="text-center border border-red-500 text-red-500 w-9/10 md:w-1/3 py-2 rounded-lg hover:cursor-pointer hover:bg-red-100 duration-300"
>
Logout
</a>
</section>
}
templ ProfilePage(user domain_user.User) {
@components.Navbar(" profile")
<div class="w-full h-fit flex justify-center">
<div class="mx-2 md:mx-0 w-full md:w-1/2 md:pt-14 border-l border-r border-gray-300 bg-white flex flex-col">
@userDetailsSection(user)
@recipesSection()
@favoritesSection()
@activitySection()
@logoutSection()
</div>
</div>
}