PythonMindset commited on
Commit
a23c44c
·
1 Parent(s): 0718570

Fix HTML rendering - use simple link structure

Browse files
Files changed (1) hide show
  1. pages/2_Projects.py +8 -32
pages/2_Projects.py CHANGED
@@ -12,10 +12,8 @@ st.markdown('<h1 style="color: #00D9FF; text-align: center; margin-bottom: 3rem;
12
  for idx, proj in enumerate(PROJECTS):
13
  clean_title = proj['titre'].replace(proj['icon'], '').strip()
14
 
15
- # Badge
16
  badge_html = '<span class="card-badge">✓ Déployé</span>' if proj['statut'] == "Déployé" else '<span class="card-badge" style="background: #667EEA;">✓ Complet</span>'
17
 
18
- # Titre et description
19
  st.markdown(f'''
20
  <div class="project-card">
21
  <h2 class="project-title">{proj["icon"]} {clean_title} {badge_html}</h2>
@@ -32,22 +30,20 @@ for idx, proj in enumerate(PROJECTS):
32
  with tech_cols[i]:
33
  st.markdown(f'<span class="tech-pill">{tech}</span>', unsafe_allow_html=True)
34
 
35
- # Section Aperçu avec images
36
  st.markdown('<h3 style="color: #00D9FF; margin: 2rem 0 1rem 0;">📸 Aperçu</h3>', unsafe_allow_html=True)
37
 
38
  col1, col2 = st.columns(2)
39
 
40
- # Déterminer les images selon le projet
41
- if idx == 0: # Dakar
42
  images = [f"images/projects/dakar_{i}.png" for i in range(1, 5)]
43
- elif idx == 1: # TidianeFlix
44
  images = [f"images/projects/tidianeflix_{i}.png" for i in range(1, 5)]
45
- elif idx == 2: # SentimentScope
46
  images = [f"images/projects/sentimentscope_{i}.png" for i in range(1, 5)]
47
- elif idx == 3: # Climat
48
  images = [f"images/projects/climate_change{i}.png" for i in range(1, 5)]
49
 
50
- # Afficher les images
51
  for i, img_path in enumerate(images):
52
  try:
53
  with col1 if i % 2 == 0 else col2:
@@ -55,35 +51,15 @@ for idx, proj in enumerate(PROJECTS):
55
  except:
56
  pass
57
 
58
- # Liens EN HTML (pas de re-render !)
59
  st.markdown('<h3 style="color: #00D9FF; margin: 2rem 0 1rem 0;">🔗 Liens du projet</h3>', unsafe_allow_html=True)
60
 
61
  label_map = {"github": "💻 GitHub", "demo": "🌐 Démo en direct", "notebook": "📓 Carnet"}
62
 
63
- # Créer les boutons HTML
64
- buttons_html = '<div style="display: flex; gap: 1rem; margin: 1rem 0;">'
65
  for key, url in proj['liens'].items():
66
  label = label_map.get(key, key.title())
67
- buttons_html += f'''
68
- <a href="{url}" target="_blank" style="
69
- flex: 1;
70
- background: rgba(26, 31, 58, 0.9);
71
- color: #00D9FF;
72
- border: 2px solid #00D9FF;
73
- border-radius: 12px;
74
- padding: 0.7rem 1.8rem;
75
- font-weight: 900;
76
- font-size: 1.1rem;
77
- text-decoration: none;
78
- text-align: center;
79
- transition: all 0.3s ease;
80
- text-shadow: 0 0 15px rgba(0, 217, 255, 0.8);
81
- ">{label}</a>
82
- '''
83
- buttons_html += '</div>'
84
 
85
- st.markdown(buttons_html, unsafe_allow_html=True)
86
-
87
- # Séparateur
88
  if idx < len(PROJECTS) - 1:
89
  st.markdown("---")
 
12
  for idx, proj in enumerate(PROJECTS):
13
  clean_title = proj['titre'].replace(proj['icon'], '').strip()
14
 
 
15
  badge_html = '<span class="card-badge">✓ Déployé</span>' if proj['statut'] == "Déployé" else '<span class="card-badge" style="background: #667EEA;">✓ Complet</span>'
16
 
 
17
  st.markdown(f'''
18
  <div class="project-card">
19
  <h2 class="project-title">{proj["icon"]} {clean_title} {badge_html}</h2>
 
30
  with tech_cols[i]:
31
  st.markdown(f'<span class="tech-pill">{tech}</span>', unsafe_allow_html=True)
32
 
33
+ # Images
34
  st.markdown('<h3 style="color: #00D9FF; margin: 2rem 0 1rem 0;">📸 Aperçu</h3>', unsafe_allow_html=True)
35
 
36
  col1, col2 = st.columns(2)
37
 
38
+ if idx == 0:
 
39
  images = [f"images/projects/dakar_{i}.png" for i in range(1, 5)]
40
+ elif idx == 1:
41
  images = [f"images/projects/tidianeflix_{i}.png" for i in range(1, 5)]
42
+ elif idx == 2:
43
  images = [f"images/projects/sentimentscope_{i}.png" for i in range(1, 5)]
44
+ elif idx == 3:
45
  images = [f"images/projects/climate_change{i}.png" for i in range(1, 5)]
46
 
 
47
  for i, img_path in enumerate(images):
48
  try:
49
  with col1 if i % 2 == 0 else col2:
 
51
  except:
52
  pass
53
 
54
+ # Liens - HTML SIMPLIFIÉ
55
  st.markdown('<h3 style="color: #00D9FF; margin: 2rem 0 1rem 0;">🔗 Liens du projet</h3>', unsafe_allow_html=True)
56
 
57
  label_map = {"github": "💻 GitHub", "demo": "🌐 Démo en direct", "notebook": "📓 Carnet"}
58
 
59
+ # Construire les boutons ligne par ligne
 
60
  for key, url in proj['liens'].items():
61
  label = label_map.get(key, key.title())
62
+ st.markdown(f'<a href="{url}" target="_blank" class="stLinkButton"><span>{label}</span></a>', unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
 
 
 
64
  if idx < len(PROJECTS) - 1:
65
  st.markdown("---")