generated from nathanwoodburn/python-webserver-template
feat: Sort table by value
All checks were successful
Build Docker / BuildImage (push) Successful in 36s
All checks were successful
Build Docker / BuildImage (push) Successful in 36s
This commit is contained in:
parent
2008c2cfc4
commit
508acf2bc3
2
cache/10118a51009b13b2592c87579e15e61e.json
vendored
2
cache/10118a51009b13b2592c87579e15e61e.json
vendored
@ -1 +1 @@
|
||||
{"timestamp": 1733379058.113869, "result": "120"}
|
||||
{"timestamp": 1733390400.4615693, "result": "129.72815534"}
|
1
cache/1981e30de11cf0845e8b5affb4dc75e0.json
vendored
Normal file
1
cache/1981e30de11cf0845e8b5affb4dc75e0.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"timestamp": 1733390401.1929479, "result": 3920.13}
|
2
cache/1ccff5c6f117409fea0c861aa44b8e62.json
vendored
2
cache/1ccff5c6f117409fea0c861aa44b8e62.json
vendored
@ -1 +1 @@
|
||||
{"timestamp": 1733383694.982534, "result": 1.2}
|
||||
{"timestamp": 1733390448.2838762, "result": 1.22}
|
2
cache/29409a8a40dd2d547a7a44b8f6758f54.json
vendored
2
cache/29409a8a40dd2d547a7a44b8f6758f54.json
vendored
@ -1 +1 @@
|
||||
{"timestamp": 1733383633.5427628, "result": 4.2}
|
||||
{"timestamp": 1733390447.3589993, "result": 4.19}
|
2
cache/4104ed0427efe63d4ca0dead970a4391.json
vendored
2
cache/4104ed0427efe63d4ca0dead970a4391.json
vendored
@ -1 +1 @@
|
||||
{"timestamp": 1733383572.4728422, "result": 249.28}
|
||||
{"timestamp": 1733390400.7691364, "result": 249.8}
|
2
cache/598f5dbf97fb0d45cbc6e1a5b0a3b575.json
vendored
2
cache/598f5dbf97fb0d45cbc6e1a5b0a3b575.json
vendored
@ -1 +1 @@
|
||||
{"timestamp": 1733383570.7053297, "result": 234.41}
|
||||
{"timestamp": 1733388581.604049, "result": 235.89}
|
2
cache/6eec370e2713cfc84c84e1080b8a191a.json
vendored
2
cache/6eec370e2713cfc84c84e1080b8a191a.json
vendored
@ -1 +1 @@
|
||||
{"timestamp": 1733383570.0432231, "result": 120.0}
|
||||
{"timestamp": 1733390403.2274024, "result": 129.72815534}
|
2
cache/790b28a9a21cf694ad9577ef1072ac9e.json
vendored
2
cache/790b28a9a21cf694ad9577ef1072ac9e.json
vendored
@ -1 +1 @@
|
||||
{"timestamp": 1733379058.5102375, "result": 0.006512062}
|
||||
{"timestamp": 1733390450.351181, "result": 0.005776758}
|
2
cache/94ac30c93587c50252ac382a8d02257f.json
vendored
2
cache/94ac30c93587c50252ac382a8d02257f.json
vendored
@ -1 +1 @@
|
||||
{"timestamp": 1733383570.8879113, "result": 2.4620696454199997}
|
||||
{"timestamp": 1733390400.5671725, "result": 1.36267944462}
|
2
cache/a071d7bdda25c22e42ad7840f17c4b0e.json
vendored
2
cache/a071d7bdda25c22e42ad7840f17c4b0e.json
vendored
@ -1 +1 @@
|
||||
{"timestamp": 1733383571.9041255, "result": 1.001}
|
||||
{"timestamp": 1733390400.5661695, "result": 1.001}
|
2
cache/a0ee60913ba556f39d128e7d7249e788.json
vendored
2
cache/a0ee60913ba556f39d128e7d7249e788.json
vendored
@ -1 +1 @@
|
||||
{"timestamp": 1733383633.5440447, "result": [{"mint": "jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v", "balance": 0.039815492, "price": 249.28, "value": 9.92520584576, "name": "Jupiter Staked SOL", "symbol": "jupsol"}, {"mint": "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4", "balance": 2.402337, "price": 4.2, "value": 10.0898154, "name": "Jupiter Perpetuals Liquidity Provider Token", "symbol": "jlp"}]}
|
||||
{"timestamp": 1733390451.4364688, "result": [{"mint": "jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v", "balance": 0.039815492, "price": 249.8, "value": 9.9459099016, "name": "Jupiter Staked SOL", "symbol": "jupsol"}, {"mint": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "balance": 0.00255735, "price": 3920.13, "value": 10.0251444555, "name": "Ethereum (Wormhole)", "symbol": "eth"}, {"mint": "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4", "balance": 2.402337, "price": 4.19, "value": 10.06579203, "name": "Jupiter Perpetuals Liquidity Provider Token", "symbol": "jlp"}]}
|
2
cache/b81351778df9f812bbd75ee85a7a073e.json
vendored
2
cache/b81351778df9f812bbd75ee85a7a073e.json
vendored
@ -1 +1 @@
|
||||
{"timestamp": 1733383694.9831324, "result": 121.85536329118}
|
||||
{"timestamp": 1733390500.4894085, "result": 132.43410277172}
|
2
cache/ccf2a009e56f1b05d471a55d9c9ea8ea.json
vendored
2
cache/ccf2a009e56f1b05d471a55d9c9ea8ea.json
vendored
@ -1 +1 @@
|
||||
{"timestamp": 1733383634.1566763, "result": 82.815227}
|
||||
{"timestamp": 1733390448.4887109, "result": 82.815227}
|
@ -475,7 +475,6 @@ def parseDeposit(data):
|
||||
mint_stWDBRN(stWDBRN_amount, transfer['fromUserAccount'])
|
||||
|
||||
def mint_stWDBRN(amount, to_user_account):
|
||||
|
||||
if amount < 0.5:
|
||||
print(f"Skipping minting of {amount} stWDBRN to {to_user_account} as it is less than 0.5", flush=True)
|
||||
return
|
||||
@ -507,10 +506,6 @@ def mint_stWDBRN(amount, to_user_account):
|
||||
to_Pubkey = account.value[0].pubkey
|
||||
|
||||
print(token.mint_to(to_Pubkey,wallet_keypair,int(amount*10**9)))
|
||||
|
||||
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
|
||||
|
BIN
stWDBRN.bsdesign
BIN
stWDBRN.bsdesign
Binary file not shown.
@ -134,13 +134,19 @@
|
||||
|
||||
// Create table header
|
||||
const headerRow = document.createElement('tr');
|
||||
['Name', 'Amount', 'Value'].forEach(headerText => {
|
||||
['Name', 'Amount', 'Value'].forEach((headerText, index) => {
|
||||
const th = document.createElement('th');
|
||||
th.textContent = headerText;
|
||||
th.style.border = '1px solid #ccc';
|
||||
th.style.padding = '8px 20px';
|
||||
th.style.backgroundColor = '#333';
|
||||
th.style.color = 'white';
|
||||
|
||||
if (headerText === 'Value') {
|
||||
th.style.cursor = 'pointer'; // Make it clear this header is clickable
|
||||
th.addEventListener('click', () => sortTableByValue(tbody));
|
||||
}
|
||||
|
||||
headerRow.appendChild(th);
|
||||
});
|
||||
thead.appendChild(headerRow);
|
||||
@ -171,12 +177,37 @@
|
||||
tbody.appendChild(row);
|
||||
}
|
||||
}
|
||||
|
||||
table.appendChild(thead);
|
||||
table.appendChild(tbody);
|
||||
tableContainer.appendChild(table);
|
||||
|
||||
sortTableByValue(tbody);
|
||||
}
|
||||
|
||||
// Function to sort table rows by the "Value" column
|
||||
function sortTableByValue(tbody) {
|
||||
const rows = Array.from(tbody.querySelectorAll('tr'));
|
||||
const sortedRows = rows.sort((a, b) => {
|
||||
const valueA = parseFloat(a.children[2].textContent) || 0;
|
||||
const valueB = parseFloat(b.children[2].textContent) || 0;
|
||||
return valueA - valueB;
|
||||
});
|
||||
|
||||
// Reverse order if already sorted in ascending order
|
||||
const isDecending = tbody.getAttribute('data-sort-order') === 'desc';
|
||||
if (!isDecending) {
|
||||
sortedRows.reverse();
|
||||
tbody.setAttribute('data-sort-order', 'desc');
|
||||
} else {
|
||||
tbody.setAttribute('data-sort-order', 'asc');
|
||||
}
|
||||
|
||||
// Append sorted rows back to the tbody
|
||||
tbody.innerHTML = '';
|
||||
sortedRows.forEach(row => tbody.appendChild(row));
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function toggleChart() {
|
||||
isPerTokenView = !isPerTokenView;
|
||||
|
1
tokens/7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs.json
Normal file
1
tokens/7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs.json
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user