fix: redirect transfer transactions to user profile
This commit is contained in:
parent
8b5f341819
commit
a47f9654a6
2 changed files with 17 additions and 9 deletions
|
|
@ -93,10 +93,14 @@
|
||||||
setOpenMobile(false);
|
setOpenMobile(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleTradeClick(coinSymbol: string) {
|
async function handleTradeClick(coinSymbol: string, trade: any) {
|
||||||
const targetPath = `/coin/${coinSymbol.toLowerCase()}`;
|
if (trade.type === 'TRANSFER_IN' || trade.type === 'TRANSFER_OUT') {
|
||||||
|
const targetPath = `/user/${trade.username}`;
|
||||||
await goto(targetPath, { invalidateAll: true });
|
await goto(targetPath, { invalidateAll: true });
|
||||||
|
} else {
|
||||||
|
const targetPath = `/coin/${coinSymbol.toLowerCase()}`;
|
||||||
|
await goto(targetPath, { invalidateAll: true });
|
||||||
|
}
|
||||||
setOpenMobile(false);
|
setOpenMobile(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -252,7 +256,7 @@
|
||||||
{:else}
|
{:else}
|
||||||
{#each $liveTradesStore.slice(0, 5) as trade, index (`${trade.timestamp}-${trade.username}-${trade.coinSymbol}-${index}`)}
|
{#each $liveTradesStore.slice(0, 5) as trade, index (`${trade.timestamp}-${trade.username}-${trade.coinSymbol}-${index}`)}
|
||||||
<button
|
<button
|
||||||
onclick={() => handleTradeClick(trade.coinSymbol)}
|
onclick={() => handleTradeClick(trade.coinSymbol, trade)}
|
||||||
class="hover:bg-muted/50 flex w-full cursor-pointer items-center gap-2 rounded px-1 py-1 text-left text-xs transition-colors"
|
class="hover:bg-muted/50 flex w-full cursor-pointer items-center gap-2 rounded px-1 py-1 text-left text-xs transition-colors"
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,12 @@
|
||||||
goto(`/user/${username}`);
|
goto(`/user/${username}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCoinClick(coinSymbol: string) {
|
function handleCoinClick(coinSymbol: string, trade: any) {
|
||||||
goto(`/coin/${coinSymbol.toLowerCase()}`);
|
if (trade.type === 'TRANSFER_IN' || trade.type === 'TRANSFER_OUT') {
|
||||||
|
goto(`/user/${trade.username}`);
|
||||||
|
} else {
|
||||||
|
goto(`/coin/${coinSymbol.toLowerCase()}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
|
@ -84,7 +88,7 @@
|
||||||
{#if trade.type === 'TRANSFER_IN' || trade.type === 'TRANSFER_OUT'}
|
{#if trade.type === 'TRANSFER_IN' || trade.type === 'TRANSFER_OUT'}
|
||||||
{#if trade.amount > 0}
|
{#if trade.amount > 0}
|
||||||
<button
|
<button
|
||||||
onclick={() => handleCoinClick(trade.coinSymbol)}
|
onclick={() => handleCoinClick(trade.coinSymbol, trade)}
|
||||||
class="flex cursor-pointer items-center gap-1.5 transition-opacity hover:underline hover:opacity-80"
|
class="flex cursor-pointer items-center gap-1.5 transition-opacity hover:underline hover:opacity-80"
|
||||||
>
|
>
|
||||||
<CoinIcon
|
<CoinIcon
|
||||||
|
|
@ -111,7 +115,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<button
|
<button
|
||||||
onclick={() => handleCoinClick(trade.coinSymbol)}
|
onclick={() => handleCoinClick(trade.coinSymbol, trade)}
|
||||||
class="flex cursor-pointer items-center gap-1.5 transition-opacity hover:underline hover:opacity-80"
|
class="flex cursor-pointer items-center gap-1.5 transition-opacity hover:underline hover:opacity-80"
|
||||||
>
|
>
|
||||||
<CoinIcon
|
<CoinIcon
|
||||||
|
|
|
||||||
Reference in a new issue