Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,16 +6,15 @@ from urllib.parse import quote_plus
|
|
| 6 |
import base64
|
| 7 |
import os
|
| 8 |
|
| 9 |
-
# --- 1. CONFIGURACIÓN
|
| 10 |
st.set_page_config(page_title="ARZON STUDIOS", layout="wide", initial_sidebar_state="collapsed")
|
| 11 |
|
| 12 |
-
# --- 2. CSS "BLOQUE SÓLIDO" (
|
| 13 |
st.markdown("""
|
| 14 |
<style>
|
| 15 |
-
/* Importar Fuentes */
|
| 16 |
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500&family=Inter:wght@300;400;500;600&display=swap');
|
| 17 |
|
| 18 |
-
/* Forzar
|
| 19 |
:root { --primary-color: #000; --background-color: #fff; --secondary-background-color: #fff; --text-color: #000; --font: "Inter", sans-serif; }
|
| 20 |
html, body, [data-testid="stAppViewContainer"], [data-testid="stHeader"], [data-testid="stSidebar"] {
|
| 21 |
background-color: #ffffff !important;
|
|
@@ -26,16 +25,14 @@ st.markdown("""
|
|
| 26 |
/* Ocultar elementos nativos */
|
| 27 |
#MainMenu, footer, header, [data-testid="stToolbar"] {display: none !important;}
|
| 28 |
.stDeployButton {display: none;}
|
| 29 |
-
|
| 30 |
-
/* Ocultar botón cerrar nativo del sidebar */
|
| 31 |
-
[data-testid="stSidebar"] button[kind="header"] {display: none;}
|
| 32 |
|
| 33 |
-
/* ===
|
| 34 |
.nav-wrapper {
|
| 35 |
position: relative;
|
| 36 |
-
width:
|
| 37 |
-
height:
|
| 38 |
-
margin: 0 auto;
|
| 39 |
display: flex;
|
| 40 |
align-items: center;
|
| 41 |
justify-content: center;
|
|
@@ -48,120 +45,97 @@ st.markdown("""
|
|
| 48 |
position: absolute;
|
| 49 |
top: 0;
|
| 50 |
left: 0;
|
| 51 |
-
z-index: 1;
|
| 52 |
}
|
| 53 |
|
| 54 |
-
/*
|
| 55 |
.nav-wrapper button {
|
| 56 |
position: absolute !important;
|
| 57 |
-
top: -
|
| 58 |
-
left: -
|
| 59 |
-
width:
|
| 60 |
-
height:
|
| 61 |
z-index: 10 !important;
|
| 62 |
-
opacity: 0 !important; /*
|
| 63 |
background: red !important;
|
| 64 |
border: none !important;
|
| 65 |
cursor: pointer !important;
|
| 66 |
}
|
| 67 |
-
.nav-wrapper button:
|
| 68 |
background: transparent !important;
|
| 69 |
border: none !important;
|
| 70 |
outline: none !important;
|
| 71 |
}
|
| 72 |
|
| 73 |
-
/* === LOGO === */
|
| 74 |
-
.
|
|
|
|
|
|
|
| 75 |
text-align: center;
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
height: 35px; /* Altura del logo */
|
| 83 |
-
object-fit: contain;
|
| 84 |
-
}
|
| 85 |
-
/* Botón invisible sobre el logo para ir a Home */
|
| 86 |
-
.logo-btn button {
|
| 87 |
-
position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; z-index: 20;
|
| 88 |
}
|
| 89 |
|
| 90 |
-
/* === SEARCH
|
| 91 |
-
.search-
|
| 92 |
border-bottom: 1px solid #000;
|
| 93 |
padding-bottom: 20px;
|
| 94 |
margin-bottom: 30px;
|
| 95 |
-
animation: fadeIn 0.
|
| 96 |
}
|
| 97 |
[data-testid="stTextInput"] input {
|
| 98 |
border: none !important;
|
| 99 |
border-bottom: 1px solid #eee !important;
|
| 100 |
-
|
| 101 |
font-size: 16px !important;
|
|
|
|
| 102 |
color: black !important;
|
| 103 |
-
border-radius: 0 !important;
|
| 104 |
padding: 10px 0 !important;
|
| 105 |
}
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
/* === SIDEBAR ITEMS === */
|
| 109 |
.drawer-btn button {
|
| 110 |
-
text-align: left !important;
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
border-bottom: 1px solid #f9f9f9 !important;
|
| 114 |
-
width: 100% !important;
|
| 115 |
-
padding: 15px 0 !important;
|
| 116 |
-
font-size: 13px !important;
|
| 117 |
-
text-transform: uppercase !important;
|
| 118 |
-
letter-spacing: 2px !important;
|
| 119 |
-
color: black !important;
|
| 120 |
-
border-radius: 0 !important;
|
| 121 |
}
|
| 122 |
-
.drawer-btn button:hover { padding-left: 10px !important; font-weight:
|
| 123 |
|
| 124 |
-
/* === BOTONES ACCIÓN === */
|
| 125 |
-
/* Shop Now (Blanco) */
|
| 126 |
-
.shop-btn button {
|
| 127 |
-
background: white !important; border: 1px solid #e0e0e0 !important; color: black !important;
|
| 128 |
-
text-transform: uppercase; font-size: 11px !important; letter-spacing: 1px; padding: 12px 0 !important; width: 100%; border-radius: 0 !important;
|
| 129 |
-
}
|
| 130 |
-
.shop-btn button:hover { border-color: black !important; background: black !important; color: white !important; }
|
| 131 |
-
|
| 132 |
-
/* Add to Bag (Negro) */
|
| 133 |
.black-btn button {
|
| 134 |
background: black !important; color: white !important; border: 1px solid black !important;
|
| 135 |
-
text-transform: uppercase; font-size: 12px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
}
|
| 137 |
-
.black-btn button:hover { opacity: 0.8; }
|
| 138 |
|
| 139 |
@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }
|
| 140 |
|
| 141 |
/* Ajustes Grid */
|
| 142 |
-
.p-title {
|
| 143 |
-
.p-price {
|
| 144 |
</style>
|
| 145 |
""", unsafe_allow_html=True)
|
| 146 |
|
| 147 |
-
# --- 3.
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
try:
|
| 151 |
with open(filename, "rb") as f:
|
| 152 |
return base64.b64encode(f.read()).decode()
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
ICON_BAG = load_img("bag.png")
|
| 163 |
-
|
| 164 |
-
# Credenciales Google Sheets
|
| 165 |
secret_dict = {
|
| 166 |
"type": "service_account",
|
| 167 |
"project_id": "trhhats",
|
|
@@ -188,11 +162,11 @@ def cargar_catalogo():
|
|
| 188 |
df = pd.DataFrame(sh.worksheet(HOJA_NOMBRE).get_all_records())
|
| 189 |
if 'Imagen' not in df.columns: return pd.DataFrame()
|
| 190 |
df['Imagen'] = df['Imagen'].astype(str)
|
|
|
|
| 191 |
return df
|
| 192 |
except: return pd.DataFrame()
|
| 193 |
|
| 194 |
-
|
| 195 |
-
if 'active_drawer' not in st.session_state: st.session_state.active_drawer = None # 'menu', 'cart', None
|
| 196 |
if 'search_open' not in st.session_state: st.session_state.search_open = False
|
| 197 |
if 'cart' not in st.session_state: st.session_state.cart = []
|
| 198 |
if 'wishlist' not in st.session_state: st.session_state.wishlist = []
|
|
@@ -204,70 +178,66 @@ if 'search_query' not in st.session_state: st.session_state.search_query = ""
|
|
| 204 |
df = cargar_catalogo()
|
| 205 |
|
| 206 |
# ==========================================
|
| 207 |
-
# ⚡ HEADER
|
| 208 |
# ==========================================
|
|
|
|
| 209 |
c1, c2, c3, c4, c5, c6 = st.columns([0.5, 0.5, 3, 0.5, 0.5, 0.5])
|
| 210 |
|
| 211 |
-
def
|
| 212 |
with col:
|
| 213 |
-
#
|
| 214 |
if img_b64:
|
| 215 |
st.markdown(f'<div class="nav-wrapper"><img src="data:image/png;base64,{img_b64}" class="nav-img"></div>', unsafe_allow_html=True)
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
# 2. Botón Invisible Encima
|
| 220 |
-
st.markdown(f'<div class="nav-wrapper" style="margin-top:-24px;"><div class="nav-btn-hack"></div>', unsafe_allow_html=True)
|
| 221 |
if st.button(" ", key=key):
|
| 222 |
callback()
|
| 223 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 224 |
|
| 225 |
# ACCIONES
|
| 226 |
-
def toggle_menu():
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
def
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
st.session_state.search_open = False
|
| 235 |
-
def go_home():
|
| 236 |
-
st.session_state.page = 'home'; st.session_state.active_drawer = None; st.session_state.search_open = False
|
| 237 |
-
def go_wish():
|
| 238 |
-
st.session_state.page = 'wishlist'; st.session_state.active_drawer = None
|
| 239 |
-
|
| 240 |
-
# RENDERIZADO
|
| 241 |
-
img_btn(c1, ICON_MENU, "b_menu", toggle_menu)
|
| 242 |
-
img_btn(c2, ICON_SEARCH, "b_search", toggle_search)
|
| 243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
with c3:
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
# Boton invisible sobre logo
|
| 251 |
-
st.markdown('<div class="logo-btn" style="position:relative; height:40px; margin-top:-40px;">', unsafe_allow_html=True)
|
| 252 |
-
if st.button(" ", key="b_logo"): go_home()
|
| 253 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 254 |
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
|
| 259 |
|
| 260 |
# ==========================================
|
| 261 |
# 🔍 SEARCH OVERLAY
|
| 262 |
# ==========================================
|
| 263 |
if st.session_state.search_open:
|
| 264 |
-
st.markdown('<div class="search-
|
| 265 |
sc1, sc2 = st.columns([10, 1])
|
| 266 |
with sc1:
|
| 267 |
q = st.text_input("SEARCH", value=st.session_state.search_query, placeholder="TYPE TO SEARCH...", label_visibility="collapsed")
|
| 268 |
with sc2:
|
| 269 |
-
|
| 270 |
-
|
|
|
|
|
|
|
|
|
|
| 271 |
if q != st.session_state.search_query:
|
| 272 |
st.session_state.search_query = q
|
| 273 |
st.rerun()
|
|
@@ -281,35 +251,35 @@ if st.session_state.search_open:
|
|
| 281 |
|
| 282 |
|
| 283 |
# ==========================================
|
| 284 |
-
# 📂 DRAWERS (
|
| 285 |
# ==========================================
|
| 286 |
if st.session_state.active_drawer:
|
| 287 |
with st.sidebar:
|
| 288 |
-
# Boton Cerrar
|
| 289 |
if st.button("✕ CLOSE", key="close_side"):
|
| 290 |
st.session_state.active_drawer = None
|
| 291 |
st.rerun()
|
| 292 |
|
|
|
|
| 293 |
if st.session_state.active_drawer == 'menu':
|
| 294 |
st.write("")
|
| 295 |
cats = ["VIEW ALL"]
|
| 296 |
if not df.empty and 'Categoria' in df.columns:
|
| 297 |
cats += sorted(list(df['Categoria'].unique()))
|
| 298 |
-
|
| 299 |
for cat in cats:
|
| 300 |
st.markdown('<div class="drawer-btn">', unsafe_allow_html=True)
|
| 301 |
-
if st.button(cat, key=f"
|
| 302 |
st.session_state.category_filter = cat
|
| 303 |
st.session_state.page = 'home'
|
| 304 |
st.session_state.active_drawer = None
|
| 305 |
st.rerun()
|
| 306 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 307 |
|
|
|
|
| 308 |
elif st.session_state.active_drawer == 'cart':
|
| 309 |
-
st.markdown("<h4 style='text-align:center; letter-spacing:2px; text-transform:uppercase;
|
| 310 |
-
|
| 311 |
if not st.session_state.cart:
|
| 312 |
-
st.markdown("<div style='text-align:center;
|
| 313 |
st.markdown('<div class="black-btn">', unsafe_allow_html=True)
|
| 314 |
if st.button("CONTINUE SHOPPING"):
|
| 315 |
st.session_state.active_drawer = None
|
|
@@ -330,9 +300,8 @@ if st.session_state.active_drawer:
|
|
| 330 |
try: total += float(str(item['price']).replace(",","").replace("$",""))
|
| 331 |
except: pass
|
| 332 |
st.divider()
|
| 333 |
-
|
| 334 |
st.markdown(f"<div style='text-align:right; font-weight:bold; margin-bottom:15px;'>TOTAL: ${total:,.2f}</div>", unsafe_allow_html=True)
|
| 335 |
-
msg = "PEDIDO ARZON:
|
| 336 |
link = f"https://api.whatsapp.com/send?phone={WHATSAPP_VENTAS}&text={quote_plus(msg)}"
|
| 337 |
st.markdown('<div class="black-btn">', unsafe_allow_html=True)
|
| 338 |
st.link_button("CHECKOUT", link)
|
|
@@ -387,6 +356,7 @@ elif st.session_state.page == 'product':
|
|
| 387 |
if st.button("ADD TO BAG"):
|
| 388 |
st.session_state.cart.append({"id": p['ID'], "name": p['Producto'], "price": p['Precio'], "size": size, "img": p['Imagen']})
|
| 389 |
st.session_state.active_drawer = 'cart'
|
|
|
|
| 390 |
st.rerun()
|
| 391 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 392 |
st.markdown("---")
|
|
@@ -394,6 +364,7 @@ elif st.session_state.page == 'product':
|
|
| 394 |
|
| 395 |
elif st.session_state.page == 'wishlist':
|
| 396 |
st.markdown("<h3 style='text-align:center;'>WISHLIST</h3>", unsafe_allow_html=True)
|
|
|
|
| 397 |
if not st.session_state.wishlist: st.info("Nothing here.")
|
| 398 |
cols = st.columns(3)
|
| 399 |
for i, item in enumerate(st.session_state.wishlist):
|
|
|
|
| 6 |
import base64
|
| 7 |
import os
|
| 8 |
|
| 9 |
+
# --- 1. CONFIGURACIÓN ---
|
| 10 |
st.set_page_config(page_title="ARZON STUDIOS", layout="wide", initial_sidebar_state="collapsed")
|
| 11 |
|
| 12 |
+
# --- 2. CSS "BLOQUE SÓLIDO" (ESTILO AMIRI + CERO TEMBLOR) ---
|
| 13 |
st.markdown("""
|
| 14 |
<style>
|
|
|
|
| 15 |
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500&family=Inter:wght@300;400;500;600&display=swap');
|
| 16 |
|
| 17 |
+
/* Forzar Blanco Absoluto */
|
| 18 |
:root { --primary-color: #000; --background-color: #fff; --secondary-background-color: #fff; --text-color: #000; --font: "Inter", sans-serif; }
|
| 19 |
html, body, [data-testid="stAppViewContainer"], [data-testid="stHeader"], [data-testid="stSidebar"] {
|
| 20 |
background-color: #ffffff !important;
|
|
|
|
| 25 |
/* Ocultar elementos nativos */
|
| 26 |
#MainMenu, footer, header, [data-testid="stToolbar"] {display: none !important;}
|
| 27 |
.stDeployButton {display: none;}
|
| 28 |
+
[data-testid="stSidebar"] button[kind="header"] {display: none;} /* Ocultar X nativa */
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
/* === CONTENEDOR DE ICONOS (ESTRUCTURA FIJA) === */
|
| 31 |
.nav-wrapper {
|
| 32 |
position: relative;
|
| 33 |
+
width: 22px; /* Tamaño fijo para evitar saltos */
|
| 34 |
+
height: 22px;
|
| 35 |
+
margin: 0 auto;
|
| 36 |
display: flex;
|
| 37 |
align-items: center;
|
| 38 |
justify-content: center;
|
|
|
|
| 45 |
position: absolute;
|
| 46 |
top: 0;
|
| 47 |
left: 0;
|
| 48 |
+
z-index: 1;
|
| 49 |
}
|
| 50 |
|
| 51 |
+
/* Botón Invisible (Click) */
|
| 52 |
.nav-wrapper button {
|
| 53 |
position: absolute !important;
|
| 54 |
+
top: -10px !important;
|
| 55 |
+
left: -10px !important;
|
| 56 |
+
width: 40px !important; /* Área de clic más grande */
|
| 57 |
+
height: 40px !important;
|
| 58 |
z-index: 10 !important;
|
| 59 |
+
opacity: 0 !important; /* INVISIBLE */
|
| 60 |
background: red !important;
|
| 61 |
border: none !important;
|
| 62 |
cursor: pointer !important;
|
| 63 |
}
|
| 64 |
+
.nav-wrapper button:active, .nav-wrapper button:focus {
|
| 65 |
background: transparent !important;
|
| 66 |
border: none !important;
|
| 67 |
outline: none !important;
|
| 68 |
}
|
| 69 |
|
| 70 |
+
/* === LOGO TEXTO === */
|
| 71 |
+
.brand-logo {
|
| 72 |
+
font-family: 'Playfair Display', serif;
|
| 73 |
+
font-size: 38px;
|
| 74 |
text-align: center;
|
| 75 |
+
letter-spacing: 4px;
|
| 76 |
+
color: #000;
|
| 77 |
+
text-transform: uppercase;
|
| 78 |
+
margin-top: -12px;
|
| 79 |
+
cursor: pointer;
|
| 80 |
+
white-space: nowrap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
}
|
| 82 |
|
| 83 |
+
/* === SEARCH BAR === */
|
| 84 |
+
.search-container {
|
| 85 |
border-bottom: 1px solid #000;
|
| 86 |
padding-bottom: 20px;
|
| 87 |
margin-bottom: 30px;
|
| 88 |
+
animation: fadeIn 0.2s;
|
| 89 |
}
|
| 90 |
[data-testid="stTextInput"] input {
|
| 91 |
border: none !important;
|
| 92 |
border-bottom: 1px solid #eee !important;
|
| 93 |
+
border-radius: 0 !important;
|
| 94 |
font-size: 16px !important;
|
| 95 |
+
background: transparent !important;
|
| 96 |
color: black !important;
|
|
|
|
| 97 |
padding: 10px 0 !important;
|
| 98 |
}
|
| 99 |
+
|
| 100 |
+
/* === SIDEBAR & BOTONES === */
|
|
|
|
| 101 |
.drawer-btn button {
|
| 102 |
+
text-align: left !important; background: transparent !important; border: none !important;
|
| 103 |
+
border-bottom: 1px solid #f9f9f9 !important; width: 100% !important; padding: 15px 0 !important;
|
| 104 |
+
font-size: 13px !important; text-transform: uppercase !important; letter-spacing: 2px !important; color: black !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
}
|
| 106 |
+
.drawer-btn button:hover { padding-left: 10px !important; font-weight: bold !important; }
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
.black-btn button {
|
| 109 |
background: black !important; color: white !important; border: 1px solid black !important;
|
| 110 |
+
text-transform: uppercase; letter-spacing: 2px; font-size: 12px !important; padding: 16px !important; width: 100%; border-radius: 0 !important;
|
| 111 |
+
}
|
| 112 |
+
.shop-btn button {
|
| 113 |
+
background: white !important; border: 1px solid #ddd !important; color: black !important;
|
| 114 |
+
text-transform: uppercase; font-size: 11px !important; letter-spacing: 1px; padding: 12px 0 !important; width: 100%; border-radius: 0 !important;
|
| 115 |
}
|
|
|
|
| 116 |
|
| 117 |
@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }
|
| 118 |
|
| 119 |
/* Ajustes Grid */
|
| 120 |
+
.p-title {font-size: 12px; font-weight: 700; text-transform: uppercase; text-align: center; margin-top: 15px; color: #000;}
|
| 121 |
+
.p-price {font-size: 12px; text-align: center; color: #666; margin-bottom: 15px;}
|
| 122 |
</style>
|
| 123 |
""", unsafe_allow_html=True)
|
| 124 |
|
| 125 |
+
# --- 3. CARGA DE IMÁGENES ---
|
| 126 |
+
def get_img(filename):
|
| 127 |
+
if os.path.exists(filename):
|
|
|
|
| 128 |
with open(filename, "rb") as f:
|
| 129 |
return base64.b64encode(f.read()).decode()
|
| 130 |
+
return ""
|
| 131 |
+
|
| 132 |
+
# Cargar solo lo necesario
|
| 133 |
+
ico_menu = get_img("menu.png")
|
| 134 |
+
ico_search = get_img("search.png")
|
| 135 |
+
ico_wish = get_img("wish.png")
|
| 136 |
+
ico_bag = get_img("bag.png")
|
| 137 |
+
|
| 138 |
+
# --- 4. DATOS Y ESTADO ---
|
|
|
|
|
|
|
|
|
|
| 139 |
secret_dict = {
|
| 140 |
"type": "service_account",
|
| 141 |
"project_id": "trhhats",
|
|
|
|
| 162 |
df = pd.DataFrame(sh.worksheet(HOJA_NOMBRE).get_all_records())
|
| 163 |
if 'Imagen' not in df.columns: return pd.DataFrame()
|
| 164 |
df['Imagen'] = df['Imagen'].astype(str)
|
| 165 |
+
df = df[df['Imagen'].str.strip().str.startswith(('http://', 'https://'))]
|
| 166 |
return df
|
| 167 |
except: return pd.DataFrame()
|
| 168 |
|
| 169 |
+
if 'active_drawer' not in st.session_state: st.session_state.active_drawer = None
|
|
|
|
| 170 |
if 'search_open' not in st.session_state: st.session_state.search_open = False
|
| 171 |
if 'cart' not in st.session_state: st.session_state.cart = []
|
| 172 |
if 'wishlist' not in st.session_state: st.session_state.wishlist = []
|
|
|
|
| 178 |
df = cargar_catalogo()
|
| 179 |
|
| 180 |
# ==========================================
|
| 181 |
+
# ⚡ HEADER SIN USUARIO NI LOGO-IMAGEN
|
| 182 |
# ==========================================
|
| 183 |
+
# Usamos columnas: [Menú] [Search] [LOGO TEXTO] [Vacio] [Wish] [Bag]
|
| 184 |
c1, c2, c3, c4, c5, c6 = st.columns([0.5, 0.5, 3, 0.5, 0.5, 0.5])
|
| 185 |
|
| 186 |
+
def render_btn(col, img_b64, key, callback):
|
| 187 |
with col:
|
| 188 |
+
# Imagen fija
|
| 189 |
if img_b64:
|
| 190 |
st.markdown(f'<div class="nav-wrapper"><img src="data:image/png;base64,{img_b64}" class="nav-img"></div>', unsafe_allow_html=True)
|
| 191 |
+
# Botón invisible
|
| 192 |
+
st.markdown('<div class="nav-wrapper" style="margin-top:-22px;">', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
| 193 |
if st.button(" ", key=key):
|
| 194 |
callback()
|
| 195 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 196 |
|
| 197 |
# ACCIONES
|
| 198 |
+
def toggle_menu(): st.session_state.active_drawer = 'menu' if st.session_state.active_drawer != 'menu' else None; st.session_state.search_open = False
|
| 199 |
+
def toggle_search(): st.session_state.search_open = not st.session_state.search_open; st.session_state.active_drawer = None
|
| 200 |
+
def toggle_cart(): st.session_state.active_drawer = 'cart' if st.session_state.active_drawer != 'cart' else None; st.session_state.search_open = False
|
| 201 |
+
def go_home(): st.session_state.page = 'home'; st.session_state.active_drawer = None; st.session_state.search_open = False
|
| 202 |
+
def go_wish(): st.session_state.page = 'wishlist'; st.session_state.active_drawer = None; st.session_state.search_open = False
|
| 203 |
+
|
| 204 |
+
# 1. MENU
|
| 205 |
+
render_btn(c1, ico_menu, "mn_btn", toggle_menu)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
|
| 207 |
+
# 2. SEARCH
|
| 208 |
+
render_btn(c2, ico_search, "sr_btn", toggle_search)
|
| 209 |
+
|
| 210 |
+
# 3. LOGO (TEXTO PURO)
|
| 211 |
with c3:
|
| 212 |
+
st.markdown('<div class="brand-logo">ARZON STUDIOS</div>', unsafe_allow_html=True)
|
| 213 |
+
# Botón invisible grande sobre el texto
|
| 214 |
+
st.markdown('<div class="nav-wrapper" style="width:200px; height:40px; margin-top:-40px;">', unsafe_allow_html=True)
|
| 215 |
+
if st.button(" ", key="logo_reset"): go_home()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 217 |
|
| 218 |
+
# 4. VACÍO (Donde estaba User) - No renderizamos nada
|
| 219 |
+
|
| 220 |
+
# 5. WISHLIST
|
| 221 |
+
render_btn(c5, ico_wish, "ws_btn", go_wish)
|
| 222 |
+
|
| 223 |
+
# 6. BAG
|
| 224 |
+
render_btn(c6, ico_bag, "bg_btn", toggle_cart)
|
| 225 |
|
| 226 |
|
| 227 |
# ==========================================
|
| 228 |
# 🔍 SEARCH OVERLAY
|
| 229 |
# ==========================================
|
| 230 |
if st.session_state.search_open:
|
| 231 |
+
st.markdown('<div class="search-container">', unsafe_allow_html=True)
|
| 232 |
sc1, sc2 = st.columns([10, 1])
|
| 233 |
with sc1:
|
| 234 |
q = st.text_input("SEARCH", value=st.session_state.search_query, placeholder="TYPE TO SEARCH...", label_visibility="collapsed")
|
| 235 |
with sc2:
|
| 236 |
+
# Botón cerrar simple texto X
|
| 237 |
+
if st.button("✕", key="cls_src"):
|
| 238 |
+
st.session_state.search_open = False
|
| 239 |
+
st.rerun()
|
| 240 |
+
|
| 241 |
if q != st.session_state.search_query:
|
| 242 |
st.session_state.search_query = q
|
| 243 |
st.rerun()
|
|
|
|
| 251 |
|
| 252 |
|
| 253 |
# ==========================================
|
| 254 |
+
# 📂 DRAWERS (MENU / CART)
|
| 255 |
# ==========================================
|
| 256 |
if st.session_state.active_drawer:
|
| 257 |
with st.sidebar:
|
| 258 |
+
# Boton Cerrar
|
| 259 |
if st.button("✕ CLOSE", key="close_side"):
|
| 260 |
st.session_state.active_drawer = None
|
| 261 |
st.rerun()
|
| 262 |
|
| 263 |
+
# CONTENIDO MENU
|
| 264 |
if st.session_state.active_drawer == 'menu':
|
| 265 |
st.write("")
|
| 266 |
cats = ["VIEW ALL"]
|
| 267 |
if not df.empty and 'Categoria' in df.columns:
|
| 268 |
cats += sorted(list(df['Categoria'].unique()))
|
|
|
|
| 269 |
for cat in cats:
|
| 270 |
st.markdown('<div class="drawer-btn">', unsafe_allow_html=True)
|
| 271 |
+
if st.button(cat, key=f"c_{cat}"):
|
| 272 |
st.session_state.category_filter = cat
|
| 273 |
st.session_state.page = 'home'
|
| 274 |
st.session_state.active_drawer = None
|
| 275 |
st.rerun()
|
| 276 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 277 |
|
| 278 |
+
# CONTENIDO CARRITO
|
| 279 |
elif st.session_state.active_drawer == 'cart':
|
| 280 |
+
st.markdown("<h4 style='text-align:center; letter-spacing:2px; text-transform:uppercase;'>Shopping Bag</h4>", unsafe_allow_html=True)
|
|
|
|
| 281 |
if not st.session_state.cart:
|
| 282 |
+
st.markdown("<br><div style='text-align:center; font-size:13px; color:#555;'>Your bag is empty</div><br>", unsafe_allow_html=True)
|
| 283 |
st.markdown('<div class="black-btn">', unsafe_allow_html=True)
|
| 284 |
if st.button("CONTINUE SHOPPING"):
|
| 285 |
st.session_state.active_drawer = None
|
|
|
|
| 300 |
try: total += float(str(item['price']).replace(",","").replace("$",""))
|
| 301 |
except: pass
|
| 302 |
st.divider()
|
|
|
|
| 303 |
st.markdown(f"<div style='text-align:right; font-weight:bold; margin-bottom:15px;'>TOTAL: ${total:,.2f}</div>", unsafe_allow_html=True)
|
| 304 |
+
msg = f"PEDIDO ARZON: ${total}"
|
| 305 |
link = f"https://api.whatsapp.com/send?phone={WHATSAPP_VENTAS}&text={quote_plus(msg)}"
|
| 306 |
st.markdown('<div class="black-btn">', unsafe_allow_html=True)
|
| 307 |
st.link_button("CHECKOUT", link)
|
|
|
|
| 356 |
if st.button("ADD TO BAG"):
|
| 357 |
st.session_state.cart.append({"id": p['ID'], "name": p['Producto'], "price": p['Precio'], "size": size, "img": p['Imagen']})
|
| 358 |
st.session_state.active_drawer = 'cart'
|
| 359 |
+
st.toast("Added!")
|
| 360 |
st.rerun()
|
| 361 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 362 |
st.markdown("---")
|
|
|
|
| 364 |
|
| 365 |
elif st.session_state.page == 'wishlist':
|
| 366 |
st.markdown("<h3 style='text-align:center;'>WISHLIST</h3>", unsafe_allow_html=True)
|
| 367 |
+
st.divider()
|
| 368 |
if not st.session_state.wishlist: st.info("Nothing here.")
|
| 369 |
cols = st.columns(3)
|
| 370 |
for i, item in enumerate(st.session_state.wishlist):
|