MaxBDKT commited on
Commit
8982db1
·
verified ·
1 Parent(s): 9a4d60e

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +36 -50
src/streamlit_app.py CHANGED
@@ -4,67 +4,55 @@ import os
4
  import numpy as np
5
 
6
  # ==============================================================================
7
- # 1. STYLE CSS V2.3 (FOCUS VISIBILITÉ TOTALE & BOUTONS)
8
  # ==============================================================================
9
- st.set_page_config(page_title="Brake Lab V2.3", layout="centered")
10
 
11
  st.markdown("""
12
  <style>
13
  /* 1.1 FOND GLOBAL */
14
  .stApp { background-color: #FFFFFF !important; }
15
- * { color: #000000 !important; font-family: 'Arial', sans-serif; }
16
 
17
- /* 1.2 INPUTS NUMÉRIQUES : BLANC SUR NOIR + BOUTONS VISIBLES */
18
- input[type="number"], .stNumberInput div[data-baseweb="input"] {
 
 
 
 
 
19
  color: #FFFFFF !important;
20
- background-color: #1E1E1E !important;
21
- border-radius: 8px !important;
22
- font-weight: bold !important;
23
  }
24
-
25
- /* FORCE LA VISIBILITÉ DES BOUTONS + ET - */
26
- button[aria-label="Step up"], button[aria-label="Step down"], button {
27
- color: #FFFFFF !important;
28
- background-color: #333333 !important;
29
- }
30
- button:hover { background-color: #0082C3 !important; }
31
 
32
- /* 1.3 SELECTBOX : FIX VISIBILITÉ LORS DU CLIC */
33
- div[data-baseweb="select"] {
 
 
 
34
  background-color: #1E1E1E !important;
35
  border: 2px solid #000000 !important;
 
36
  }
37
-
38
- /* Texte sélectionné et curseur */
39
- div[data-baseweb="select"] * {
40
- color: #FFFFFF !important;
41
  }
42
 
43
- /* Menu déroulant (Options) */
44
  div[role="listbox"], ul[role="listbox"] {
45
  background-color: #1E1E1E !important;
46
- border: 1px solid #FFFFFF !important;
47
- }
48
-
49
- li[role="option"], li[role="option"] * {
50
- color: #FFFFFF !important;
51
- background-color: #1E1E1E !important;
52
- font-weight: bold !important;
53
  }
54
-
55
  li[role="option"]:hover {
56
  background-color: #0082C3 !important;
57
  }
58
 
59
- /* 1.4 EXPANDERS : TITRES BIEN NOIRS SUR BLANC */
60
- .streamlit-expanderHeader {
61
- background-color: #F0F2F6 !important;
62
- color: #000000 !important;
63
- font-weight: bold !important;
64
- border-radius: 8px !important;
65
  }
66
 
67
- /* 1.5 CARTES DE RÉSULTATS */
68
  .perf-box {
69
  padding: 40px;
70
  border: 4px solid #000000;
@@ -77,8 +65,8 @@ st.markdown("""
77
  .perf-value { font-size: 55px; font-weight: 900; margin: 0px; }
78
 
79
  /* COULEURS COMPARAISON */
80
- .comp-pos { color: #1B5E20 !important; font-weight: bold; font-size: 18px; margin-top: 10px; } /* Vert */
81
- .comp-neg { color: #B71C1C !important; font-weight: bold; font-size: 18px; margin-top: 10px; } /* Rouge */
82
  </style>
83
  """, unsafe_allow_html=True)
84
 
@@ -97,7 +85,7 @@ def load_data():
97
  df = load_data()
98
 
99
  # ==============================================================================
100
- # 3. INTERFACE V2.3
101
  # ==============================================================================
102
  if not df.empty:
103
 
@@ -127,11 +115,16 @@ if not df.empty:
127
  res_dry = row['dry a'] * effort_val + row['dry b']
128
  res_wet = row['wet a'] * effort_val + row['wet b']
129
 
 
 
 
 
 
 
130
  # --- AFFICHAGE ---
131
  st.write("")
132
  res_c1, res_c2 = st.columns(2)
133
 
134
- # Fonction pour générer le texte de comparaison en %
135
  def get_comp_html(val_main, val_comp):
136
  if val_comp is None: return ""
137
  diff_pct = ((val_main - val_comp) / val_comp) * 100
@@ -139,23 +132,16 @@ if not df.empty:
139
  sign = "+" if diff_pct >= 0 else ""
140
  return f'<p class="{color_class}">{sign}{round(diff_pct, 1)}% vs comp</p>'
141
 
142
- # Calcul comparaison si nécessaire
143
- res_dry_c, res_wet_c = None, None
144
- if compare_model != "Aucun":
145
- row_c = df[df['model name'] == compare_model].iloc[0]
146
- res_dry_c = row_c['dry a'] * effort_val + row_c['dry b']
147
- res_wet_c = row_c['wet a'] * effort_val + row_c['wet b']
148
-
149
  with res_c1:
150
  st.markdown(f"""<div class="perf-box">
151
- <p style="font-size: 20px; font-weight: bold; color: #555 !important; margin-bottom:10px;">CONDITION : SEC</p>
152
  <p class="perf-value" style="color: #0082C3 !important;">{round(res_dry, 1)} N</p>
153
  {get_comp_html(res_dry, res_dry_c)}
154
  </div>""", unsafe_allow_html=True)
155
 
156
  with res_c2:
157
  st.markdown(f"""<div class="perf-box">
158
- <p style="font-size: 20px; font-weight: bold; color: #555 !important; margin-bottom:10px;">CONDITION : HUMIDE</p>
159
  <p class="perf-value" style="color: #E63312 !important;">{round(res_wet, 1)} N</p>
160
  {get_comp_html(res_wet, res_wet_c)}
161
  </div>""", unsafe_allow_html=True)
 
4
  import numpy as np
5
 
6
  # ==============================================================================
7
+ # 1. STYLE CSS V2.4 (FORÇAGE BLANC TOTAL SUR COMPOSANTS NOIRS)
8
  # ==============================================================================
9
+ st.set_page_config(page_title="Brake Lab V2.4", layout="centered")
10
 
11
  st.markdown("""
12
  <style>
13
  /* 1.1 FOND GLOBAL */
14
  .stApp { background-color: #FFFFFF !important; }
 
15
 
16
+ /* 1.2 FORÇAGE DES TEXTES DANS LES BLOCS NOIRS */
17
+ /* On cible tout ce qui est dans un input ou une liste déroulante */
18
+ div[data-baseweb="select"] *,
19
+ input,
20
+ .stNumberInput div *,
21
+ div[role="listbox"] *,
22
+ .streamlit-expanderHeader * {
23
  color: #FFFFFF !important;
24
+ fill: #FFFFFF !important;
 
 
25
  }
 
 
 
 
 
 
 
26
 
27
+ /* 1.3 RÉGLAGE DES BOITES (NOIR) */
28
+ div[data-baseweb="select"],
29
+ input,
30
+ .stNumberInput div[data-baseweb="input"],
31
+ .streamlit-expanderHeader {
32
  background-color: #1E1E1E !important;
33
  border: 2px solid #000000 !important;
34
+ border-radius: 8px !important;
35
  }
36
+
37
+ /* 1.4 TITRES HORS BLOCS (DOIVENT RESTER NOIRS SUR BLANC) */
38
+ h1, h2, h3, h4, p, label, .stMarkdown div p {
39
+ color: #000000 !important;
40
  }
41
 
42
+ /* 1.5 LISTE DÉROULANTE (OPTIONS) */
43
  div[role="listbox"], ul[role="listbox"] {
44
  background-color: #1E1E1E !important;
 
 
 
 
 
 
 
45
  }
 
46
  li[role="option"]:hover {
47
  background-color: #0082C3 !important;
48
  }
49
 
50
+ /* 1.6 BOUTONS + ET - (BOINS VISIBLES) */
51
+ button[aria-label="Step up"], button[aria-label="Step down"] {
52
+ background-color: #333333 !important;
 
 
 
53
  }
54
 
55
+ /* 1.7 CARTES DE RÉSULTATS */
56
  .perf-box {
57
  padding: 40px;
58
  border: 4px solid #000000;
 
65
  .perf-value { font-size: 55px; font-weight: 900; margin: 0px; }
66
 
67
  /* COULEURS COMPARAISON */
68
+ .comp-pos { color: #1B5E20 !important; font-weight: bold; font-size: 18px; margin-top: 10px; }
69
+ .comp-neg { color: #B71C1C !important; font-weight: bold; font-size: 18px; margin-top: 10px; }
70
  </style>
71
  """, unsafe_allow_html=True)
72
 
 
85
  df = load_data()
86
 
87
  # ==============================================================================
88
+ # 3. INTERFACE V2.4
89
  # ==============================================================================
90
  if not df.empty:
91
 
 
115
  res_dry = row['dry a'] * effort_val + row['dry b']
116
  res_wet = row['wet a'] * effort_val + row['wet b']
117
 
118
+ res_dry_c, res_wet_c = None, None
119
+ if compare_model != "Aucun":
120
+ row_c = df[df['model name'] == compare_model].iloc[0]
121
+ res_dry_c = row_c['dry a'] * effort_val + row_c['dry b']
122
+ res_wet_c = row_c['wet a'] * effort_val + row_c['wet b']
123
+
124
  # --- AFFICHAGE ---
125
  st.write("")
126
  res_c1, res_c2 = st.columns(2)
127
 
 
128
  def get_comp_html(val_main, val_comp):
129
  if val_comp is None: return ""
130
  diff_pct = ((val_main - val_comp) / val_comp) * 100
 
132
  sign = "+" if diff_pct >= 0 else ""
133
  return f'<p class="{color_class}">{sign}{round(diff_pct, 1)}% vs comp</p>'
134
 
 
 
 
 
 
 
 
135
  with res_c1:
136
  st.markdown(f"""<div class="perf-box">
137
+ <p style="font-size: 20px; font-weight: bold; margin-bottom:10px;">CONDITION : SEC</p>
138
  <p class="perf-value" style="color: #0082C3 !important;">{round(res_dry, 1)} N</p>
139
  {get_comp_html(res_dry, res_dry_c)}
140
  </div>""", unsafe_allow_html=True)
141
 
142
  with res_c2:
143
  st.markdown(f"""<div class="perf-box">
144
+ <p style="font-size: 20px; font-weight: bold; margin-bottom:10px;">CONDITION : HUMIDE</p>
145
  <p class="perf-value" style="color: #E63312 !important;">{round(res_wet, 1)} N</p>
146
  {get_comp_html(res_wet, res_wet_c)}
147
  </div>""", unsafe_allow_html=True)