ui: Bug fixes
This commit is contained in:
		
							parent
							
								
									69b195e317
								
							
						
					
					
						commit
						e464599cf7
					
				@ -810,7 +810,7 @@ const chart = new Chart(ctx, {
 | 
				
			|||||||
                                        </g>
 | 
					                                        </g>
 | 
				
			||||||
                                    </svg>
 | 
					                                    </svg>
 | 
				
			||||||
                                    <div class="flex flex-col" data-tooltip-target="tooltip-active{{loop.index}}">
 | 
					                                    <div class="flex flex-col" data-tooltip-target="tooltip-active{{loop.index}}">
 | 
				
			||||||
                                        <div class="{% if o[11]==true or o[12]==2 %} dark:text-white {% else %} {% endif %} text-xs"><span class="bold">Posted:</span> {{ o[0] }} ago</div>
 | 
					                                        <div class="{% if o[11]==true or o[12]==2 %} dark:text-white {% else %} {% endif %} text-xs"><span class="bold">Posted:</span> {{ o[0] }}</div>
 | 
				
			||||||
                                        <div class="{% if o[11]==true or o[12]==2 %} dark:text-white {% else %} {% endif %} text-xs"><span class="bold">Expires in:</span> {{ o[13] }}</div>
 | 
					                                        <div class="{% if o[11]==true or o[12]==2 %} dark:text-white {% else %} {% endif %} text-xs"><span class="bold">Expires in:</span> {{ o[13] }}</div>
 | 
				
			||||||
                                    </div>
 | 
					                                    </div>
 | 
				
			||||||
                                </div>
 | 
					                                </div>
 | 
				
			||||||
@ -839,16 +839,19 @@ const chart = new Chart(ctx, {
 | 
				
			|||||||
                            <!-- YOU GET YOUR OFFERR -->
 | 
					                            <!-- YOU GET YOUR OFFERR -->
 | 
				
			||||||
                            {% if o[9] == true %}
 | 
					                            {% if o[9] == true %}
 | 
				
			||||||
                            <td class="py-3 px-6 text-xs">
 | 
					                            <td class="py-3 px-6 text-xs">
 | 
				
			||||||
                              <div class="flex items-left">
 | 
					                                <div class="flex items-center">
 | 
				
			||||||
                                <span class="inline-flex align-middle items-center justify-center w-9 h-10 rounded mr-3"><img class="h-7" src="/static/images/coins/{{ o[3]|replace(" ", "-") }}.png" alt="{{ o[3] }}"></span>
 | 
					                                    <span class="inline-flex align-middle items-center justify-center w-9 h-10 rounded">
 | 
				
			||||||
                                <div class="flex flex-col ml-2">
 | 
					                                        <img class="h-7" src="/static/images/coins/{{ o[3]|replace(" ", "-") }}.png" alt="{{ o[3] }}">
 | 
				
			||||||
                                  <div class="coinname-value bold" data-coinname="{{ o[3] }}">
 | 
					                                    </span>
 | 
				
			||||||
                                    {{ o[5]|truncate(8, true, '', 0) }} {{ o[3] }}
 | 
					                                    <div class="flex flex-col ml-5">
 | 
				
			||||||
 | 
					                                      <div class="coinname bold" data-coinname="{{ o[3] }}">
 | 
				
			||||||
 | 
					                                          {{ o[3] }}
 | 
				
			||||||
 | 
					                                      </div>
 | 
				
			||||||
 | 
					                                        <div class="coinname-value" data-coinname="{{ o[2] }}">
 | 
				
			||||||
 | 
					                                            {{ o[5]|truncate(8, true, '', 0) }}  {{ o[17] }}/{{ o[16] }}
 | 
				
			||||||
                                        </div>
 | 
					                                        </div>
 | 
				
			||||||
                                        <div class="usd-value"></div>
 | 
					                                        <div class="usd-value"></div>
 | 
				
			||||||
                                  <div class="usd-value-converted-in-the-cryptocurrency"></div>
 | 
					                                        <div class="usd-value-in-coin-value"></div>
 | 
				
			||||||
                                  <div class="coin-coin hidden">{{ o[3] }}/{{ o[2] }}</div>
 | 
					 | 
				
			||||||
                                  <div class="coin-coin">{{ o[17] }}/{{ o[16] }}</div>
 | 
					 | 
				
			||||||
                                    </div>
 | 
					                                    </div>
 | 
				
			||||||
                                </div>
 | 
					                                </div>
 | 
				
			||||||
                            </td>
 | 
					                            </td>
 | 
				
			||||||
@ -880,14 +883,18 @@ const chart = new Chart(ctx, {
 | 
				
			|||||||
                            {% if o[9] == true %}
 | 
					                            {% if o[9] == true %}
 | 
				
			||||||
                            <td class="py-3 px-6 text-xs">
 | 
					                            <td class="py-3 px-6 text-xs">
 | 
				
			||||||
                                <div class="flex items-center">
 | 
					                                <div class="flex items-center">
 | 
				
			||||||
                                <span class="inline-flex align-middle items-center justify-center w-9 h-10 rounded"><img class="h-7" src="/static/images/coins/{{ o[2]|replace(" ", "-") }}.png" alt="{{ o[2] }}"></span>
 | 
					                                    <span class=" inline-flex align-middle items-center justify-center w-9 h-10 rounded">
 | 
				
			||||||
                                <div class="flex flex-col ml-2">
 | 
					                                        <img class="h-7" src="/static/images/coins/{{ o[2]|replace(" ", "-") }}.png" alt="{{ o[2] }}">
 | 
				
			||||||
                                  <div class="coinname-value bold" data-coinname="{{ o[2] }}">
 | 
					                                    </span>
 | 
				
			||||||
                                    {{ o[4]|truncate(8,true,'',0) }} {{ o[2] }}
 | 
					                                    <div class="flex flex-col ml-5">
 | 
				
			||||||
 | 
					                                      <div class="coinname bold" data-coinname="{{ o[2] }}">
 | 
				
			||||||
 | 
					                                          {{ o[2] }}
 | 
				
			||||||
 | 
					                                      </div>
 | 
				
			||||||
 | 
					                                        <div class="coinname-value" data-coinname="{{ o[3] }}">
 | 
				
			||||||
 | 
					                                            {{ o[4]|truncate(8, true, '', 0) }}  {{ o[16] }}/{{ o[17] }}
 | 
				
			||||||
                                        </div>
 | 
					                                        </div>
 | 
				
			||||||
                                        <div class="usd-value"></div>
 | 
					                                        <div class="usd-value"></div>
 | 
				
			||||||
                                  <div class="coin-value"></div>
 | 
					                                        <div class="usd-value-in-coin-value"></div>
 | 
				
			||||||
                                    <div class="coin-coin">{{ o[2] }}/{{ o[3] }}</div>
 | 
					 | 
				
			||||||
                                    </div>
 | 
					                                    </div>
 | 
				
			||||||
                                </div>
 | 
					                                </div>
 | 
				
			||||||
                            </td>
 | 
					                            </td>
 | 
				
			||||||
@ -917,7 +924,6 @@ const chart = new Chart(ctx, {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                            <!-- RATE -->
 | 
					                            <!-- RATE -->
 | 
				
			||||||
                            <td class="py-3 px-6 text-xs rate-table-info">
 | 
					                            <td class="py-3 px-6 text-xs rate-table-info">
 | 
				
			||||||
 | 
					 | 
				
			||||||
                                <div class="ratetype pt-1"><span class="bold">Rate:</span><span class="echange-rates" data-coinname="{{ o[3] }}"> {{ o[6]|truncate(8,true,'',0) }}</span>
 | 
					                                <div class="ratetype pt-1"><span class="bold">Rate:</span><span class="echange-rates" data-coinname="{{ o[3] }}"> {{ o[6]|truncate(8,true,'',0) }}</span>
 | 
				
			||||||
                                <div class="profit-name hidden">Profit Value:</div>
 | 
					                                <div class="profit-name hidden">Profit Value:</div>
 | 
				
			||||||
                                <span class="profit-value hidden"></span>
 | 
					                                <span class="profit-value hidden"></span>
 | 
				
			||||||
@ -963,7 +969,7 @@ const chart = new Chart(ctx, {
 | 
				
			|||||||
                                      <p class="text-sm font-heading dark:text-white">Page: {{ filters.page_no }}</p>
 | 
					                                      <p class="text-sm font-heading dark:text-white">Page: {{ filters.page_no }}</p>
 | 
				
			||||||
                                  </div>
 | 
					                                  </div>
 | 
				
			||||||
                              </div>
 | 
					                              </div>
 | 
				
			||||||
                              {% if offers_count > 10 %}
 | 
					                              {% if offers_count > 15 %}
 | 
				
			||||||
                              <div class="w-full md:w-auto p-1.5">
 | 
					                              <div class="w-full md:w-auto p-1.5">
 | 
				
			||||||
                                      <button type="submit" name='pageforwards' value="Next" class="inline-flex items-center h-9 py-1 px-4 text-xs text-blue-50 font-semibold bg-blue-500 hover:bg-blue-600 rounded-lg transition duration-200 focus:ring-0 focus:outline-none">
 | 
					                                      <button type="submit" name='pageforwards' value="Next" class="inline-flex items-center h-9 py-1 px-4 text-xs text-blue-50 font-semibold bg-blue-500 hover:bg-blue-600 rounded-lg transition duration-200 focus:ring-0 focus:outline-none">
 | 
				
			||||||
                                          <span>Next</span>
 | 
					                                          <span>Next</span>
 | 
				
			||||||
 | 
				
			|||||||
@ -661,7 +661,9 @@ def page_offer(self, url_split, post_string):
 | 
				
			|||||||
        'summary': summary,
 | 
					        'summary': summary,
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def format_timestamp(timestamp, is_expired=False):
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def format_timestamp(timestamp, with_ago=True, is_expired=False):
 | 
				
			||||||
    current_time = int(time.time())
 | 
					    current_time = int(time.time())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if is_expired:
 | 
					    if is_expired:
 | 
				
			||||||
@ -677,21 +679,21 @@ def format_timestamp(timestamp, is_expired=False):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if hours_ago == 0:
 | 
					        if hours_ago == 0:
 | 
				
			||||||
            if minutes_ago == 1:
 | 
					            if minutes_ago == 1:
 | 
				
			||||||
                return "1 min"
 | 
					                return "1 min ago" if with_ago else "1 min"
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                return f"{minutes_ago} mins"
 | 
					                return f"{minutes_ago} mins ago" if with_ago else f"{minutes_ago} mins"
 | 
				
			||||||
        elif hours_ago == 1:
 | 
					        elif hours_ago == 1:
 | 
				
			||||||
            if minutes_ago == 0:
 | 
					            if minutes_ago == 0:
 | 
				
			||||||
                return "1h ago"
 | 
					                return "1h ago" if with_ago else "1h"
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                return f"1h {minutes_ago}min"
 | 
					                return f"1h {minutes_ago}min ago" if with_ago else f"1h {minutes_ago}min"
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            if minutes_ago == 0:
 | 
					            if minutes_ago == 0:
 | 
				
			||||||
                return f"{int(hours_ago)}h"
 | 
					                return f"{int(hours_ago)}h ago" if with_ago else f"{int(hours_ago)}h"
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                return f"{int(hours_ago)}h {minutes_ago}min"
 | 
					                return f"{int(hours_ago)}h {minutes_ago}min ago" if with_ago else f"{int(hours_ago)}h {minutes_ago}min"
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(timestamp))
 | 
					        return time.strftime('%Y-%m-%d', time.localtime(timestamp))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def page_offers(self, url_split, post_string, sent=False):
 | 
					def page_offers(self, url_split, post_string, sent=False):
 | 
				
			||||||
    server = self.server
 | 
					    server = self.server
 | 
				
			||||||
@ -753,14 +755,17 @@ def page_offers(self, url_split, post_string, sent=False):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    now: int = swap_client.getTime()
 | 
					    now: int = swap_client.getTime()
 | 
				
			||||||
    formatted_offers = []
 | 
					    formatted_offers = []
 | 
				
			||||||
 | 
					    tla_from = ""
 | 
				
			||||||
 | 
					    tla_to = ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for row in offers:
 | 
					    for row in offers:
 | 
				
			||||||
        o, completed_amount = row
 | 
					        o, completed_amount = row
 | 
				
			||||||
        ci_from = swap_client.ci(Coins(o.coin_from))
 | 
					        ci_from = swap_client.ci(Coins(o.coin_from))
 | 
				
			||||||
        ci_to = swap_client.ci(Coins(o.coin_to))
 | 
					        ci_to = swap_client.ci(Coins(o.coin_to))
 | 
				
			||||||
        is_expired = o.expire_at <= now
 | 
					        is_expired = o.expire_at <= now
 | 
				
			||||||
        amount_negotiable = "Yes" if o.amount_negotiable else "No"
 | 
					        amount_negotiable = "Yes" if o.amount_negotiable else "No"
 | 
				
			||||||
        formatted_created_at = format_timestamp(o.created_at)
 | 
					        formatted_created_at = format_timestamp(o.created_at, with_ago=True)
 | 
				
			||||||
        formatted_expired_at = format_timestamp(o.expire_at, is_expired=True)
 | 
					        formatted_expired_at = format_timestamp(o.expire_at, with_ago=False, is_expired=True)
 | 
				
			||||||
        tla_from = ci_from.ticker()
 | 
					        tla_from = ci_from.ticker()
 | 
				
			||||||
        tla_to = ci_to.ticker()
 | 
					        tla_to = ci_to.ticker()
 | 
				
			||||||
        formatted_offers.append((
 | 
					        formatted_offers.append((
 | 
				
			||||||
@ -781,7 +786,8 @@ def page_offers(self, url_split, post_string, sent=False):
 | 
				
			|||||||
            strSwapDesc(o.swap_type),
 | 
					            strSwapDesc(o.swap_type),
 | 
				
			||||||
            amount_negotiable,
 | 
					            amount_negotiable,
 | 
				
			||||||
            tla_from,
 | 
					            tla_from,
 | 
				
			||||||
            tla_to))
 | 
					            tla_to
 | 
				
			||||||
 | 
					        ))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    coins_from, coins_to = listAvailableCoins(swap_client, split_from=True)
 | 
					    coins_from, coins_to = listAvailableCoins(swap_client, split_from=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -31,7 +31,7 @@ from basicswap.basicswap_util import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
from basicswap.protocols.xmr_swap_1 import getChainBSplitKey, getChainBRemoteSplitKey
 | 
					from basicswap.protocols.xmr_swap_1 import getChainBSplitKey, getChainBRemoteSplitKey
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PAGE_LIMIT = 30
 | 
					PAGE_LIMIT = 25
 | 
				
			||||||
invalid_coins_from = []
 | 
					invalid_coins_from = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user