cppbel commited on
Commit
d7108a2
·
verified ·
1 Parent(s): 22b63e6

Add 1 files

Browse files
Files changed (1) hide show
  1. index.html +30 -4
index.html CHANGED
@@ -29,6 +29,17 @@
29
  object-fit: cover;
30
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
31
  }
 
 
 
 
 
 
 
 
 
 
 
32
  </style>
33
  </head>
34
  <body class="min-h-screen gradient-bg text-white">
@@ -136,10 +147,15 @@
136
 
137
  <!-- Historique des conversions -->
138
  <div class="currency-card rounded-xl p-6">
139
- <h3 class="text-lg font-medium mb-4 flex items-center">
140
- <i class="fas fa-history mr-2"></i> Historique des conversions
141
- </h3>
142
- <div id="history-list" class="space-y-3 max-h-64 overflow-y-auto">
 
 
 
 
 
143
  <!-- Les éléments d'historique seront ajoutés ici dynamiquement -->
144
  <div class="text-center py-4 text-gray-300" id="empty-history">
145
  Aucune conversion enregistrée
@@ -174,6 +190,7 @@
174
  const historyList = document.getElementById('history-list');
175
  const emptyHistory = document.getElementById('empty-history');
176
  const fromCurrencySymbol = document.getElementById('from-currency-symbol');
 
177
 
178
  // Mettre à jour les taux affichés
179
  function updateExchangeRates() {
@@ -269,6 +286,14 @@
269
  historyList.insertBefore(historyItem, historyList.firstChild);
270
  }
271
 
 
 
 
 
 
 
 
 
272
  // Inverser les devises
273
  function swapCurrencies() {
274
  const temp = fromCurrency.value;
@@ -288,6 +313,7 @@
288
  swapBtn.addEventListener('click', swapCurrencies);
289
  convertBtn.addEventListener('click', performConversion);
290
  fromCurrency.addEventListener('change', updateCurrencySymbol);
 
291
 
292
  // Permettre la conversion avec la touche Entrée
293
  amountInput.addEventListener('keypress', function(e) {
 
29
  object-fit: cover;
30
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
31
  }
32
+ #history-list::-webkit-scrollbar {
33
+ width: 6px;
34
+ }
35
+ #history-list::-webkit-scrollbar-track {
36
+ background: rgba(255, 255, 255, 0.1);
37
+ border-radius: 10px;
38
+ }
39
+ #history-list::-webkit-scrollbar-thumb {
40
+ background: rgba(255, 255, 255, 0.3);
41
+ border-radius: 10px;
42
+ }
43
  </style>
44
  </head>
45
  <body class="min-h-screen gradient-bg text-white">
 
147
 
148
  <!-- Historique des conversions -->
149
  <div class="currency-card rounded-xl p-6">
150
+ <div class="flex justify-between items-center mb-4">
151
+ <h3 class="text-lg font-medium flex items-center">
152
+ <i class="fas fa-history mr-2"></i> Historique des conversions
153
+ </h3>
154
+ <button id="clear-history" class="text-sm bg-red-500/20 hover:bg-red-500/30 px-3 py-1 rounded-lg flex items-center transition-colors duration-200">
155
+ <i class="fas fa-trash-alt mr-1"></i> Effacer
156
+ </button>
157
+ </div>
158
+ <div id="history-list" class="space-y-3 max-h-64 overflow-y-auto pr-2">
159
  <!-- Les éléments d'historique seront ajoutés ici dynamiquement -->
160
  <div class="text-center py-4 text-gray-300" id="empty-history">
161
  Aucune conversion enregistrée
 
190
  const historyList = document.getElementById('history-list');
191
  const emptyHistory = document.getElementById('empty-history');
192
  const fromCurrencySymbol = document.getElementById('from-currency-symbol');
193
+ const clearHistoryBtn = document.getElementById('clear-history');
194
 
195
  // Mettre à jour les taux affichés
196
  function updateExchangeRates() {
 
286
  historyList.insertBefore(historyItem, historyList.firstChild);
287
  }
288
 
289
+ // Effacer l'historique
290
+ function clearHistory() {
291
+ while (historyList.firstChild) {
292
+ historyList.removeChild(historyList.firstChild);
293
+ }
294
+ emptyHistory.style.display = 'block';
295
+ }
296
+
297
  // Inverser les devises
298
  function swapCurrencies() {
299
  const temp = fromCurrency.value;
 
313
  swapBtn.addEventListener('click', swapCurrencies);
314
  convertBtn.addEventListener('click', performConversion);
315
  fromCurrency.addEventListener('change', updateCurrencySymbol);
316
+ clearHistoryBtn.addEventListener('click', clearHistory);
317
 
318
  // Permettre la conversion avec la touche Entrée
319
  amountInput.addEventListener('keypress', function(e) {