-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 1. Resize window and hide dom. 2. init app non blocking * feat: UX/UI enhancements for Transaction history page (#294) * feat: UX/UI enhancements for Transaction history page * chore: cleaning * Chore(deps): Bump flowbite from 1.8.1 to 2.2.0 (#306) Bumps [flowbite](https://github.com/themesberg/flowbite) from 1.8.1 to 2.2.0. - [Release notes](https://github.com/themesberg/flowbite/releases) - [Commits](themesberg/flowbite@v1.8.1...v2.2.0) --- updated-dependencies: - dependency-name: flowbite dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * 1. Transaction history design 2. Banners on messages 3. Dependabot * Chore(deps-dev): Bump prettier from 2.8.8 to 3.1.0 (#308) * Chore(deps-dev): Bump svelte from 4.2.1 to 4.2.7 (#305) Bumps [svelte](https://github.com/sveltejs/svelte/tree/HEAD/packages/svelte) from 4.2.1 to 4.2.7. - [Release notes](https://github.com/sveltejs/svelte/releases) - [Changelog](https://github.com/sveltejs/svelte/blob/[email protected]/packages/svelte/CHANGELOG.md) - [Commits](https://github.com/sveltejs/svelte/commits/[email protected]/packages/svelte) --- updated-dependencies: - dependency-name: svelte dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Chore(deps-dev): Bump prettier from 2.8.8 to 3.1.0 Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.1.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](prettier/prettier@2.8.8...3.1.0) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Chore(deps-dev): Bump @typescript-eslint/eslint-plugin (#299) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.59.11 to 6.9.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.9.1/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Chore(deps-dev): Bump autoprefixer from 10.4.14 to 10.4.16 (#297) Bumps [autoprefixer](https://github.com/postcss/autoprefixer) from 10.4.14 to 10.4.16. - [Release notes](https://github.com/postcss/autoprefixer/releases) - [Changelog](https://github.com/postcss/autoprefixer/blob/main/CHANGELOG.md) - [Commits](postcss/autoprefixer@10.4.14...10.4.16) --- updated-dependencies: - dependency-name: autoprefixer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Merge branch '307-make-app-more-responsive' of https://github.com/stacks-network/sbtc-bridge-web into 307-make-app-more-responsive * '307-make-app-more-responsive' of https://github.com/stacks-network/sbtc-bridge-web: Chore(deps-dev): Bump autoprefixer from 10.4.14 to 10.4.16 (#297) Chore(deps-dev): Bump @typescript-eslint/eslint-plugin (#299) --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Maxime Laforet <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f0516fe
commit a0f28e6
Showing
17 changed files
with
1,435 additions
and
912 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 145 additions & 0 deletions
145
src/lib/components/dashboard/shared/TxsHistoryTable.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
<script lang="ts"> | ||
import { onMount } from 'svelte'; | ||
import { Table, TableBody, TableBodyCell, TableBodyRow, TableHead, TableHeadCell } from 'flowbite-svelte'; | ||
import { page } from '$app/stores'; | ||
import { COMMS_ERROR, explorerTxUrl } from '$lib/utils.js' | ||
import { truncate, explorerBtcTxUrl } from '$lib/utils' | ||
import { findSbtcEventByBitcoinAddress, findSbtcEventsByPage } from '$lib/bridge_api' | ||
import { fmtNumber, type SbtcClarityEvent } from 'sbtc-bridge-lib' | ||
import { satsToBitcoin } from '$lib/utils' | ||
import ArrowUpRight from '$lib/components/shared/ArrowUpRight.svelte'; | ||
import Paging from '$lib/components/transactions/Paging.svelte'; | ||
import { sbtcConfig } from '$stores/stores'; | ||
import { CONFIG } from '$lib/config'; | ||
// fetch/hydrate data from local storage | ||
let inited = false; | ||
let sbtcEvents:{ results: Array<SbtcClarityEvent>, events:number} | ||
let errorReason:string|undefined; | ||
let myDepositsFilter:boolean; | ||
const limit = 20; | ||
let numPages = 0; | ||
const getReclaimUrl = (pegin:any) => { | ||
return '/transactions/' + pegin.bitcoinTxid.payload.value.split('x')[1] | ||
} | ||
const getType = (eventType:string|undefined) => { | ||
return (eventType === 'mint') ? 'deposit' : 'withdrawal' | ||
} | ||
const getAddress = (event:any) => { | ||
const type = getType(event.payloadData.eventType) | ||
if (event.payloadData.eventType === 'mint') { | ||
return event.recipient | ||
} | ||
} | ||
const toggleMine = async () => { | ||
sbtcEvents.results = [] | ||
sbtcEvents.events = 0 | ||
myDepositsFilter = !myDepositsFilter | ||
if (!myDepositsFilter) await fetchPageCheck(0) | ||
else fetchMine() | ||
} | ||
const fetchMine = async () => { | ||
const mySbtcEvents = await findSbtcEventByBitcoinAddress($sbtcConfig.keySets[CONFIG.VITE_NETWORK].cardinal) | ||
sbtcEvents.results = mySbtcEvents | ||
sbtcEvents.events = mySbtcEvents.length | ||
} | ||
const fetchPage = async (evt:any) => { | ||
await fetchPageCheck(evt.detail.page) | ||
} | ||
const fetchPageCheck = async (mypage:number) => { | ||
if (mypage < 0) mypage = 0 | ||
if (mypage > numPages) mypage = numPages | ||
sbtcEvents = await findSbtcEventsByPage(mypage, limit) | ||
const resid = ((sbtcEvents.events % limit) > 0) ? 1 : 0; | ||
numPages = Math.floor(sbtcEvents.events / limit) + resid; | ||
} | ||
onMount(async () => { | ||
try { | ||
let mypage = 0; | ||
if ($page.url.searchParams.has('page')) { | ||
mypage = Number($page.url.searchParams.get('page')) - 1 | ||
} | ||
await fetchPageCheck(mypage) | ||
inited = true; | ||
} catch (err) { | ||
errorReason = COMMS_ERROR; | ||
} | ||
}) | ||
</script> | ||
|
||
|
||
<Table> | ||
<TableHead class="!dark:bg-transparent !bg-transparent !text-base !text-white !normal-case border-b border-white"> | ||
<TableHeadCell class="!px-0 !font-normal">Amount (BTC)</TableHeadCell> | ||
<TableHeadCell class="!px-0 !font-normal">Address</TableHeadCell> | ||
<TableHeadCell class="!px-0 !font-normal">Type</TableHeadCell> | ||
<TableHeadCell class="!px-0 !font-normal">Height</TableHeadCell> | ||
<TableHeadCell class="!px-0 !font-normal !text-right">Actions</TableHeadCell> | ||
</TableHead> | ||
<TableBody> | ||
{#each sbtcEvents.results as event} | ||
<TableBodyRow class="!dark:bg-transparent !bg-transparent !border-transparent"> | ||
<TableBodyCell class="!px-0 !py-2 !font-extralight">{satsToBitcoin(event.payloadData.amountSats)}</TableBodyCell> | ||
<TableBodyCell class="!px-0 !py-2 !font-extralight"> | ||
<div class="flex items-center"> | ||
<a class="" href={explorerBtcTxUrl(event.bitcoinTxid.payload.value.split('x')[1])} target="_blank" rel="noreferrer">{truncate(event.payloadData.spendingAddress, 5)}</a> | ||
<div class="ms-3"> | ||
<ArrowUpRight class="h-6 w-6 text-white" target={explorerBtcTxUrl(event.bitcoinTxid.payload.value.split('x')[1])} /> | ||
</div> | ||
</div> | ||
</TableBodyCell> | ||
<TableBodyCell class="!px-0 !py-2 !font-extralight"> | ||
<div class="flex items-center"> | ||
{#if getType(event.payloadData.eventType) === 'deposit'} | ||
<span class="border px-3 py-1 rounded-2xl text-yellow-400 border-yellow-400"> | ||
{getType(event.payloadData.eventType)} | ||
</span> | ||
{:else} | ||
<span class="border px-3 py-1 rounded-2xl text-blue-400 border-blue-400"> | ||
{getType(event.payloadData.eventType)} | ||
</span> | ||
{/if} | ||
<div class="ms-3"> | ||
<ArrowUpRight class="h-6 w-6 text-white" target={explorerTxUrl(event.txid)} /> | ||
</div> | ||
</div> | ||
</TableBodyCell> | ||
<TableBodyCell class="!px-0 !py-2 !font-extralight">{fmtNumber(event.payloadData.burnBlockHeight)}</TableBodyCell> | ||
<TableBodyCell class="!px-0 !py-2 !font-extralight !text-right"> | ||
<a | ||
type="button" | ||
class="text-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500/50 hover:underline" | ||
href={getReclaimUrl(event)} | ||
> | ||
View details | ||
</a> | ||
</TableBodyCell> | ||
</TableBodyRow> | ||
{/each} | ||
</TableBody> | ||
</Table> | ||
|
||
<div class="py-6 border-t border-white flex items-center justify-between mt-6"> | ||
<div> | ||
<p class="text-sm font-extralight"> | ||
Showing | ||
<span class="font-normal">1</span> | ||
to | ||
<span class="font-normal">10</span> | ||
of | ||
<span class="font-normal">97</span> | ||
results | ||
</p> | ||
</div> | ||
<Paging on:fetch_page={fetchPage} {numPages} totalEvents={(sbtcEvents) ? sbtcEvents.events : 0} limit={20}/> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.