Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,22 +3,11 @@ import pandas as pd
|
|
| 3 |
from google.oauth2.service_account import Credentials
|
| 4 |
import gspread
|
| 5 |
from urllib.parse import quote_plus
|
| 6 |
-
import base64
|
| 7 |
-
from PIL import Image
|
| 8 |
-
import io
|
| 9 |
|
| 10 |
# --- 1. CONFIGURACIÓN ---
|
| 11 |
st.set_page_config(page_title="ARZON STUDIOS", layout="wide", initial_sidebar_state="collapsed")
|
| 12 |
|
| 13 |
-
# --- 2.
|
| 14 |
-
def load_image(image_path):
|
| 15 |
-
"""Carga una imagen local como objeto PIL"""
|
| 16 |
-
try:
|
| 17 |
-
return Image.open(image_path)
|
| 18 |
-
except:
|
| 19 |
-
return None
|
| 20 |
-
|
| 21 |
-
# --- 3. CSS MAESTRO ---
|
| 22 |
st.markdown("""
|
| 23 |
<style>
|
| 24 |
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500&family=Inter:wght@300;400;500;600&display=swap');
|
|
@@ -40,48 +29,52 @@ st.markdown("""
|
|
| 40 |
display: flex;
|
| 41 |
align-items: center;
|
| 42 |
justify-content: space-between;
|
| 43 |
-
padding:
|
| 44 |
border-bottom: 1px solid #eee;
|
| 45 |
margin-bottom: 30px;
|
| 46 |
}
|
| 47 |
|
| 48 |
-
.nav-
|
| 49 |
display: flex;
|
| 50 |
-
flex-direction: column;
|
| 51 |
align-items: center;
|
| 52 |
-
gap:
|
| 53 |
}
|
| 54 |
|
| 55 |
-
.nav-
|
| 56 |
-
|
| 57 |
-
height: 24px;
|
| 58 |
}
|
| 59 |
|
| 60 |
-
.nav-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
color: #000;
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
}
|
| 66 |
|
| 67 |
.brand-logo {
|
| 68 |
font-family: 'Playfair Display', serif;
|
| 69 |
-
font-size:
|
| 70 |
-
letter-spacing:
|
| 71 |
color: #000;
|
| 72 |
text-transform: uppercase;
|
| 73 |
-
|
| 74 |
}
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
border: none !important;
|
| 79 |
-
background: transparent !important;
|
| 80 |
-
box-shadow: none !important;
|
| 81 |
-
padding: 5px !important;
|
| 82 |
}
|
| 83 |
|
| 84 |
-
/*
|
| 85 |
button[kind="primary"] {
|
| 86 |
background-color: #000000 !important;
|
| 87 |
color: #ffffff !important;
|
|
@@ -114,6 +107,34 @@ st.markdown("""
|
|
| 114 |
border-right: 1px solid #eee;
|
| 115 |
}
|
| 116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
/* === TOAST === */
|
| 118 |
.toast-success {
|
| 119 |
position: fixed;
|
|
@@ -135,7 +156,7 @@ st.markdown("""
|
|
| 135 |
</style>
|
| 136 |
""", unsafe_allow_html=True)
|
| 137 |
|
| 138 |
-
# ---
|
| 139 |
secret_dict = {
|
| 140 |
"type": "service_account",
|
| 141 |
"project_id": "trhhats",
|
|
@@ -171,35 +192,27 @@ def cargar_catalogo():
|
|
| 171 |
return pd.DataFrame()
|
| 172 |
|
| 173 |
# --- ESTADOS INICIALES ---
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
st.session_state.toast_message = None
|
| 193 |
|
| 194 |
-
init_session_state()
|
| 195 |
df = cargar_catalogo()
|
| 196 |
|
| 197 |
-
# --- CARGAR IMÁGENES PNG ---
|
| 198 |
-
menu_img = load_image("menu.png")
|
| 199 |
-
search_img = load_image("search.png")
|
| 200 |
-
wish_img = load_image("wish.png")
|
| 201 |
-
bag_img = load_image("bag.png")
|
| 202 |
-
|
| 203 |
# --- FUNCIONES DE NAVEGACIÓN ---
|
| 204 |
def handle_menu():
|
| 205 |
st.session_state.active_drawer = 'menu' if st.session_state.active_drawer != 'menu' else None
|
|
@@ -229,62 +242,36 @@ def handle_home():
|
|
| 229 |
st.session_state.selected_product = None
|
| 230 |
st.rerun()
|
| 231 |
|
| 232 |
-
|
| 233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
|
| 235 |
-
# MENU
|
| 236 |
with col1:
|
| 237 |
-
|
| 238 |
-
if menu_img:
|
| 239 |
-
st.image(menu_img, width=24)
|
| 240 |
-
else:
|
| 241 |
-
st.markdown("<div style='text-align:center; font-size:24px;'>☰</div>", unsafe_allow_html=True)
|
| 242 |
-
if st.button("MENU", key="menu_btn", help="Menu", use_container_width=True):
|
| 243 |
-
handle_menu()
|
| 244 |
|
| 245 |
-
# SEARCH
|
| 246 |
with col2:
|
| 247 |
-
|
| 248 |
-
if search_img:
|
| 249 |
-
st.image(search_img, width=24)
|
| 250 |
-
else:
|
| 251 |
-
st.markdown("<div style='text-align:center; font-size:24px;'>🔍</div>", unsafe_allow_html=True)
|
| 252 |
-
if st.button("SEARCH", key="search_btn", help="Search", use_container_width=True):
|
| 253 |
-
handle_search()
|
| 254 |
|
| 255 |
-
# LOGO
|
| 256 |
with col3:
|
| 257 |
st.markdown("<div style='text-align:center;'><span class='brand-logo'>ARZON STUDIOS</span></div>", unsafe_allow_html=True)
|
| 258 |
-
|
| 259 |
-
handle_home()
|
| 260 |
|
| 261 |
-
# WISHLIST
|
| 262 |
with col4:
|
| 263 |
-
|
| 264 |
-
if wish_img:
|
| 265 |
-
st.image(wish_img, width=24)
|
| 266 |
-
else:
|
| 267 |
-
st.markdown("<div style='text-align:center; font-size:24px;'>🔖</div>", unsafe_allow_html=True)
|
| 268 |
-
if st.button("WISHLIST", key="wishlist_btn", help="Wishlist", use_container_width=True):
|
| 269 |
-
handle_wishlist()
|
| 270 |
|
| 271 |
-
# BAG
|
| 272 |
with col5:
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
else:
|
| 277 |
-
st.markdown("<div style='text-align:center; font-size:24px;'>🛍️</div>", unsafe_allow_html=True)
|
| 278 |
-
|
| 279 |
-
# Contador del carrito
|
| 280 |
-
cart_count = len(st.session_state.cart)
|
| 281 |
-
if cart_count > 0:
|
| 282 |
-
st.markdown(f"<div style='background:black; color:white; border-radius:50%; width:20px; height:20px; display:flex; align-items:center; justify-content:center; font-size:12px; margin:0 auto;'>{cart_count}</div>", unsafe_allow_html=True)
|
| 283 |
-
|
| 284 |
-
if st.button("BAG", key="bag_btn", help="Shopping Bag", use_container_width=True):
|
| 285 |
-
handle_bag()
|
| 286 |
|
| 287 |
-
# Espacio
|
| 288 |
with col6:
|
| 289 |
st.empty()
|
| 290 |
|
|
@@ -310,13 +297,13 @@ if st.session_state.toast_message:
|
|
| 310 |
""", unsafe_allow_html=True)
|
| 311 |
st.session_state.toast_message = None
|
| 312 |
|
| 313 |
-
#
|
| 314 |
if st.session_state.search_open:
|
| 315 |
with st.container():
|
| 316 |
st.markdown("<br>", unsafe_allow_html=True)
|
| 317 |
-
|
| 318 |
|
| 319 |
-
with
|
| 320 |
query = st.text_input(
|
| 321 |
"Buscar",
|
| 322 |
value=st.session_state.search_query,
|
|
@@ -329,51 +316,40 @@ if st.session_state.search_open:
|
|
| 329 |
st.session_state.page = 'home'
|
| 330 |
st.rerun()
|
| 331 |
|
| 332 |
-
with
|
| 333 |
-
|
| 334 |
-
st.session_state.search_open = False
|
| 335 |
-
st.session_state.search_query = ""
|
| 336 |
-
st.rerun()
|
| 337 |
|
| 338 |
st.markdown("<p style='font-size:11px; font-weight:700; letter-spacing:1px; margin:20px 0 10px;'>POPULAR SEARCHES</p>", unsafe_allow_html=True)
|
| 339 |
|
| 340 |
-
|
| 341 |
-
with
|
| 342 |
if st.button("MEN'S DENIM", key="search_denim", use_container_width=True):
|
| 343 |
st.session_state.search_query = "denim"
|
| 344 |
st.session_state.page = 'home'
|
| 345 |
st.rerun()
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
st.rerun()
|
| 350 |
-
with col_cat2:
|
| 351 |
-
if st.button("NEW ARRIVALS", key="search_new", use_container_width=True):
|
| 352 |
-
st.session_state.category_filter = "NEW"
|
| 353 |
-
st.session_state.search_open = False
|
| 354 |
-
st.rerun()
|
| 355 |
st.markdown("---")
|
| 356 |
|
| 357 |
-
#
|
| 358 |
if st.session_state.active_drawer:
|
| 359 |
with st.sidebar:
|
| 360 |
-
|
| 361 |
-
with
|
| 362 |
title = 'MENU' if st.session_state.active_drawer == 'menu' else 'SHOPPING BAG'
|
| 363 |
st.markdown(f"<h3 style='letter-spacing:2px; margin:0;'>{title}</h3>", unsafe_allow_html=True)
|
| 364 |
-
with
|
| 365 |
-
|
| 366 |
-
st.session_state.active_drawer = None
|
| 367 |
-
st.rerun()
|
| 368 |
|
| 369 |
st.divider()
|
| 370 |
|
| 371 |
-
# MENU
|
| 372 |
if st.session_state.active_drawer == 'menu':
|
| 373 |
if st.button("VIEW ALL", key="cat_all", use_container_width=True):
|
| 374 |
st.session_state.category_filter = "VIEW ALL"
|
| 375 |
st.session_state.page = 'home'
|
| 376 |
-
|
| 377 |
st.rerun()
|
| 378 |
|
| 379 |
if not df.empty and 'Categoria' in df.columns:
|
|
@@ -382,26 +358,24 @@ if st.session_state.active_drawer:
|
|
| 382 |
if st.button(cat, key=f"cat_{cat}", use_container_width=True):
|
| 383 |
st.session_state.category_filter = cat
|
| 384 |
st.session_state.page = 'home'
|
| 385 |
-
|
| 386 |
st.rerun()
|
| 387 |
|
| 388 |
-
# CARRITO
|
| 389 |
elif st.session_state.active_drawer == 'cart':
|
| 390 |
if not st.session_state.cart:
|
| 391 |
st.markdown("<div style='text-align:center; margin:60px 0;'>Your bag is empty</div>", unsafe_allow_html=True)
|
| 392 |
-
|
| 393 |
-
st.session_state.active_drawer = None
|
| 394 |
-
st.rerun()
|
| 395 |
else:
|
| 396 |
total = 0
|
| 397 |
for i, item in enumerate(st.session_state.cart):
|
| 398 |
-
|
| 399 |
-
with
|
| 400 |
try:
|
| 401 |
st.image(item['img'], use_container_width=True)
|
| 402 |
except:
|
| 403 |
st.image("https://via.placeholder.com/100", use_container_width=True)
|
| 404 |
-
with
|
| 405 |
st.markdown(f"**{item['name']}**")
|
| 406 |
st.caption(f"Size: {item['size']}")
|
| 407 |
st.markdown(f"**${item['price']}**")
|
|
@@ -425,7 +399,7 @@ if st.session_state.active_drawer:
|
|
| 425 |
whatsapp_link = f"https://api.whatsapp.com/send?phone={WHATSAPP_VENTAS}&text={msg}"
|
| 426 |
st.link_button("CHECKOUT", whatsapp_link, type="primary", use_container_width=True)
|
| 427 |
|
| 428 |
-
#
|
| 429 |
if st.session_state.page == 'home':
|
| 430 |
df_show = df.copy() if not df.empty else pd.DataFrame()
|
| 431 |
|
|
@@ -450,15 +424,15 @@ if st.session_state.page == 'home':
|
|
| 450 |
st.markdown(f"<div style='text-align:center; font-weight:600; margin-top:10px;'>{row['Producto']}</div>", unsafe_allow_html=True)
|
| 451 |
st.markdown(f"<div style='text-align:center; color:#666; margin-bottom:15px;'>${row['Precio']} MXN</div>", unsafe_allow_html=True)
|
| 452 |
|
| 453 |
-
|
| 454 |
-
with
|
| 455 |
if st.button("SHOP NOW", key=f"shop_{row['ID']}", type="secondary", use_container_width=True):
|
| 456 |
st.session_state.selected_product = row.to_dict()
|
| 457 |
st.session_state.page = 'product'
|
| 458 |
st.rerun()
|
| 459 |
-
with
|
| 460 |
in_wishlist = any(item['ID'] == row['ID'] for item in st.session_state.wishlist)
|
| 461 |
-
btn_text = "❤️" if in_wishlist else "🤍"
|
| 462 |
if st.button(btn_text, key=f"wish_{row['ID']}", use_container_width=True):
|
| 463 |
if in_wishlist:
|
| 464 |
st.session_state.wishlist = [item for item in st.session_state.wishlist if item['ID'] != row['ID']]
|
|
@@ -468,23 +442,21 @@ if st.session_state.page == 'home':
|
|
| 468 |
st.session_state.toast_message = f"Added to wishlist"
|
| 469 |
st.rerun()
|
| 470 |
|
| 471 |
-
#
|
| 472 |
elif st.session_state.page == 'product':
|
| 473 |
if st.session_state.selected_product:
|
| 474 |
p = st.session_state.selected_product
|
| 475 |
|
| 476 |
-
|
| 477 |
-
st.session_state.page = 'home'
|
| 478 |
-
st.rerun()
|
| 479 |
|
| 480 |
-
|
| 481 |
-
with
|
| 482 |
try:
|
| 483 |
st.image(p['Imagen'], use_container_width=True)
|
| 484 |
except:
|
| 485 |
st.image("https://via.placeholder.com/600x700?text=ARZON", use_container_width=True)
|
| 486 |
|
| 487 |
-
with
|
| 488 |
st.markdown(f"<h1 style='font-size:32px;'>{p['Producto']}</h1>", unsafe_allow_html=True)
|
| 489 |
st.markdown(f"<h2 style='font-size:24px; font-weight:400; margin-bottom:20px;'>${p['Precio']} MXN</h2>", unsafe_allow_html=True)
|
| 490 |
|
|
@@ -506,15 +478,13 @@ elif st.session_state.page == 'product':
|
|
| 506 |
st.markdown("**DESCRIPTION**")
|
| 507 |
st.caption(p.get('Descripcion', 'No description available'))
|
| 508 |
|
| 509 |
-
#
|
| 510 |
elif st.session_state.page == 'wishlist':
|
| 511 |
st.markdown("<h1 style='text-align:center; margin:40px 0;'>WISHLIST</h1>", unsafe_allow_html=True)
|
| 512 |
|
| 513 |
if not st.session_state.wishlist:
|
| 514 |
st.info("Your wishlist is empty")
|
| 515 |
-
|
| 516 |
-
st.session_state.page = 'home'
|
| 517 |
-
st.rerun()
|
| 518 |
else:
|
| 519 |
cols = st.columns(3)
|
| 520 |
for i, item in enumerate(st.session_state.wishlist):
|
|
|
|
| 3 |
from google.oauth2.service_account import Credentials
|
| 4 |
import gspread
|
| 5 |
from urllib.parse import quote_plus
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# --- 1. CONFIGURACIÓN ---
|
| 8 |
st.set_page_config(page_title="ARZON STUDIOS", layout="wide", initial_sidebar_state="collapsed")
|
| 9 |
|
| 10 |
+
# --- 2. CSS MAESTRO ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
st.markdown("""
|
| 12 |
<style>
|
| 13 |
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500&family=Inter:wght@300;400;500;600&display=swap');
|
|
|
|
| 29 |
display: flex;
|
| 30 |
align-items: center;
|
| 31 |
justify-content: space-between;
|
| 32 |
+
padding: 20px 40px;
|
| 33 |
border-bottom: 1px solid #eee;
|
| 34 |
margin-bottom: 30px;
|
| 35 |
}
|
| 36 |
|
| 37 |
+
.nav-left, .nav-right {
|
| 38 |
display: flex;
|
|
|
|
| 39 |
align-items: center;
|
| 40 |
+
gap: 30px;
|
| 41 |
}
|
| 42 |
|
| 43 |
+
.nav-center {
|
| 44 |
+
text-align: center;
|
|
|
|
| 45 |
}
|
| 46 |
|
| 47 |
+
.nav-btn {
|
| 48 |
+
background: none !important;
|
| 49 |
+
border: none !important;
|
| 50 |
+
color: #000 !important;
|
| 51 |
+
font-size: 13px !important;
|
| 52 |
+
font-weight: 500 !important;
|
| 53 |
+
letter-spacing: 2px !important;
|
| 54 |
+
text-transform: uppercase !important;
|
| 55 |
+
padding: 8px 12px !important;
|
| 56 |
+
cursor: pointer !important;
|
| 57 |
+
box-shadow: none !important;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
.nav-btn:hover {
|
| 61 |
+
opacity: 0.6 !important;
|
| 62 |
}
|
| 63 |
|
| 64 |
.brand-logo {
|
| 65 |
font-family: 'Playfair Display', serif;
|
| 66 |
+
font-size: 32px;
|
| 67 |
+
letter-spacing: 8px;
|
| 68 |
color: #000;
|
| 69 |
text-transform: uppercase;
|
| 70 |
+
cursor: pointer;
|
| 71 |
}
|
| 72 |
|
| 73 |
+
.brand-logo:hover {
|
| 74 |
+
opacity: 0.7;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
}
|
| 76 |
|
| 77 |
+
/* === BOTONES DE ACCIÓN === */
|
| 78 |
button[kind="primary"] {
|
| 79 |
background-color: #000000 !important;
|
| 80 |
color: #ffffff !important;
|
|
|
|
| 107 |
border-right: 1px solid #eee;
|
| 108 |
}
|
| 109 |
|
| 110 |
+
[data-testid="stSidebar"] .stButton button {
|
| 111 |
+
width: 100%;
|
| 112 |
+
text-align: left;
|
| 113 |
+
background: transparent !important;
|
| 114 |
+
border: none !important;
|
| 115 |
+
border-bottom: 1px solid #f5f5f5 !important;
|
| 116 |
+
padding: 15px 0 !important;
|
| 117 |
+
border-radius: 0 !important;
|
| 118 |
+
font-size: 13px;
|
| 119 |
+
text-transform: uppercase;
|
| 120 |
+
letter-spacing: 2px;
|
| 121 |
+
color: black;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
/* === CART BADGE === */
|
| 125 |
+
.cart-badge {
|
| 126 |
+
background: black;
|
| 127 |
+
color: white;
|
| 128 |
+
border-radius: 50%;
|
| 129 |
+
width: 18px;
|
| 130 |
+
height: 18px;
|
| 131 |
+
display: inline-flex;
|
| 132 |
+
align-items: center;
|
| 133 |
+
justify-content: center;
|
| 134 |
+
font-size: 11px;
|
| 135 |
+
margin-left: 5px;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
/* === TOAST === */
|
| 139 |
.toast-success {
|
| 140 |
position: fixed;
|
|
|
|
| 156 |
</style>
|
| 157 |
""", unsafe_allow_html=True)
|
| 158 |
|
| 159 |
+
# --- 3. CONEXIÓN DATOS ---
|
| 160 |
secret_dict = {
|
| 161 |
"type": "service_account",
|
| 162 |
"project_id": "trhhats",
|
|
|
|
| 192 |
return pd.DataFrame()
|
| 193 |
|
| 194 |
# --- ESTADOS INICIALES ---
|
| 195 |
+
if 'cart' not in st.session_state:
|
| 196 |
+
st.session_state.cart = []
|
| 197 |
+
if 'wishlist' not in st.session_state:
|
| 198 |
+
st.session_state.wishlist = []
|
| 199 |
+
if 'page' not in st.session_state:
|
| 200 |
+
st.session_state.page = 'home'
|
| 201 |
+
if 'selected_product' not in st.session_state:
|
| 202 |
+
st.session_state.selected_product = None
|
| 203 |
+
if 'category_filter' not in st.session_state:
|
| 204 |
+
st.session_state.category_filter = "VIEW ALL"
|
| 205 |
+
if 'active_drawer' not in st.session_state:
|
| 206 |
+
st.session_state.active_drawer = None
|
| 207 |
+
if 'search_open' not in st.session_state:
|
| 208 |
+
st.session_state.search_open = False
|
| 209 |
+
if 'search_query' not in st.session_state:
|
| 210 |
+
st.session_state.search_query = ""
|
| 211 |
+
if 'toast_message' not in st.session_state:
|
| 212 |
+
st.session_state.toast_message = None
|
|
|
|
| 213 |
|
|
|
|
| 214 |
df = cargar_catalogo()
|
| 215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
# --- FUNCIONES DE NAVEGACIÓN ---
|
| 217 |
def handle_menu():
|
| 218 |
st.session_state.active_drawer = 'menu' if st.session_state.active_drawer != 'menu' else None
|
|
|
|
| 242 |
st.session_state.selected_product = None
|
| 243 |
st.rerun()
|
| 244 |
|
| 245 |
+
def close_drawer():
|
| 246 |
+
st.session_state.active_drawer = None
|
| 247 |
+
st.rerun()
|
| 248 |
+
|
| 249 |
+
def close_search():
|
| 250 |
+
st.session_state.search_open = False
|
| 251 |
+
st.session_state.search_query = ""
|
| 252 |
+
st.rerun()
|
| 253 |
+
|
| 254 |
+
# --- HEADER - SOLO BOTONES CON TEXTO (SIN ICONOS) ---
|
| 255 |
+
col1, col2, col3, col4, col5, col6 = st.columns([1, 1, 3, 1, 1, 0.5])
|
| 256 |
|
|
|
|
| 257 |
with col1:
|
| 258 |
+
st.button("MENU", key="menu_btn", use_container_width=True, on_click=handle_menu)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
|
|
|
|
| 260 |
with col2:
|
| 261 |
+
st.button("SEARCH", key="search_btn", use_container_width=True, on_click=handle_search)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
|
|
|
|
| 263 |
with col3:
|
| 264 |
st.markdown("<div style='text-align:center;'><span class='brand-logo'>ARZON STUDIOS</span></div>", unsafe_allow_html=True)
|
| 265 |
+
st.button("HOME", key="home_btn", use_container_width=True, on_click=handle_home)
|
|
|
|
| 266 |
|
|
|
|
| 267 |
with col4:
|
| 268 |
+
st.button("WISHLIST", key="wishlist_btn", use_container_width=True, on_click=handle_wishlist)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
|
|
|
|
| 270 |
with col5:
|
| 271 |
+
cart_count = len(st.session_state.cart)
|
| 272 |
+
btn_text = f"BAG ({cart_count})" if cart_count > 0 else "BAG"
|
| 273 |
+
st.button(btn_text, key="bag_btn", use_container_width=True, on_click=handle_bag)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
|
|
|
|
| 275 |
with col6:
|
| 276 |
st.empty()
|
| 277 |
|
|
|
|
| 297 |
""", unsafe_allow_html=True)
|
| 298 |
st.session_state.toast_message = None
|
| 299 |
|
| 300 |
+
# --- SEARCH OVERLAY ---
|
| 301 |
if st.session_state.search_open:
|
| 302 |
with st.container():
|
| 303 |
st.markdown("<br>", unsafe_allow_html=True)
|
| 304 |
+
col_s1, col_s2 = st.columns([8, 1])
|
| 305 |
|
| 306 |
+
with col_s1:
|
| 307 |
query = st.text_input(
|
| 308 |
"Buscar",
|
| 309 |
value=st.session_state.search_query,
|
|
|
|
| 316 |
st.session_state.page = 'home'
|
| 317 |
st.rerun()
|
| 318 |
|
| 319 |
+
with col_s2:
|
| 320 |
+
st.button("✕", key="close_search_btn", on_click=close_search)
|
|
|
|
|
|
|
|
|
|
| 321 |
|
| 322 |
st.markdown("<p style='font-size:11px; font-weight:700; letter-spacing:1px; margin:20px 0 10px;'>POPULAR SEARCHES</p>", unsafe_allow_html=True)
|
| 323 |
|
| 324 |
+
col_c1, col_c2, col_c3 = st.columns(3)
|
| 325 |
+
with col_c1:
|
| 326 |
if st.button("MEN'S DENIM", key="search_denim", use_container_width=True):
|
| 327 |
st.session_state.search_query = "denim"
|
| 328 |
st.session_state.page = 'home'
|
| 329 |
st.rerun()
|
| 330 |
+
st.button("WOMEN'S BAGS", key="search_bags", use_container_width=True)
|
| 331 |
+
with col_c2:
|
| 332 |
+
st.button("NEW ARRIVALS", key="search_new", use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
st.markdown("---")
|
| 334 |
|
| 335 |
+
# --- SIDEBAR DRAWER ---
|
| 336 |
if st.session_state.active_drawer:
|
| 337 |
with st.sidebar:
|
| 338 |
+
col_d1, col_d2 = st.columns([6, 1])
|
| 339 |
+
with col_d1:
|
| 340 |
title = 'MENU' if st.session_state.active_drawer == 'menu' else 'SHOPPING BAG'
|
| 341 |
st.markdown(f"<h3 style='letter-spacing:2px; margin:0;'>{title}</h3>", unsafe_allow_html=True)
|
| 342 |
+
with col_d2:
|
| 343 |
+
st.button("✕", key="close_drawer_btn", on_click=close_drawer)
|
|
|
|
|
|
|
| 344 |
|
| 345 |
st.divider()
|
| 346 |
|
| 347 |
+
# --- MENU ---
|
| 348 |
if st.session_state.active_drawer == 'menu':
|
| 349 |
if st.button("VIEW ALL", key="cat_all", use_container_width=True):
|
| 350 |
st.session_state.category_filter = "VIEW ALL"
|
| 351 |
st.session_state.page = 'home'
|
| 352 |
+
close_drawer()
|
| 353 |
st.rerun()
|
| 354 |
|
| 355 |
if not df.empty and 'Categoria' in df.columns:
|
|
|
|
| 358 |
if st.button(cat, key=f"cat_{cat}", use_container_width=True):
|
| 359 |
st.session_state.category_filter = cat
|
| 360 |
st.session_state.page = 'home'
|
| 361 |
+
close_drawer()
|
| 362 |
st.rerun()
|
| 363 |
|
| 364 |
+
# --- CARRITO ---
|
| 365 |
elif st.session_state.active_drawer == 'cart':
|
| 366 |
if not st.session_state.cart:
|
| 367 |
st.markdown("<div style='text-align:center; margin:60px 0;'>Your bag is empty</div>", unsafe_allow_html=True)
|
| 368 |
+
st.button("CONTINUE SHOPPING", key="cont_shop", type="primary", use_container_width=True, on_click=close_drawer)
|
|
|
|
|
|
|
| 369 |
else:
|
| 370 |
total = 0
|
| 371 |
for i, item in enumerate(st.session_state.cart):
|
| 372 |
+
col_i1, col_i2 = st.columns([1, 2])
|
| 373 |
+
with col_i1:
|
| 374 |
try:
|
| 375 |
st.image(item['img'], use_container_width=True)
|
| 376 |
except:
|
| 377 |
st.image("https://via.placeholder.com/100", use_container_width=True)
|
| 378 |
+
with col_i2:
|
| 379 |
st.markdown(f"**{item['name']}**")
|
| 380 |
st.caption(f"Size: {item['size']}")
|
| 381 |
st.markdown(f"**${item['price']}**")
|
|
|
|
| 399 |
whatsapp_link = f"https://api.whatsapp.com/send?phone={WHATSAPP_VENTAS}&text={msg}"
|
| 400 |
st.link_button("CHECKOUT", whatsapp_link, type="primary", use_container_width=True)
|
| 401 |
|
| 402 |
+
# --- VISTA HOME ---
|
| 403 |
if st.session_state.page == 'home':
|
| 404 |
df_show = df.copy() if not df.empty else pd.DataFrame()
|
| 405 |
|
|
|
|
| 424 |
st.markdown(f"<div style='text-align:center; font-weight:600; margin-top:10px;'>{row['Producto']}</div>", unsafe_allow_html=True)
|
| 425 |
st.markdown(f"<div style='text-align:center; color:#666; margin-bottom:15px;'>${row['Precio']} MXN</div>", unsafe_allow_html=True)
|
| 426 |
|
| 427 |
+
col_b1, col_b2 = st.columns(2)
|
| 428 |
+
with col_b1:
|
| 429 |
if st.button("SHOP NOW", key=f"shop_{row['ID']}", type="secondary", use_container_width=True):
|
| 430 |
st.session_state.selected_product = row.to_dict()
|
| 431 |
st.session_state.page = 'product'
|
| 432 |
st.rerun()
|
| 433 |
+
with col_b2:
|
| 434 |
in_wishlist = any(item['ID'] == row['ID'] for item in st.session_state.wishlist)
|
| 435 |
+
btn_text = "❤️ IN WISHLIST" if in_wishlist else "🤍 ADD TO WISHLIST"
|
| 436 |
if st.button(btn_text, key=f"wish_{row['ID']}", use_container_width=True):
|
| 437 |
if in_wishlist:
|
| 438 |
st.session_state.wishlist = [item for item in st.session_state.wishlist if item['ID'] != row['ID']]
|
|
|
|
| 442 |
st.session_state.toast_message = f"Added to wishlist"
|
| 443 |
st.rerun()
|
| 444 |
|
| 445 |
+
# --- VISTA PRODUCTO ---
|
| 446 |
elif st.session_state.page == 'product':
|
| 447 |
if st.session_state.selected_product:
|
| 448 |
p = st.session_state.selected_product
|
| 449 |
|
| 450 |
+
st.button("← BACK TO SHOP", key="back_btn", on_click=handle_home)
|
|
|
|
|
|
|
| 451 |
|
| 452 |
+
col_p1, col_p2 = st.columns([1.5, 1])
|
| 453 |
+
with col_p1:
|
| 454 |
try:
|
| 455 |
st.image(p['Imagen'], use_container_width=True)
|
| 456 |
except:
|
| 457 |
st.image("https://via.placeholder.com/600x700?text=ARZON", use_container_width=True)
|
| 458 |
|
| 459 |
+
with col_p2:
|
| 460 |
st.markdown(f"<h1 style='font-size:32px;'>{p['Producto']}</h1>", unsafe_allow_html=True)
|
| 461 |
st.markdown(f"<h2 style='font-size:24px; font-weight:400; margin-bottom:20px;'>${p['Precio']} MXN</h2>", unsafe_allow_html=True)
|
| 462 |
|
|
|
|
| 478 |
st.markdown("**DESCRIPTION**")
|
| 479 |
st.caption(p.get('Descripcion', 'No description available'))
|
| 480 |
|
| 481 |
+
# --- VISTA WISHLIST ---
|
| 482 |
elif st.session_state.page == 'wishlist':
|
| 483 |
st.markdown("<h1 style='text-align:center; margin:40px 0;'>WISHLIST</h1>", unsafe_allow_html=True)
|
| 484 |
|
| 485 |
if not st.session_state.wishlist:
|
| 486 |
st.info("Your wishlist is empty")
|
| 487 |
+
st.button("CONTINUE SHOPPING", type="primary", on_click=handle_home)
|
|
|
|
|
|
|
| 488 |
else:
|
| 489 |
cols = st.columns(3)
|
| 490 |
for i, item in enumerate(st.session_state.wishlist):
|