Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,106 +6,88 @@ 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.
|
| 13 |
@st.cache_data
|
| 14 |
-
def
|
| 15 |
-
if os.path.exists(
|
| 16 |
-
with open(
|
| 17 |
return base64.b64encode(f.read()).decode()
|
| 18 |
-
return
|
| 19 |
|
| 20 |
-
# Cargamos
|
| 21 |
-
b64_menu =
|
| 22 |
-
b64_search =
|
| 23 |
-
b64_wish =
|
| 24 |
-
b64_bag =
|
| 25 |
|
| 26 |
-
# --- 3. CSS
|
| 27 |
st.markdown(f"""
|
| 28 |
<style>
|
| 29 |
-
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500&family=Inter:wght@300;400;
|
| 30 |
|
| 31 |
-
/* Forzar
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
}}
|
| 37 |
-
|
| 38 |
-
/* Ocultar nativos */
|
| 39 |
-
#MainMenu, footer, header, [data-testid="stToolbar"] {{display: none !important;}}
|
| 40 |
-
.stDeployButton {{display: none;}}
|
| 41 |
|
| 42 |
-
/*
|
| 43 |
-
/* Esto hace que el botón tenga la imagen de fondo, como en HTML */
|
| 44 |
.nav-btn button {{
|
| 45 |
-
border: none !important;
|
| 46 |
background-color: transparent !important;
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
background-repeat: no-repeat !important;
|
| 49 |
background-position: center !important;
|
| 50 |
-
|
| 51 |
-
width: 100% !important;
|
| 52 |
-
height: 40px !important;
|
| 53 |
-
color: transparent !important;
|
| 54 |
box-shadow: none !important;
|
| 55 |
-
|
|
|
|
|
|
|
| 56 |
}}
|
| 57 |
-
.nav-btn button:hover {{
|
| 58 |
.nav-btn button:active {{ transform: scale(0.9); }}
|
| 59 |
|
| 60 |
-
/*
|
| 61 |
.btn-menu button {{ background-image: url('data:image/png;base64,{b64_menu}') !important; }}
|
| 62 |
.btn-search button {{ background-image: url('data:image/png;base64,{b64_search}') !important; }}
|
| 63 |
.btn-wish button {{ background-image: url('data:image/png;base64,{b64_wish}') !important; }}
|
| 64 |
.btn-bag button {{ background-image: url('data:image/png;base64,{b64_bag}') !important; }}
|
| 65 |
-
|
| 66 |
-
/*
|
| 67 |
-
.brand-
|
| 68 |
font-family: 'Playfair Display', serif;
|
| 69 |
-
font-size:
|
| 70 |
text-align: center;
|
| 71 |
-
text-transform: uppercase;
|
| 72 |
letter-spacing: 4px;
|
| 73 |
-
|
| 74 |
-
cursor: pointer;
|
| 75 |
color: black;
|
| 76 |
-
|
| 77 |
-
}}
|
| 78 |
-
/* Botón invisible gigante sobre el texto del logo para ir a Home */
|
| 79 |
-
.logo-click button {{
|
| 80 |
-
position: absolute; top: -10px; left: 0; width: 100%; height: 50px; opacity: 0;
|
| 81 |
}}
|
| 82 |
|
| 83 |
-
/*
|
| 84 |
-
[
|
| 85 |
-
|
| 86 |
-
|
|
|
|
| 87 |
}}
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
text-transform: uppercase; letter-spacing: 2px; font-size: 12px !important;
|
| 92 |
-
padding: 16px !important; width: 100%; border-radius: 0 !important;
|
| 93 |
-
}}
|
| 94 |
-
|
| 95 |
-
.shop-btn button {{
|
| 96 |
-
background: white !important; border: 1px solid #ddd !important; color: black !important;
|
| 97 |
-
text-transform: uppercase; font-size: 11px !important; letter-spacing: 1px; width: 100%; border-radius: 0 !important;
|
| 98 |
}}
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
color: black !important; text-transform: uppercase; letter-spacing: 2px;
|
| 104 |
-
}}
|
| 105 |
</style>
|
| 106 |
""", unsafe_allow_html=True)
|
| 107 |
|
| 108 |
-
# --- 4.
|
| 109 |
secret_dict = {
|
| 110 |
"type": "service_account",
|
| 111 |
"project_id": "trhhats",
|
|
@@ -132,219 +114,112 @@ def cargar_catalogo():
|
|
| 132 |
df = pd.DataFrame(sh.worksheet(HOJA_NOMBRE).get_all_records())
|
| 133 |
if 'Imagen' not in df.columns: return pd.DataFrame()
|
| 134 |
df['Imagen'] = df['Imagen'].astype(str)
|
| 135 |
-
df = df[df['Imagen'].str.strip().str.startswith(('http://', 'https://'))]
|
| 136 |
return df
|
| 137 |
except: return pd.DataFrame()
|
| 138 |
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
| 142 |
if 'cart' not in st.session_state: st.session_state.cart = []
|
| 143 |
-
if 'wishlist' not in st.session_state: st.session_state.wishlist = []
|
| 144 |
if 'page' not in st.session_state: st.session_state.page = 'home'
|
| 145 |
-
if '
|
| 146 |
-
if 'category_filter' not in st.session_state: st.session_state.category_filter = "VIEW ALL"
|
| 147 |
-
if 'search_query' not in st.session_state: st.session_state.search_query = ""
|
| 148 |
|
| 149 |
-
|
|
|
|
|
|
|
| 150 |
|
| 151 |
-
#
|
| 152 |
-
# ⚡ HEADER LIMPIO (SIN USER, SIN LOGO IMG)
|
| 153 |
-
# ==========================================
|
| 154 |
-
c_nav = st.columns([0.5, 0.5, 3, 0.5, 0.5, 0.5])
|
| 155 |
-
|
| 156 |
-
# 1. MENU (Usa menu.png desde CSS)
|
| 157 |
-
with c_nav[0]:
|
| 158 |
st.markdown('<div class="nav-btn btn-menu">', unsafe_allow_html=True)
|
| 159 |
-
if st.button("
|
| 160 |
-
st.session_state.
|
| 161 |
-
st.session_state.search_open = False
|
| 162 |
-
st.rerun()
|
| 163 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 164 |
|
| 165 |
-
|
| 166 |
-
with c_nav[1]:
|
| 167 |
st.markdown('<div class="nav-btn btn-search">', unsafe_allow_html=True)
|
| 168 |
-
if st.button("
|
| 169 |
-
st.session_state.
|
| 170 |
-
st.session_state.active_drawer = None
|
| 171 |
-
st.rerun()
|
| 172 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 173 |
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
st.
|
| 179 |
-
|
| 180 |
-
st.session_state.page = 'home'
|
| 181 |
-
st.rerun()
|
| 182 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 183 |
|
| 184 |
-
|
| 185 |
-
with c_nav[3]:
|
| 186 |
-
pass
|
| 187 |
-
|
| 188 |
-
# 5. WISHLIST (Usa wish.png desde CSS)
|
| 189 |
-
with c_nav[4]:
|
| 190 |
st.markdown('<div class="nav-btn btn-wish">', unsafe_allow_html=True)
|
| 191 |
-
if st.button("
|
| 192 |
-
st.session_state.page = 'wishlist'
|
| 193 |
-
st.session_state.active_drawer = None
|
| 194 |
-
st.session_state.search_open = False
|
| 195 |
-
st.rerun()
|
| 196 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 197 |
|
| 198 |
-
|
| 199 |
-
with c_nav[5]:
|
| 200 |
st.markdown('<div class="nav-btn btn-bag">', unsafe_allow_html=True)
|
| 201 |
-
if st.button("
|
| 202 |
-
st.session_state.
|
| 203 |
-
st.session_state.search_open = False
|
| 204 |
-
st.rerun()
|
| 205 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 206 |
|
|
|
|
| 207 |
|
| 208 |
-
#
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
if st.session_state.search_open:
|
| 212 |
-
st.markdown("<br>", unsafe_allow_html=True)
|
| 213 |
sc1, sc2 = st.columns([10, 1])
|
| 214 |
-
with sc1:
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
st.rerun()
|
| 223 |
-
st.caption("POPULAR: NEW ARRIVALS | ACCESSORIES")
|
| 224 |
-
st.markdown("---")
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
# ==========================================
|
| 228 |
-
# 📂 SIDEBAR (MENU / CART)
|
| 229 |
-
# ==========================================
|
| 230 |
-
if st.session_state.active_drawer:
|
| 231 |
with st.sidebar:
|
| 232 |
-
if st.button("✕ CLOSE", key="
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
if st.session_state.active_drawer == 'menu':
|
| 237 |
st.markdown("### MENU")
|
| 238 |
-
cats = ["VIEW ALL"]
|
| 239 |
-
if not df.empty and 'Categoria' in df.columns:
|
| 240 |
-
cats += sorted(list(df['Categoria'].unique()))
|
| 241 |
for cat in cats:
|
| 242 |
-
st.
|
| 243 |
-
|
| 244 |
-
st.session_state.category_filter = cat
|
| 245 |
-
st.session_state.page = 'home'
|
| 246 |
-
st.session_state.active_drawer = None
|
| 247 |
-
st.rerun()
|
| 248 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 249 |
|
| 250 |
-
elif st.session_state.
|
| 251 |
-
st.markdown("
|
| 252 |
if not st.session_state.cart:
|
| 253 |
-
st.
|
| 254 |
-
st.markdown('<div class="black-btn">', unsafe_allow_html=True)
|
| 255 |
-
if st.button("SHOP NOW"):
|
| 256 |
-
st.session_state.active_drawer = None
|
| 257 |
-
st.rerun()
|
| 258 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 259 |
else:
|
| 260 |
total = 0
|
| 261 |
for i, item in enumerate(st.session_state.cart):
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
st.write(f"**{item['name']}**")
|
| 266 |
-
st.caption(f"${item['price']}")
|
| 267 |
-
if st.button("Remove", key=f"d_{i}"):
|
| 268 |
-
st.session_state.cart.pop(i)
|
| 269 |
-
st.rerun()
|
| 270 |
-
try: total += float(str(item['price']).replace(",","").replace("$",""))
|
| 271 |
except: pass
|
| 272 |
-
|
| 273 |
-
st.
|
| 274 |
-
msg = f"PEDIDO ARZON: ${total}"
|
| 275 |
link = f"https://api.whatsapp.com/send?phone={WHATSAPP_VENTAS}&text={quote_plus(msg)}"
|
| 276 |
-
st.
|
| 277 |
-
st.link_button("CHECKOUT", link, use_container_width=True)
|
| 278 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 279 |
-
|
| 280 |
|
| 281 |
-
#
|
| 282 |
-
# 🖥️ VISTAS
|
| 283 |
-
# ==========================================
|
| 284 |
if st.session_state.page == 'home':
|
| 285 |
-
# Grid de productos
|
| 286 |
-
df_show = df
|
| 287 |
-
if st.session_state.category_filter != "VIEW ALL":
|
| 288 |
-
df_show = df_show[df_show['Categoria'] == st.session_state.category_filter]
|
| 289 |
-
if st.session_state.search_query:
|
| 290 |
-
df_show = df_show[df_show.apply(lambda row: st.session_state.search_query.lower() in str(row).lower(), axis=1)]
|
| 291 |
-
|
| 292 |
st.markdown("<br>", unsafe_allow_html=True)
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
if df_show.empty: st.info("No items.")
|
| 296 |
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
st.
|
| 307 |
-
|
| 308 |
-
st.rerun()
|
| 309 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 310 |
-
st.write("")
|
| 311 |
-
|
| 312 |
-
elif st.session_state.page == 'product':
|
| 313 |
-
p = st.session_state.selected_product
|
| 314 |
-
if st.button("← BACK", key="bk"):
|
| 315 |
-
st.session_state.page = 'home'
|
| 316 |
-
st.rerun()
|
| 317 |
-
st.write("")
|
| 318 |
-
c1, c2 = st.columns([1.5, 1], gap="large")
|
| 319 |
-
with c1: st.image(p['Imagen'], use_container_width=True)
|
| 320 |
-
with c2:
|
| 321 |
-
st.markdown(f"### {p['Producto']}")
|
| 322 |
-
st.markdown(f"**${p['Precio']} MXN**")
|
| 323 |
-
st.write("")
|
| 324 |
-
tallas = [t.strip() for t in str(p.get('Tallas', 'ONE SIZE')).split(",")]
|
| 325 |
-
size = st.selectbox("Size", tallas)
|
| 326 |
-
st.write("")
|
| 327 |
-
st.markdown('<div class="black-btn">', unsafe_allow_html=True)
|
| 328 |
-
if st.button("ADD TO BAG"):
|
| 329 |
-
st.session_state.cart.append({"id": p['ID'], "name": p['Producto'], "price": p['Precio'], "size": size, "img": p['Imagen']})
|
| 330 |
-
st.session_state.active_drawer = 'cart'
|
| 331 |
-
st.toast("Added!")
|
| 332 |
-
st.rerun()
|
| 333 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 334 |
-
st.markdown("---")
|
| 335 |
-
st.write(p.get('Descripcion', ''))
|
| 336 |
|
| 337 |
elif st.session_state.page == 'wishlist':
|
| 338 |
st.markdown("<h3 style='text-align:center;'>WISHLIST</h3>", unsafe_allow_html=True)
|
| 339 |
-
|
| 340 |
-
cols = st.columns(3)
|
| 341 |
-
for i, item in enumerate(st.session_state.wishlist):
|
| 342 |
-
with cols[i%3]:
|
| 343 |
-
st.image(item['Imagen'])
|
| 344 |
-
st.markdown(f"**{item['Producto']}**")
|
| 345 |
-
st.markdown('<div class="shop-btn">', unsafe_allow_html=True)
|
| 346 |
-
if st.button("VIEW", key=f"w_{i}"):
|
| 347 |
-
st.session_state.selected_product = item
|
| 348 |
-
st.session_state.page = 'product'
|
| 349 |
-
st.rerun()
|
| 350 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
| 6 |
import base64
|
| 7 |
import os
|
| 8 |
|
| 9 |
+
# --- 1. CONFIGURACIÓN DE PÁGINA ---
|
| 10 |
st.set_page_config(page_title="ARZON STUDIOS", layout="wide", initial_sidebar_state="collapsed")
|
| 11 |
|
| 12 |
+
# --- 2. CARGAR IMÁGENES A MEMORIA (Evita el temblor y parpadeo) ---
|
| 13 |
@st.cache_data
|
| 14 |
+
def load_base64_image(file_path):
|
| 15 |
+
if os.path.exists(file_path):
|
| 16 |
+
with open(file_path, "rb") as f:
|
| 17 |
return base64.b64encode(f.read()).decode()
|
| 18 |
+
return None
|
| 19 |
|
| 20 |
+
# Cargamos tus iconos
|
| 21 |
+
b64_menu = load_base64_image("menu.png")
|
| 22 |
+
b64_search = load_base64_image("search.png")
|
| 23 |
+
b64_wish = load_base64_image("wish.png")
|
| 24 |
+
b64_bag = load_base64_image("bag.png")
|
| 25 |
|
| 26 |
+
# --- 3. ESTILOS CSS MAESTROS ---
|
| 27 |
st.markdown(f"""
|
| 28 |
<style>
|
| 29 |
+
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500&family=Inter:wght@300;400;600&display=swap');
|
| 30 |
|
| 31 |
+
/* Forzar fondo blanco y ocultar interfaz de Streamlit */
|
| 32 |
+
.stApp {{ background-color: #ffffff !important; }}
|
| 33 |
+
header, footer, #MainMenu {{ display: none !important; }}
|
| 34 |
+
[data-testid="stSidebar"] {{ background-color: white !important; border-right: 1px solid #eee; }}
|
| 35 |
+
[data-testid="stSidebar"] button[kind="header"] {{ display: none; }}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
/* ESTILO DE BOTONES ICONO (Convertimos el botón en la imagen) */
|
|
|
|
| 38 |
.nav-btn button {{
|
|
|
|
| 39 |
background-color: transparent !important;
|
| 40 |
+
border: none !important;
|
| 41 |
+
padding: 0 !important;
|
| 42 |
+
width: 30px !important;
|
| 43 |
+
height: 30px !important;
|
| 44 |
+
background-size: contain !important;
|
| 45 |
background-repeat: no-repeat !important;
|
| 46 |
background-position: center !important;
|
| 47 |
+
color: transparent !important; /* Oculta cualquier texto del botón */
|
|
|
|
|
|
|
|
|
|
| 48 |
box-shadow: none !important;
|
| 49 |
+
cursor: pointer !important;
|
| 50 |
+
margin: 0 auto !important;
|
| 51 |
+
display: block !important;
|
| 52 |
}}
|
| 53 |
+
.nav-btn button:hover {{ opacity: 0.6; transition: 0.2s; }}
|
| 54 |
.nav-btn button:active {{ transform: scale(0.9); }}
|
| 55 |
|
| 56 |
+
/* Inyección de las imágenes en los botones */
|
| 57 |
.btn-menu button {{ background-image: url('data:image/png;base64,{b64_menu}') !important; }}
|
| 58 |
.btn-search button {{ background-image: url('data:image/png;base64,{b64_search}') !important; }}
|
| 59 |
.btn-wish button {{ background-image: url('data:image/png;base64,{b64_wish}') !important; }}
|
| 60 |
.btn-bag button {{ background-image: url('data:image/png;base64,{b64_bag}') !important; }}
|
| 61 |
+
|
| 62 |
+
/* LOGO TEXTO ELEGANTE */
|
| 63 |
+
.brand-logo {{
|
| 64 |
font-family: 'Playfair Display', serif;
|
| 65 |
+
font-size: 40px;
|
| 66 |
text-align: center;
|
|
|
|
| 67 |
letter-spacing: 4px;
|
| 68 |
+
text-transform: uppercase;
|
|
|
|
| 69 |
color: black;
|
| 70 |
+
margin-top: -15px;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
}}
|
| 72 |
|
| 73 |
+
/* BOTONES DE LA TIENDA */
|
| 74 |
+
button[kind="primary"] {{
|
| 75 |
+
background-color: black !important; color: white !important; border-radius: 0 !important;
|
| 76 |
+
text-transform: uppercase; letter-spacing: 2px; border: none !important; padding: 15px !important;
|
| 77 |
+
width: 100%;
|
| 78 |
}}
|
| 79 |
+
button[kind="secondary"] {{
|
| 80 |
+
background-color: white !important; color: black !important; border-radius: 0 !important;
|
| 81 |
+
text-transform: uppercase; border: 1px solid #ddd !important; width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
}}
|
| 83 |
|
| 84 |
+
/* Grid de productos */
|
| 85 |
+
.p-title {{ font-size: 13px; font-weight: 600; text-transform: uppercase; text-align: center; margin-top: 10px; color: black; }}
|
| 86 |
+
.p-price {{ font-size: 13px; text-align: center; color: #666; margin-bottom: 15px; }}
|
|
|
|
|
|
|
| 87 |
</style>
|
| 88 |
""", unsafe_allow_html=True)
|
| 89 |
|
| 90 |
+
# --- 4. CONEXIÓN A GOOGLE SHEETS ---
|
| 91 |
secret_dict = {
|
| 92 |
"type": "service_account",
|
| 93 |
"project_id": "trhhats",
|
|
|
|
| 114 |
df = pd.DataFrame(sh.worksheet(HOJA_NOMBRE).get_all_records())
|
| 115 |
if 'Imagen' not in df.columns: return pd.DataFrame()
|
| 116 |
df['Imagen'] = df['Imagen'].astype(str)
|
|
|
|
| 117 |
return df
|
| 118 |
except: return pd.DataFrame()
|
| 119 |
|
| 120 |
+
df = cargar_catalogo()
|
| 121 |
+
|
| 122 |
+
# --- 5. ESTADO DE LA APP ---
|
| 123 |
+
if 'drawer' not in st.session_state: st.session_state.drawer = None
|
| 124 |
+
if 'search_active' not in st.session_state: st.session_state.search_active = False
|
| 125 |
if 'cart' not in st.session_state: st.session_state.cart = []
|
|
|
|
| 126 |
if 'page' not in st.session_state: st.session_state.page = 'home'
|
| 127 |
+
if 'category' not in st.session_state: st.session_state.category = "VIEW ALL"
|
|
|
|
|
|
|
| 128 |
|
| 129 |
+
# --- 6. HEADER (ICONOS REALES) ---
|
| 130 |
+
# Columnas: [Menu] [Search] [Logo] [Vacio] [Wish] [Bag]
|
| 131 |
+
c1, c2, c3, c4, c5, c6 = st.columns([0.5, 0.5, 3, 0.5, 0.5, 0.5])
|
| 132 |
|
| 133 |
+
with c1: # ICONO MENU
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
st.markdown('<div class="nav-btn btn-menu">', unsafe_allow_html=True)
|
| 135 |
+
if st.button("m", key="m_btn"):
|
| 136 |
+
st.session_state.drawer = 'menu'; st.session_state.search_active = False; st.rerun()
|
|
|
|
|
|
|
| 137 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 138 |
|
| 139 |
+
with c2: # ICONO SEARCH
|
|
|
|
| 140 |
st.markdown('<div class="nav-btn btn-search">', unsafe_allow_html=True)
|
| 141 |
+
if st.button("s", key="s_btn"):
|
| 142 |
+
st.session_state.search_active = not st.session_state.search_active; st.session_state.drawer = None; st.rerun()
|
|
|
|
|
|
|
| 143 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 144 |
|
| 145 |
+
with c3: # LOGO TEXTO (Centrado)
|
| 146 |
+
st.markdown('<div class="brand-logo">ARZON STUDIOS</div>', unsafe_allow_html=True)
|
| 147 |
+
# Botón invisible sobre el texto para regresar a Home
|
| 148 |
+
st.markdown('<div style="position:relative; height:40px; margin-top:-40px; cursor:pointer;">', unsafe_allow_html=True)
|
| 149 |
+
if st.button("logo", key="l_btn", use_container_width=True):
|
| 150 |
+
st.session_state.page = 'home'; st.session_state.drawer = None; st.session_state.search_active = False; st.rerun()
|
|
|
|
|
|
|
| 151 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 152 |
|
| 153 |
+
with c5: # ICONO WISH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
st.markdown('<div class="nav-btn btn-wish">', unsafe_allow_html=True)
|
| 155 |
+
if st.button("w", key="w_btn"):
|
| 156 |
+
st.session_state.page = 'wishlist'; st.session_state.drawer = None; st.rerun()
|
|
|
|
|
|
|
|
|
|
| 157 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 158 |
|
| 159 |
+
with c6: # ICONO BAG
|
|
|
|
| 160 |
st.markdown('<div class="nav-btn btn-bag">', unsafe_allow_html=True)
|
| 161 |
+
if st.button("b", key="b_btn"):
|
| 162 |
+
st.session_state.drawer = 'cart'; st.session_state.search_active = False; st.rerun()
|
|
|
|
|
|
|
| 163 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 164 |
|
| 165 |
+
# --- 7. COMPONENTES DESPLEGABLES ---
|
| 166 |
|
| 167 |
+
# Buscador Superior
|
| 168 |
+
if st.session_state.search_active:
|
| 169 |
+
st.markdown("<hr style='margin:10px 0'>", unsafe_allow_html=True)
|
|
|
|
|
|
|
| 170 |
sc1, sc2 = st.columns([10, 1])
|
| 171 |
+
with sc1: st.text_input("SEARCH", placeholder="TYPE TO SEARCH...", label_visibility="collapsed")
|
| 172 |
+
with sc2:
|
| 173 |
+
if st.button("✕", key="cl_s"): st.session_state.search_active = False; st.rerun()
|
| 174 |
+
st.caption("POPULAR: NEW ARRIVALS | ACCESSORIES | DENIM")
|
| 175 |
+
st.markdown("<hr style='margin:10px 0; margin-bottom:30px'>", unsafe_allow_html=True)
|
| 176 |
+
|
| 177 |
+
# Sidebar (Menu y Carrito)
|
| 178 |
+
if st.session_state.drawer:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
with st.sidebar:
|
| 180 |
+
if st.button("✕ CLOSE", key="cl_d"): st.session_state.drawer = None; st.rerun()
|
| 181 |
+
|
| 182 |
+
if st.session_state.drawer == 'menu':
|
|
|
|
|
|
|
| 183 |
st.markdown("### MENU")
|
| 184 |
+
cats = ["VIEW ALL"] + sorted(df['Categoria'].unique().tolist()) if not df.empty else ["VIEW ALL"]
|
|
|
|
|
|
|
| 185 |
for cat in cats:
|
| 186 |
+
if st.button(cat, key=f"cat_{cat}", use_container_width=True):
|
| 187 |
+
st.session_state.category = cat; st.session_state.page = 'home'; st.session_state.drawer = None; st.rerun()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
|
| 189 |
+
elif st.session_state.drawer == 'cart':
|
| 190 |
+
st.markdown("### SHOPPING BAG")
|
| 191 |
if not st.session_state.cart:
|
| 192 |
+
st.write("Your bag is empty.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
else:
|
| 194 |
total = 0
|
| 195 |
for i, item in enumerate(st.session_state.cart):
|
| 196 |
+
st.write(f"**{item['name']}** - ${item['price']}")
|
| 197 |
+
if st.button("Remove", key=f"rm_{i}"): st.session_state.cart.pop(i); st.rerun()
|
| 198 |
+
try: total += float(str(item['price']).replace(",",""))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
except: pass
|
| 200 |
+
st.divider()
|
| 201 |
+
st.write(f"**TOTAL: ${total:,.2f}**")
|
| 202 |
+
msg = f"PEDIDO ARZON: Total ${total}"
|
| 203 |
link = f"https://api.whatsapp.com/send?phone={WHATSAPP_VENTAS}&text={quote_plus(msg)}"
|
| 204 |
+
st.link_button("CHECKOUT", link)
|
|
|
|
|
|
|
|
|
|
| 205 |
|
| 206 |
+
# --- 8. CONTENIDO PRINCIPAL (GRID DE PRODUCTOS) ---
|
|
|
|
|
|
|
| 207 |
if st.session_state.page == 'home':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
st.markdown("<br>", unsafe_allow_html=True)
|
| 209 |
+
df_show = df if st.session_state.category == "VIEW ALL" else df[df['Categoria'] == st.session_state.category]
|
|
|
|
|
|
|
| 210 |
|
| 211 |
+
if df_show.empty:
|
| 212 |
+
st.info("No items found.")
|
| 213 |
+
else:
|
| 214 |
+
cols = st.columns(3, gap="large")
|
| 215 |
+
for idx, row in df_show.iterrows():
|
| 216 |
+
with cols[idx % 3]:
|
| 217 |
+
st.image(row['Imagen'], use_container_width=True)
|
| 218 |
+
st.markdown(f"<div class='p-title'>{row['Producto']}</div>", unsafe_allow_html=True)
|
| 219 |
+
st.markdown(f"<div class='p-price'>${row['Precio']} MXN</div>", unsafe_allow_html=True)
|
| 220 |
+
if st.button("SHOP NOW", key=f"shop_{idx}", type="secondary"):
|
| 221 |
+
st.toast("Feature coming soon!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
|
| 223 |
elif st.session_state.page == 'wishlist':
|
| 224 |
st.markdown("<h3 style='text-align:center;'>WISHLIST</h3>", unsafe_allow_html=True)
|
| 225 |
+
st.write("Your wishlist is currently empty.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|