mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 10:28:10 +01:00
Merge pull request #312 from tecnovert/ui
ui: Combine bid sent and received fields.
This commit is contained in:
@@ -329,8 +329,10 @@ const SwapTypeManager = {
|
|||||||
} else {
|
} else {
|
||||||
swapTypeElement.disabled = false;
|
swapTypeElement.disabled = false;
|
||||||
swapTypeElement.classList.remove('select-disabled');
|
swapTypeElement.classList.remove('select-disabled');
|
||||||
|
if (['xmr_swap', 'seller_first'].includes(swapTypeElement.value) == false) {
|
||||||
swapTypeElement.value = 'xmr_swap';
|
swapTypeElement.value = 'xmr_swap';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let swapTypeHidden = DOM.get('swap_type_hidden');
|
let swapTypeHidden = DOM.get('swap_type_hidden');
|
||||||
if (makeHidden) {
|
if (makeHidden) {
|
||||||
@@ -353,10 +355,6 @@ const SwapTypeManager = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function set_swap_type_enabled(coinFrom, coinTo, swapTypeElement) {
|
|
||||||
SwapTypeManager.setSwapTypeEnabled(coinFrom, coinTo, swapTypeElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
const UIEnhancer = {
|
const UIEnhancer = {
|
||||||
handleErrorHighlighting: () => {
|
handleErrorHighlighting: () => {
|
||||||
const errMsgs = document.querySelectorAll('p.error_msg');
|
const errMsgs = document.querySelectorAll('p.error_msg');
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% if data.was_sent == 'True' %}
|
{% if data.was_sent %}
|
||||||
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
||||||
<td class="py-3 px-6 bold">Swap</td>
|
<td class="py-3 px-6 bold">Swap</td>
|
||||||
<td class="py-3 px-6">
|
<td class="py-3 px-6">
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
<td class="py-3 px-6 bold">Bid Rate</td>
|
<td class="py-3 px-6 bold">Bid Rate</td>
|
||||||
<td class="py-3 px-6">{{ data.bid_rate }}</td>
|
<td class="py-3 px-6">{{ data.bid_rate }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if data.was_sent == 'True' %}
|
{% if data.was_sent %}
|
||||||
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
||||||
<td class="py-3 px-6 bold">You Send</td>
|
<td class="py-3 px-6 bold">You Send</td>
|
||||||
<td class="py-3 px-6">
|
<td class="py-3 px-6">
|
||||||
@@ -183,12 +183,8 @@
|
|||||||
<td class="py-3 px-6">{{ data.expired_at }}</td>
|
<td class="py-3 px-6">{{ data.expired_at }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
||||||
<td class="py-3 px-6 bold">Sent</td>
|
<td class="py-3 px-6 bold">Bid Type</td>
|
||||||
<td class="py-3 px-6">{{ data.was_sent }}</td>
|
<td class="py-3 px-6" id="bidtype">{% if data.was_sent and data.was_received %}Self Bid{% elif data.was_sent %}Sent{% elif data.was_received %}Received{% endif %}</td>
|
||||||
</tr>
|
|
||||||
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
|
||||||
<td class="py-3 px-6 bold">Received</td>
|
|
||||||
<td class="py-3 px-6">{{ data.was_received }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
||||||
<td class="py-3 px-6 bold">Initiate Tx</td>
|
<td class="py-3 px-6 bold">Initiate Tx</td>
|
||||||
@@ -543,7 +539,7 @@
|
|||||||
<button name="abandon_bid" type="submit" value="Abandon Bid" onclick="return confirmPopup();" class="flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-white hover:text-red border border-red-500 hover:border-red-500 hover:bg-red-600 bg-red-500 rounded-md shadow-button focus:ring-0 focus:outline-none">Abandon Bid</button>
|
<button name="abandon_bid" type="submit" value="Abandon Bid" onclick="return confirmPopup();" class="flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-white hover:text-red border border-red-500 hover:border-red-500 hover:bg-red-600 bg-red-500 rounded-md shadow-button focus:ring-0 focus:outline-none">Abandon Bid</button>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if data.was_received == 'True' and not edit_bid and data.can_accept_bid %}
|
{% if data.was_received and not edit_bid and data.can_accept_bid %}
|
||||||
<div class="w-full md:w-auto p-1.5">
|
<div class="w-full md:w-auto p-1.5">
|
||||||
<button name="accept_bid" value="Accept Bid" type="submit" onclick='return confirmPopup("Accept");' class="flex flex-wrap justify-center w-full px-4 py-2.5 bg-blue-500 hover:bg-blue-600 font-medium text-sm text-white border border-blue-500 rounded-md shadow-button focus:ring-0 focus:outline-none">Accept Bid</button>
|
<button name="accept_bid" value="Accept Bid" type="submit" onclick='return confirmPopup("Accept");' class="flex flex-wrap justify-center w-full px-4 py-2.5 bg-blue-500 hover:bg-blue-600 font-medium text-sm text-white border border-blue-500 rounded-md shadow-button focus:ring-0 focus:outline-none">Accept Bid</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% if data.was_sent == 'True' %}
|
{% if data.was_sent %}
|
||||||
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
||||||
<td class="py-3 px-6 bold">Swap</td>
|
<td class="py-3 px-6 bold">Swap</td>
|
||||||
<td class="py-3 px-6">
|
<td class="py-3 px-6">
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
<td class="py-3 px-6 bold">Bid Rate</td>
|
<td class="py-3 px-6 bold">Bid Rate</td>
|
||||||
<td class="py-3 px-6">{{ data.bid_rate }}</td>
|
<td class="py-3 px-6">{{ data.bid_rate }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if data.was_sent == 'True' %}
|
{% if data.was_sent %}
|
||||||
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
||||||
<td class="py-3 px-6 bold">You Send</td>
|
<td class="py-3 px-6 bold">You Send</td>
|
||||||
<td class="py-3 px-6">
|
<td class="py-3 px-6">
|
||||||
@@ -188,12 +188,8 @@
|
|||||||
<td class="py-3 px-6">{{ data.expired_at }}</td>
|
<td class="py-3 px-6">{{ data.expired_at }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
||||||
<td class="py-3 px-6 bold">Sent</td>
|
<td class="py-3 px-6 bold">Bid Type</td>
|
||||||
<td class="py-3 px-6">{{ data.was_sent }}</td>
|
<td class="py-3 px-6" id="bidtype">{% if data.was_sent and data.was_received %}Self Bid{% elif data.was_sent %}Sent{% elif data.was_received %}Received{% endif %}{% if data.reverse_bid %} (Transposed){% endif %}</td>
|
||||||
</tr>
|
|
||||||
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
|
||||||
<td class="py-3 px-6 bold">Received</td>
|
|
||||||
<td class="py-3 px-6">{{ data.was_received }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% if data.coin_a_lock_refund_tx_est_final != 'None' %}
|
{% if data.coin_a_lock_refund_tx_est_final != 'None' %}
|
||||||
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
||||||
@@ -819,7 +815,7 @@
|
|||||||
<button name="abandon_bid" type="submit" value="Abandon Bid" onclick="return confirmPopup();" class="flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-white hover:text-red border border-red-500 hover:border-red-500 hover:bg-red-600 bg-red-500 rounded-md focus:ring-0 focus:outline-none">Abandon Bid</button>
|
<button name="abandon_bid" type="submit" value="Abandon Bid" onclick="return confirmPopup();" class="flex flex-wrap justify-center w-full px-4 py-2.5 font-medium text-sm text-white hover:text-red border border-red-500 hover:border-red-500 hover:bg-red-600 bg-red-500 rounded-md focus:ring-0 focus:outline-none">Abandon Bid</button>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if data.was_received == 'True' and not edit_bid and data.can_accept_bid %}
|
{% if data.was_received and not edit_bid and data.can_accept_bid %}
|
||||||
<div class="w-full md:w-auto p-1.5">
|
<div class="w-full md:w-auto p-1.5">
|
||||||
<button name="accept_bid" value="Accept Bid" type="submit" onclick='return confirmPopup("Accept");' class="flex flex-wrap justify-center w-full px-4 py-2.5 bg-blue-500 hover:bg-blue-600 font-medium text-sm text-white border border-blue-500 rounded-md focus:ring-0 focus:outline-none">Accept Bid</button>
|
<button name="accept_bid" value="Accept Bid" type="submit" onclick='return confirmPopup("Accept");' class="flex flex-wrap justify-center w-full px-4 py-2.5 bg-blue-500 hover:bg-blue-600 font-medium text-sm text-white border border-blue-500 rounded-md focus:ring-0 focus:outline-none">Accept Bid</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
||||||
<td class="py-3 px-6 bold">Swap Type</td>
|
<td class="py-3 px-6 bold">Swap Type</td>
|
||||||
<td class="py-3 px-6">{{ data.swap_type }}{% if data.reverse == true %} (Reversed){% endif %}</td>
|
<td class="py-3 px-6">{{ data.swap_type }}{% if data.reverse == true %} (Transposed){% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
|
||||||
<td class="py-3 px-6 bold">{% if data.sent %}You Send{% else %}You Get{% endif %}</td>
|
<td class="py-3 px-6 bold">{% if data.sent %}You Send{% else %}You Get{% endif %}</td>
|
||||||
|
|||||||
@@ -348,8 +348,8 @@ def describeBid(
|
|||||||
if for_api
|
if for_api
|
||||||
else format_timestamp(bid.expire_at, with_seconds=True)
|
else format_timestamp(bid.expire_at, with_seconds=True)
|
||||||
),
|
),
|
||||||
"was_sent": "True" if bid.was_sent else "False",
|
"was_sent": bid.was_sent,
|
||||||
"was_received": "True" if bid.was_received else "False",
|
"was_received": bid.was_received,
|
||||||
"initiate_tx": getTxIdHex(bid, TxTypes.ITX, " " + ci_leader.ticker()),
|
"initiate_tx": getTxIdHex(bid, TxTypes.ITX, " " + ci_leader.ticker()),
|
||||||
"initiate_conf": (
|
"initiate_conf": (
|
||||||
"None"
|
"None"
|
||||||
|
|||||||
@@ -239,10 +239,8 @@ def test_swap_dir(driver):
|
|||||||
assert num_found >= 2
|
assert num_found >= 2
|
||||||
|
|
||||||
driver.get(f"{node1_url}/bid/{bid_1_id}")
|
driver.get(f"{node1_url}/bid/{bid_1_id}")
|
||||||
td_sent = driver.find_element(
|
td_dir = driver.find_element(By.ID, "bidtype")
|
||||||
"xpath", "//td[contains(text(), 'Sent')]/following-sibling::td"
|
assert "Received" == td_dir.get_attribute("innerHTML")
|
||||||
)
|
|
||||||
assert "False" in td_sent.get_attribute("innerHTML")
|
|
||||||
td_ys = driver.find_element(
|
td_ys = driver.find_element(
|
||||||
"xpath", "//td[contains(text(), 'You Send')]/following-sibling::td"
|
"xpath", "//td[contains(text(), 'You Send')]/following-sibling::td"
|
||||||
)
|
)
|
||||||
@@ -253,10 +251,8 @@ def test_swap_dir(driver):
|
|||||||
assert "Monero" in td_yg.get_attribute("innerHTML")
|
assert "Monero" in td_yg.get_attribute("innerHTML")
|
||||||
|
|
||||||
driver.get(f"{node2_url}/bid/{bid_1_id}")
|
driver.get(f"{node2_url}/bid/{bid_1_id}")
|
||||||
td_sent = driver.find_element(
|
td_dir = driver.find_element(By.ID, "bidtype")
|
||||||
"xpath", "//td[contains(text(), 'Sent')]/following-sibling::td"
|
assert "Sent" == td_dir.get_attribute("innerHTML")
|
||||||
)
|
|
||||||
assert "True" in td_sent.get_attribute("innerHTML")
|
|
||||||
td_ys = driver.find_element(
|
td_ys = driver.find_element(
|
||||||
"xpath", "//td[contains(text(), 'You Send')]/following-sibling::td"
|
"xpath", "//td[contains(text(), 'You Send')]/following-sibling::td"
|
||||||
)
|
)
|
||||||
@@ -267,10 +263,8 @@ def test_swap_dir(driver):
|
|||||||
assert "Particl" in td_yg.get_attribute("innerHTML")
|
assert "Particl" in td_yg.get_attribute("innerHTML")
|
||||||
|
|
||||||
driver.get(f"{node1_url}/bid/{bid_3_id}")
|
driver.get(f"{node1_url}/bid/{bid_3_id}")
|
||||||
td_sent = driver.find_element(
|
td_dir = driver.find_element(By.ID, "bidtype")
|
||||||
"xpath", "//td[contains(text(), 'Sent')]/following-sibling::td"
|
assert "Sent (Transposed)" == td_dir.get_attribute("innerHTML")
|
||||||
)
|
|
||||||
assert "True" in td_sent.get_attribute("innerHTML")
|
|
||||||
td_ys = driver.find_element(
|
td_ys = driver.find_element(
|
||||||
"xpath", "//td[contains(text(), 'You Send')]/following-sibling::td"
|
"xpath", "//td[contains(text(), 'You Send')]/following-sibling::td"
|
||||||
)
|
)
|
||||||
@@ -281,10 +275,8 @@ def test_swap_dir(driver):
|
|||||||
assert "Monero" in td_yg.get_attribute("innerHTML")
|
assert "Monero" in td_yg.get_attribute("innerHTML")
|
||||||
|
|
||||||
driver.get(f"{node2_url}/bid/{bid_3_id}")
|
driver.get(f"{node2_url}/bid/{bid_3_id}")
|
||||||
td_sent = driver.find_element(
|
td_dir = driver.find_element(By.ID, "bidtype")
|
||||||
"xpath", "//td[contains(text(), 'Sent')]/following-sibling::td"
|
assert "Received (Transposed)" == td_dir.get_attribute("innerHTML")
|
||||||
)
|
|
||||||
assert "False" in td_sent.get_attribute("innerHTML")
|
|
||||||
td_ys = driver.find_element(
|
td_ys = driver.find_element(
|
||||||
"xpath", "//td[contains(text(), 'You Send')]/following-sibling::td"
|
"xpath", "//td[contains(text(), 'You Send')]/following-sibling::td"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user