From 00c8af68530f8f7a9733cdaf7be1ad8fe267e4cb Mon Sep 17 00:00:00 2001 From: gerlofvanek Date: Sat, 16 Mar 2024 22:54:26 +0100 Subject: [PATCH] ui: Offers page update --- basicswap/templates/offers.html | 127 +++++++++++++++++++++----------- 1 file changed, 84 insertions(+), 43 deletions(-) diff --git a/basicswap/templates/offers.html b/basicswap/templates/offers.html index 4914491..3958683 100644 --- a/basicswap/templates/offers.html +++ b/basicswap/templates/offers.html @@ -643,8 +643,7 @@ const chart = new Chart(ctx, { } }); - {% endif %} - +{% endif %}
@@ -655,32 +654,45 @@ const chart = new Chart(ctx, {
-
-
{{ input_arrow_down_svg | safe }} - + +
+
+ +
+ {{ input_arrow_down_svg | safe }} + +
+
-

{{ arrow_right_svg | safe }} -

+

{{ arrow_right_svg | safe }}

-
-
{{ input_arrow_down_svg | safe }} - + +
+
+ +
+ {{ input_arrow_down_svg | safe }} + +
+

Sort By:

@@ -734,7 +746,7 @@ const chart = new Chart(ctx, { {% endif %}
-
@@ -750,6 +762,7 @@ const chart = new Chart(ctx, {
+
@@ -1055,29 +1068,29 @@ const chart = new Chart(ctx, {
-
- {% if filters.page_no > 1 %} -
- -
- {% endif %} -
-
-

Page: {{ filters.page_no }}

-
-
- {% if offers_count > 10 %} -
- -
- {% endif %} +
+ {% if filters.page_no > 1 %} +
+
+ {% endif %} +
+
+

Page: {{ filters.page_no }}

+
+
+ {% if offers_count > 20 %} +
+ +
+ {% endif %} +
@@ -1258,6 +1271,34 @@ function sortTable(columnIndex) { rows.forEach(row => table.querySelector('tbody').appendChild(row)); } +document.addEventListener('DOMContentLoaded', function() { + const coinToSelect = document.getElementById('coin_to'); + const coinFromSelect = document.getElementById('coin_from'); + const coinToButton = document.getElementById('coin_to_button'); + const coinFromButton = document.getElementById('coin_from_button'); + + function updateSelectedImage(selectElement, buttonElement) { + const selectedOption = selectElement.options[selectElement.selectedIndex]; + const imageURL = selectedOption.getAttribute('data-image'); + if (imageURL) { + buttonElement.style.backgroundImage = `url('${imageURL}')`; + } else { + buttonElement.style.backgroundImage = 'none'; + } + } + + coinToSelect.addEventListener('change', function() { + updateSelectedImage(coinToSelect, coinToButton); + }); + + coinFromSelect.addEventListener('change', function() { + updateSelectedImage(coinFromSelect, coinFromButton); + }); + + // Initialize selected images on page load + updateSelectedImage(coinToSelect, coinToButton); + updateSelectedImage(coinFromSelect, coinFromButton); +}); {% include 'footer.html' %}