Commit ·
0718570
1
Parent(s): 33e18ad
Fix: Replace link_button with HTML links to prevent flickering
Browse files9 unmodified lines1011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677789 unmodified linesst.markdown('<h1 style="color: #00D9FF; text-align: center; margin-bottom: 3rem; font-weight: 800;">💼 Mes Projets Data Science</h1>', unsafe_allow_html=True)for idx, proj in enumerate(PROJECTS):# Créer un container avec clé unique pour éviter re-renderswith st.container(key=f"project_{idx}"):clean_title = proj['titre'].replace(proj['icon'], '').strip()# Badgebadge_html = '<span class="card-badge">✓ Déployé</span>' if proj['statut'] == "Déployé" else '<span class="card-badge" style="background: #667EEA;">✓ Complet</span>'# Titre et descriptionst.markdown(f'''<div class="project-card"><h2 class="project-title">{proj["icon"]} {clean_title} {badge_html}</h2><p style="color: #D5DAE1; font-size: 1.05rem; line-height: 1.8; margin: 1rem 0 1.5rem 0;">{proj["description"]}</p></div>''', unsafe_allow_html=True)# Technologiesst.markdown("**Technologies :**")tech_cols = st.columns(len(proj['technologies']))for i, tech in enumerate(proj['technologies']):with tech_cols[i]:st.markdown(f'<span class="tech-pill">{tech}</span>', unsafe_allow_html=True)# Section Aperçu avec imagesst.markdown('<h3 style="color: #00D9FF; margin: 2rem 0 1rem 0;">📸 Aperçu</h3>', unsafe_allow_html=True)col1, col2 = st.columns(2)# Déterminer les images selon le projetif idx == 0: # Dakarimages = [f"images/projects/dakar_{i}.png" for i in range(1, 5)]elif idx == 1: # TidianeFliximages = [f"images/projects/tidianeflix_{i}.png" for i in range(1, 5)]elif idx == 2: # SentimentScopeimages = [f"images/projects/sentimentscope_{i}.png" for i in range(1, 5)]elif idx == 3: # Climatimages = [f"images/projects/climate_change{i}.png" for i in range(1, 5)]# Afficher les imagesfor i, img_path in enumerate(images):try:with col1 if i % 2 == 0 else col2:st.image(img_path, use_container_width=True)except:pass# Liens avec clés uniquesst.markdown('<h3 style="color: #00D9FF; margin: 2rem 0 1rem 0;">🔗 Liens du projet</h3>', unsafe_allow_html=True)cols = st.columns(len(proj['liens']))label_map = {"github": "💻 GitHub", "demo": "🌐 Démo en direct", "notebook": "📓 Carnet"}for i, (key, url) in enumerate(proj['liens'].items()):with cols[i]:# Clé unique pour chaque boutonst.link_button(label_map.get(key, key.title()),url,use_container_width=True,key=f"btn_{idx}_{key}")# Séparateurif idx < len(PROJECTS) - 1:st.markdown("---")9 unmodified lines10111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899 unmodified linesst.markdown('<h1 style="color: #00D9FF; text-align: center; margin-bottom: 3rem; font-weight: 800;">💼 Mes Projets Data Science</h1>', unsafe_allow_html=True)for idx, proj in enumerate(PROJECTS):clean_title = proj['titre'].replace(proj['icon'], '').strip()# Badgebadge_html = '<span class="card-badge">✓ Déployé</span>' if proj['statut'] == "Déployé" else '<span class="card-badge" style="background: #667EEA;">✓ Complet</span>'# Titre et descriptionst.markdown(f'''<div class="project-card"><h2 class="project-title">{proj["icon"]} {clean_title} {badge_html}</h2><p style="color: #D5DAE1; font-size: 1.05rem; line-height: 1.8; margin: 1rem 0 1.5rem 0;">{proj["description"]}</p></div>''', unsafe_allow_html=True)# Technologiesst.markdown("**Technologies :**")tech_cols = st.columns(len(proj['technologies']))for i, tech in enumerate(proj['technologies']):with tech_cols[i]:st.markdown(f'<span class="tech-pill">{tech}</span>', unsafe_allow_html=True)# Section Aperçu avec imagesst.markdown('<h3 style="color: #00D9FF; margin: 2rem 0 1rem 0;">📸 Aperçu</h3>', unsafe_allow_html=True)col1, col2 = st.columns(2)# Déterminer les images selon le projetif idx == 0: # Dakarimages = [f"images/projects/dakar_{i}.png" for i in range(1, 5)]elif idx == 1: # TidianeFliximages = [f"images/projects/tidianeflix_{i}.png" for i in range(1, 5)]elif idx == 2: # SentimentScopeimages = [f"images/projects/sentimentscope_{i}.png" for i in range(1, 5)]elif idx == 3: # Climatimages = [f"images/projects/climate_change{i}.png" for i in range(1, 5)]# Afficher les imagesfor i, img_path in enumerate(images):try:with col1 if i % 2 == 0 else col2:st.image(img_path, use_container_width=True)except:pass# Liens EN HTML (pas de re-render !)st.markdown('<h3 style="color: #00D9FF; margin: 2rem 0 1rem 0;">🔗 Liens du projet</h3>', unsafe_allow_html=True)label_map = {"github": "💻 GitHub", "demo": "🌐 Démo en direct", "notebook": "📓 Carnet"}# Créer les boutons HTMLbuttons_html = '<div style="display: flex; gap: 1rem; margin: 1rem 0;">'for key, url in proj['liens'].items():label = label_map.get(key, key.title())buttons_html += f'''<a href="{url}" target="_blank" style="flex: 1;background: rgba(26, 31, 58, 0.9);color: #00D9FF;border: 2px solid #00D9FF;border-radius: 12px;padding: 0.7rem 1.8rem;font-weight: 900;font-size: 1.1rem;text-decoration: none;text-align: center;transition: all 0.3s ease;text-shadow: 0 0 15px rgba(0, 217, 255, 0.8);">{label}</a>'''buttons_html += '</div>'st.markdown(buttons_html, unsafe_allow_html=True)# Séparateurif idx < len(PROJECTS) - 1:st.markdown("---")
pages/2_Projects.py+77-66