ui: Switch offers offer/bid amounts when sent.

2024-05-20_merge
tecnovert 2 years ago
parent ef51719e62
commit 7101a5d1ee
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 12
      basicswap/templates/offer.html
  2. 16
      basicswap/templates/offers.html
  3. 2
      basicswap/ui/page_offers.py
  4. 2
      tests/basicswap/extended/test_xmr_persistent.py

@ -107,23 +107,23 @@
<td>{{ data.state }}</td> <td>{{ data.state }}</td>
</tr> </tr>
<tr class="bg-white border-t hover:bg-gray-50"> <tr class="bg-white border-t hover:bg-gray-50">
<td class="py-4 px-6 bold">{% if data.sent %}You Send{% else %}You Send{% endif %}</td> <td class="py-4 px-6 bold">{% if data.sent %}You Send{% else %}You Get{% endif %}</td>
<td><span class="inline-flex align-middle items-center justify-center w-9 h-10 bg-white-50 rounded"> <td><span class="inline-flex align-middle items-center justify-center w-9 h-10 bg-white-50 rounded">
<img class="h-7" src="/static/images/coins/{{ data.coin_from }}.png" alt="{{ data.coin_from }}"> <img class="h-7" src="/static/images/coins/{{ data.coin_from }}.png" alt="{{ data.coin_from }}">
</span> {{ data.coin_from }} </td> </span> {{ data.coin_from }} </td>
</tr> </tr>
<tr class="bg-white border-t hover:bg-gray-50"> <tr class="bg-white border-t hover:bg-gray-50">
<td class="py-4 px-6 bold">{% if data.sent %}You Get{% else %}You Get{% endif %}</td> <td class="py-4 px-6 bold">{% if data.sent %}You Get{% else %}You Send{% endif %}</td>
<td><span class="inline-flex align-middle items-center justify-center w-9 h-10 bg-white-50 rounded"> <td><span class="inline-flex align-middle items-center justify-center w-9 h-10 bg-white-50 rounded">
<img class="h-7" src="/static/images/coins/{{ data.coin_to }}.png" alt="{{ data.coin_to }}"> <img class="h-7" src="/static/images/coins/{{ data.coin_to }}.png" alt="{{ data.coin_to }}">
</span> {{ data.coin_to }} </td> </span> {{ data.coin_to }} </td>
</tr> </tr>
<tr class="bg-white border-t hover:bg-gray-50"> <tr class="bg-white border-t hover:bg-gray-50">
<td class="py-4 px-6 bold">Amount You Get</td> <td class="py-4 px-6 bold">Amount Offerer Sends</td>
<td class="bold">{{ data.amt_from }} {{ data.tla_from }}</td> <td class="bold">{{ data.amt_from }} {{ data.tla_from }}</td>
</tr> </tr>
<tr class="bg-white border-t hover:bg-gray-50"> <tr class="bg-white border-t hover:bg-gray-50">
<td class="py-4 px-6 bold">Amount You Send</td> <td class="py-4 px-6 bold">Amount Bidder Send</td>
<td class="bold">{{ data.amt_to }} {{ data.tla_to }}</td> <td class="bold">{{ data.amt_to }} {{ data.tla_to }}</td>
</tr> </tr>
<tr class="bg-white border-t hover:bg-gray-50"> <tr class="bg-white border-t hover:bg-gray-50">
@ -202,7 +202,7 @@
<td class="py-4 px-6 bold">Revoked</td> <td class="py-4 px-6 bold">Revoked</td>
<td>{{ data.was_revoked }}</td> <td>{{ data.was_revoked }}</td>
</tr> </tr>
{% if data.sent == 'True' %} {% if data.sent %}
<tr class="bg-white border-t hover:bg-gray-50"> <tr class="bg-white border-t hover:bg-gray-50">
<td class="py-4 px-6 bold">Auto Accept Strategy</td> <td class="py-4 px-6 bold">Auto Accept Strategy</td>
<td> <td>
@ -381,7 +381,7 @@
</g> </g>
</svg>New Bid</button> </svg>New Bid</button>
</div> </div>
{% if data.sent == 'True' %} {% if data.sent %}
<div class="w-full md:w-auto p-1.5"> <div class="w-full md:w-auto p-1.5">
<button name="repeat_offer" value="Repeat Offer" type="submit" class="flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-coolGray-500 hover:text-coolGray-600 border border-coolGray-200 hover:border-coolGray-300 bg-white rounded-md shadow-button focus:ring-0 focus:outline-none"> <button name="repeat_offer" value="Repeat Offer" type="submit" class="flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-coolGray-500 hover:text-coolGray-600 border border-coolGray-200 hover:border-coolGray-300 bg-white rounded-md shadow-button focus:ring-0 focus:outline-none">
<svg class="mr-2" xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 24 24"> <svg class="mr-2" xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 24 24">

