fix: huge refactor

This commit is contained in:
2026-03-17 14:03:51 +01:00
parent be87ab4fa1
commit 71b02610d1
50 changed files with 2763 additions and 3516 deletions
+18 -94
View File
@@ -1,102 +1,26 @@
{% load i18n %}
{% load static %}
<nav class="navbar-bg">
<!-- Left side -->
<div class="navbar-content">
<div class="navbar-align">
<nav class="navbar bg-base-100 shadow-sm">
<div class="flex-1">
<!-- Title -->
<div class="navbar-title">
<div class="shrink-0">
<a class="flex flex-row items-center" href="{% url 'web:index' %}">
<img class="w-8 h-8 mr-2" src="{{ logo }}" alt="{{ web_title }} logo">
<h1 class="navbar-web-title">{{ web_title }}</h1>
</a>
</div>
<a href="{% url 'web:index' %}" class="flex text-xl">
<img class="mr-4" src="{{ logo }}" alt="{{ web_title }} logo">
{{ web_title }}
</a>
<!-- Categories -->
<ul class="navbar-categories">
<li>
<a href="{% url 'web:index' %}" title=""
class="navbar-category-link">
{% translate 'Inicio' %}
</a>
</li>
{% for category in navbar_categories %}
<li class="shrink-0">
<a href="{% url 'web:category_view' slug=category.slug %}" title=""
class="navbar-category-link">
{{ category.name }}
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
<!-- Right side -->
<div class="relative flex items-center lg:space-x-2">
<div class="flex gap-2">
<input type="text" placeholder="{% trans 'Buscar...' %}" class="input input-bordered w-24 md:w-auto"/>
{% include 'components/theme-switch.html' %}
<!-- Show/Hide cart -->
<div id="navbar-cart-dropdown" hx-get="{% url 'web:cart_dropdown' %}"
hx-trigger="load, updated-cart from:body"></div>
{% if request.user.is_authenticated %}
<!-- Show/Hide user account dropdown -->
<button
hx-on:click="htmx.toggleClass(htmx.find('#userDropdown1'), 'hidden'); htmx.addClass(htmx.find('#myCartDropdown1'), 'hidden')"
id="userDropdownButton1"
data-dropdown-toggle="userDropdown1" type="button"
aria-label="show menu"
class="icon-button">
{% include 'components/icons/user.svg' %}
<span class="hidden sm:flex">
{% translate 'Mi cuenta' %}
</span>
{% include 'components/icons/dropdown.svg' %}
</button>
<!-- User account dropdown -->
<div id="userDropdown1"
class="absolute top-12 hidden z-12 w-56 divide-y divide-gray-100 overflow-hidden overflow-y-auto rounded-lg bg-white antialiased shadow dark:divide-gray-600 dark:bg-gray-700 right-0">
{% include 'components/users/user_dropdown.html' %}
</div>
{% else %}
<a href="{% url 'web:login' %}"
class="link-button">
{% translate 'Inicia sesión' %}
</a>
{% endif %}
<!-- Show/Hide menu items -->
<button hx-on:click="htmx.toggleClass(htmx.find('#ecommerce-navbar-menu-1'), 'hidden')" type="button"
data-collapse-toggle="ecommerce-navbar-menu-1" aria-controls="ecommerce-navbar-menu-1"
aria-expanded="false"
aria-label="show menu"
class="icon-button lg:hidden">
<span class="sr-only">
{% translate 'Abrir menú' %}
</span>
{% include 'components/icons/burger.svg' %}
</button>
</div>
</div>
<div id="ecommerce-navbar-menu-1"
class="navbar-dropdown-menu hidden">
<ul class="navbar-dropdown-menu-list">
<li>
<a href="{% url 'web:index' %}"
class="navbar-dropdown-menu-title">{% translate 'Inicio' %}</a>
</li>
{% for category in navbar_categories %}
<li>
<a href="{% url 'web:category_view' slug=category.slug %}"
class="navbar-dropdown-menu-title">{{ category.name }}</a>
</li>
{% endfor %}
</ul>
</div>
{% include 'components/generic/theme-switch.html' %}
{% if user.is_authenticated %}
{% include 'components/generic/user_dropdown.html' %}
{% else %}
<a href="{% url 'users:login' %}"
class="link-button flex items-center">
{% translate 'Inicia sesión' %}
</a>
{% endif %}
</div>
</nav>
@@ -1,6 +1,6 @@
{% load i18n %}
<div role="status">
<svg aria-hidden="true" class="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-primary-600"
<svg aria-hidden="true" class="w-8 h-8 animate-spin fill-primary-600"
viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
@@ -0,0 +1,9 @@
<button
onclick="switchTheme()"
id="theme-toggle"
type="button"
aria-label="switchtheme"
class="btn btn-circle">
{% include 'components/icons/moon.svg' %}
{% include 'components/icons/sun.svg' %}
</button>
+5 -5
View File
@@ -1,8 +1,8 @@
<div id="toast-default"
class="flex items-center w-full max-w-xs p-4 text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800"
class="flex items-center w-full max-w-xs p-4 rounded-lg shadow "
role="alert"
>
<div class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-blue-500 bg-blue-100 rounded-lg dark:bg-blue-800 dark:text-blue-200">
<div class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-blue-500 rounded-lg ">
{% block icon %}
{% endblock %}
@@ -11,9 +11,9 @@
{% block toast_text %}{% endblock %}
</div>
<button type="button"
class="ms-auto -mx-1.5 -my-1.5 bg-white text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2
focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex items-center justify-center h-8 w-8
dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700 cursor-pointer"
class="ms-auto -mx-1.5 -my-1.5 hover: rounded-lg focus:ring-2
focus:ring-gray-300 p-1.5 hover: inline-flex items-center justify-center h-8 w-8
:text-white : cursor-pointer"
data-dismiss-target="#toast-default" aria-label="Close"
hx-on:click="htmx.toggleClass(htmx.find('#toast-default'), 'hidden')"
>
@@ -0,0 +1,19 @@
{% load i18n %}
<div class="dropdown dropdown-end">
<div tabindex="0" role="button" class="btn btn-circle avatar">
<div class="w-10 flex rounded-full justify-center items-center">
{{ request.user.first_name.0 | upper }}{{ request.user.last_name.0 | upper }}
</div>
</div>
<ul
tabindex="-1"
class="menu menu-sm dropdown-content bg-base-100 rounded-box z-1 mt-3 w-52 p-2 shadow">
<li>
<a class="justify-between" href="{% url 'users:my_account' %}">
{% trans 'Mi cuenta' %}
</a>
</li>
<li><a>{% trans 'Ajustes' %}</a></li>
<li><a href="{% url 'users:logout' %}">{% trans 'Cerrar sesión' %}</a></li>
</ul>
</div>