@ -238,9 +238,10 @@
<svg class="absolute right-4 top-1/2 transform -translate-y-1/2 " width="16 " height="16 " viewBox="0 0 16 16 " fill="none " xmlns="http://www.w3.org/2000/svg "> <svg class="absolute right-4 top-1/2 transform -translate-y-1/2 " width="16 " height="16 " viewBox="0 0 16 16 " fill="none " xmlns="http://www.w3.org/2000/svg ">
<path d="M11.3333 6.1133C11.2084 5.98913 11.0395 5.91943 10.8633 5.91943C10.6872 5.91943 10.5182 5.98913 10.3933 6.1133L8.00001 8.47329L5.64001 6.1133C5.5151 5.98913 5.34613 5.91943 5.17001 5.91943C4.99388 5.91943 4.82491 5.98913 4.70001 6.1133C4.63752 6.17527 4.58792 6.249 4.55408 6.33024C4.52023 6.41148 4.50281 6.49862 4.50281 6.58663C4.50281 6.67464 4.52023 6.76177 4.55408 6.84301C4.58792 6.92425 4.63752 6.99799 4.70001 7.05996L7.52667 9.88663C7.58865 9.94911 7.66238 9.99871 7.74362 10.0326C7.82486 10.0664 7.912 10.0838 8.00001 10.0838C8.08801 10.0838 8.17515 10.0664 8.25639 10.0326C8.33763 9.99871 8.41136 9.94911 8.47334 9.88663L11.3333 7.05996C11.3958 6.99799 11.4454 6.92425 11.4793 6.84301C11.5131 6.76177 11.5305 6.67464 11.5305 6.58663C11.5305 6.49862 11.5131 6.41148 11.4793 6.33024C11.4454 6.249 11.3958 6.17527 11.3333 6.1133Z " fill="#8896AB "> </path> <path d="M11.3333 6.1133C11.2084 5.98913 11.0395 5.91943 10.8633 5.91943C10.6872 5.91943 10.5182 5.98913 10.3933 6.1133L8.00001 8.47329L5.64001 6.1133C5.5151 5.98913 5.34613 5.91943 5.17001 5.91943C4.99388 5.91943 4.82491 5.98913 4.70001 6.1133C4.63752 6.17527 4.58792 6.249 4.55408 6.33024C4.52023 6.41148 4.50281 6.49862 4.50281 6.58663C4.50281 6.67464 4.52023 6.76177 4.55408 6.84301C4.58792 6.92425 4.63752 6.99799 4.70001 7.05996L7.52667 9.88663C7.58865 9.94911 7.66238 9.99871 7.74362 10.0326C7.82486 10.0664 7.912 10.0838 8.00001 10.0838C8.08801 10.0838 8.17515 10.0664 8.25639 10.0326C8.33763 9.99871 8.41136 9.94911 8.47334 9.88663L11.3333 7.05996C11.3958 6.99799 11.4454 6.92425 11.4793 6.84301C11.5131 6.76177 11.5305 6.67464 11.5305 6.58663C11.5305 6.49862 11.5131 6.41148 11.4793 6.33024C11.4454 6.249 11.3958 6.17527 11.3333 6.1133Z " fill="#8896AB "> </path>
</svg> </svg>
<select is="ms-dropdown" name="coin_to" class="appearance-none pr-10 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"> <select is="ms-dropdown" name="coin_from" class="appearance-none pr-10 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="any" {% if filters.coin_from==-1 %} selected{% endif %}>Any</option>
{% for c in coins_from %} {% for c in coins_from %}
<option class="text-sm" value="{{ c[0] }}" {% if filters.coin_to==c[0] %} selected{% endif %} data-image="/static/images/coins/{{ c[1]|replace(" ", "-") }}-20.png">{{ c[1] }}</option> <option class="text-sm" value="{{ c[0] }}" {% if filters.coin_from==c[0] %} selected{% endif %} data-image="/static/images/coins/{{ c[1]|replace(" ", "-") }}-20.png">{{ c[1] }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
@ -259,9 +260,10 @@
<svg class="absolute right-4 top-1/2 transform -translate-y-1/2" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg class="absolute right-4 top-1/2 transform -translate-y-1/2" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.3333 6.1133C11.2084 5.98913 11.0395 5.91943 10.8633 5.91943C10.6872 5.91943 10.5182 5.98913 10.3933 6.1133L8.00001 8.47329L5.64001 6.1133C5.5151 5.98913 5.34613 5.91943 5.17001 5.91943C4.99388 5.91943 4.82491 5.98913 4.70001 6.1133C4.63752 6.17527 4.58792 6.249 4.55408 6.33024C4.52023 6.41148 4.50281 6.49862 4.50281 6.58663C4.50281 6.67464 4.52023 6.76177 4.55408 6.84301C4.58792 6.92425 4.63752 6.99799 4.70001 7.05996L7.52667 9.88663C7.58865 9.94911 7.66238 9.99871 7.74362 10.0326C7.82486 10.0664 7.912 10.0838 8.00001 10.0838C8.08801 10.0838 8.17515 10.0664 8.25639 10.0326C8.33763 9.99871 8.41136 9.94911 8.47334 9.88663L11.3333 7.05996C11.3958 6.99799 11.4454 6.92425 11.4793 6.84301C11.5131 6.76177 11.5305 6.67464 11.5305 6.58663C11.5305 6.49862 11.5131 6.41148 11.4793 6.33024C11.4454 6.249 11.3958 6.17527 11.3333 6.1133Z" fill="#8896AB"> </path> <path d="M11.3333 6.1133C11.2084 5.98913 11.0395 5.91943 10.8633 5.91943C10.6872 5.91943 10.5182 5.98913 10.3933 6.1133L8.00001 8.47329L5.64001 6.1133C5.5151 5.98913 5.34613 5.91943 5.17001 5.91943C4.99388 5.91943 4.82491 5.98913 4.70001 6.1133C4.63752 6.17527 4.58792 6.249 4.55408 6.33024C4.52023 6.41148 4.50281 6.49862 4.50281 6.58663C4.50281 6.67464 4.52023 6.76177 4.55408 6.84301C4.58792 6.92425 4.63752 6.99799 4.70001 7.05996L7.52667 9.88663C7.58865 9.94911 7.66238 9.99871 7.74362 10.0326C7.82486 10.0664 7.912 10.0838 8.00001 10.0838C8.08801 10.0838 8.17515 10.0664 8.25639 10.0326C8.33763 9.99871 8.41136 9.94911 8.47334 9.88663L11.3333 7.05996C11.3958 6.99799 11.4454 6.92425 11.4793 6.84301C11.5131 6.76177 11.5305 6.67464 11.5305 6.58663C11.5305 6.49862 11.5131 6.41148 11.4793 6.33024C11.4454 6.249 11.3958 6.17527 11.3333 6.1133Z" fill="#8896AB"> </path>
</svg> </svg>
<select is="ms-dropdown" name="coin_from " class="appearance-none pr-10 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"> <select is="ms-dropdown" name="coin_to" class="appearance-none pr-10 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
<option value="any" {% if filters.coin_to==-1 %} selected{% endif %}>Any</option>
{% for c in coins %} {% for c in coins %}
<option class="text-sm" value="{{ c[0] }}" {% if filters.coin_from==c[0] %} selected{% endif %} data-image="/static/images/coins/{{ c[1]|replace(" ", "-") }}-20.png">{{ c[1] }}</option> <option class="text-sm" value="{{ c[0] }}" {% if filters.coin_to==c[0] %} selected{% endif %} data-image="/static/images/coins/{{ c[1]|replace(" ", "-") }}-20.png">{{ c[1] }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
@ -403,17 +405,19 @@
<td class="py-4"><span class="inline-flex align-middle items-center justify-center w-9 h-10 bg-white-50 rounded"> <td class="py-4"><span class="inline-flex align-middle items-center justify-center w-9 h-10 bg-white-50 rounded">
{% if o[9]==true %} {% if o[9]==true %}
<img class="h-7" src="/static/images/coins/{{ o[3]|replace(" ", "-") }}.png" alt=""></span> {{ o[3] }}</td> <img class="h-7" src="/static/images/coins/{{ o[3]|replace(" ", "-") }}.png" alt=""></span> {{ o[3] }}</td>
<td class="py-4 text-xs">{{ o[5] }}</td>
{% else %} {% else %}
<img class="h-7" src="/static/images/coins/{{ o[2]|replace(" ", "-") }}.png" alt=""></span> {{ o[2] }}</td> <img class="h-7" src="/static/images/coins/{{ o[2]|replace(" ", "-") }}.png" alt=""></span> {{ o[2] }}</td>
{% endif %}
<td class="py-4 text-xs">{{ o[4] }}</td> <td class="py-4 text-xs">{{ o[4] }}</td>
{% endif %}
<td class="py-4"><span class="inline-flex align-middle items-center justify-center w-9 h-10 bg-white-50 rounded"> <td class="py-4"><span class="inline-flex align-middle items-center justify-center w-9 h-10 bg-white-50 rounded">
{% if o[9]==true %} {% if o[9]==true %}
<img class="h-7" src="/static/images/coins/{{ o[2]|replace(" ", "-") }}.png" alt=""></span> {{ o[2] }}</td> <img class="h-7" src="/static/images/coins/{{ o[2]|replace(" ", "-") }}.png" alt=""></span> {{ o[2] }}</td>
<td class="py-4 text-xs">{{ o[4] }}</td>
{% else %} {% else %}
<img class="h-7" src="/static/images/coins/{{ o[3]|replace(" ", "-") }}.png" alt=""></span> {{ o[3] }}</td> <img class="h-7" src="/static/images/coins/{{ o[3]|replace(" ", "-") }}.png" alt=""></span> {{ o[3] }}</td>
{% endif %}
<td class="py-4 text-xs">{{ o[5] }}</td> <td class="py-4 text-xs">{{ o[5] }}</td>
{% endif %}
<td class="py-4 text-xs px-6">{{ o[6] }}</td> <td class="py-4 text-xs px-6">{{ o[6] }}</td>
<!-- <td class="py-4 px-6">{{ o[10] }}</td>--> <!-- <td class="py-4 px-6">{{ o[10] }}</td>-->
<td class="py-4 px-6"> <a class="inline-block w-20 py-1 px-2 font-medium text-center text-sm rounded-md shadow-button {% if o[9]==true %} bg-white text-coolGray-500 hover:text-coolGray-600 border border-coolGray-200 hover:border-coolGray-300 {% else %} bg-blue-500 text-white {% endif %}" href="/offer/{{ o[1] }}">{% if o[9]==true %}Edit{% else %}Swap{% endif %}</a> </td> <td class="py-4 px-6"> <a class="inline-block w-20 py-1 px-2 font-medium text-center text-sm rounded-md shadow-button {% if o[9]==true %} bg-white text-coolGray-500 hover:text-coolGray-600 border border-coolGray-200 hover:border-coolGray-300 {% else %} bg-blue-500 text-white {% endif %}" href="/offer/{{ o[1] }}">{% if o[9]==true %}Edit{% else %}Swap{% endif %}</a> </td>

@ -493,7 +493,7 @@ def page_offer(self, url_split, post_string):
'addr_to': 'Public' if offer.addr_to == swap_client.network_addr else offer.addr_to, 'addr_to': 'Public' if offer.addr_to == swap_client.network_addr else offer.addr_to,
'created_at': offer.created_at, 'created_at': offer.created_at,
'expired_at': offer.expire_at, 'expired_at': offer.expire_at,
'sent': 'True' if offer.was_sent else 'False', 'sent': offer.was_sent,
'was_revoked': 'True' if offer.active_ind == 2 else 'False', 'was_revoked': 'True' if offer.active_ind == 2 else 'False',
'show_bid_form': show_bid_form, 'show_bid_form': show_bid_form,
'amount_negotiable': offer.amount_negotiable, 'amount_negotiable': offer.amount_negotiable,

@ -11,6 +11,8 @@ export TEST_PATH=/tmp/test_persistent
mkdir -p ${TEST_PATH}/bin mkdir -p ${TEST_PATH}/bin
cp -r ~/tmp/basicswap_bin/* ${TEST_PATH}/bin cp -r ~/tmp/basicswap_bin/* ${TEST_PATH}/bin
export PYTHONPATH=$(pwd) export PYTHONPATH=$(pwd)
export XMR_RPC_USER=xmr_user
export XMR_RPC_PWD=xmr_pwd
python tests/basicswap/extended/test_xmr_persistent.py python tests/basicswap/extended/test_xmr_persistent.py
""" """

Loading…
Cancel
Save