@@ -5,6 +5,9 @@ import type { Token } from "$lib/schema/token.ts"
5
5
import { Option } from " effect"
6
6
import Skeleton from " $lib/components/ui/Skeleton.svelte"
7
7
import { formatUnits } from " viem"
8
+ import type { Chain } from " $lib/schema/chain.ts"
9
+ import { chains } from " $lib/stores/chains.svelte.ts"
10
+ import SharpArrowLeft from " $lib/components/icons/SharpArrowLeft.svelte"
8
11
9
12
type Props = {
10
13
token: Token
@@ -35,38 +38,51 @@ let displayAmount = $derived.by(() => {
35
38
})
36
39
37
40
let isLoading = $derived (Option .isSome (transfer .sortedBalances ) && Option .isNone (tokenBalance ))
41
+ $effect (() => {
42
+ console .log (token )
43
+ })
44
+
45
+ export const toDisplayName = (
46
+ chain_id : string | undefined | null ,
47
+ chains : ReadonlyArray <Chain >
48
+ ): string => chains .find (c => c .chain_id === chain_id )?.display_name ?? chain_id ?? " unknown chain"
38
49
</script >
39
50
40
51
<button
41
52
class ={cn (
42
- " flex items-center w-full px-4 py-2 text-left hover:bg-zinc-700 transition-colors border-b border-zinc-700 cursor-pointer" ,
53
+ " flex flex-col items-start w-full overflow-x-scroll px-4 py-2 text-left hover:bg-zinc-700 transition-colors border-b border-zinc-700 cursor-pointer" ,
43
54
isSelected ? " bg-zinc-700 text-white" : " text-zinc-300"
44
55
)}
45
- onclick ={() => selectAsset (token )}
56
+ onclick ={() => {
57
+ console .log (token )
58
+ selectAsset (token )
59
+ }}
46
60
>
47
- <div class =" flex-1 min-w-0" >
48
- <div class =" font-medium text-sm truncate" >
49
- {token .representations [0 ]?.name ?? token .denom }
50
- </div >
51
- {#if token .representations [0 ]?.name }
52
- <div class =" text-xs text-zinc-400 truncate w-24 truncate" >
53
- {token .denom }
61
+ <div class =" flex items-center flex gap-1 items-center overflow-x-scroll text-xs text-zinc-200" >
62
+ <div class =" mr-1" >
63
+ {#if isLoading }
64
+ <Skeleton class =" h-3 w-16" />
65
+ {:else if Option .isSome (tokenBalance ) && Option .isSome (tokenBalance .value .error )}
66
+ <span class =" text-red-400" >Error</span >
67
+ {:else }
68
+ {displayAmount }
69
+ {/if }
54
70
</div >
55
- {/if }
56
- </div >
57
- <div class =" ml-2 text-right flex items-center" >
58
- <div class =" text-xs text-zinc-400 mr-2" >
59
- {#if isLoading }
60
- <Skeleton class =" h-3 w-16" />
61
- {:else if Option .isSome (tokenBalance ) && Option .isSome (tokenBalance .value .error )}
62
- <span class =" text-red-400" >Error</span >
63
- {:else }
64
- {displayAmount }
71
+ <div class =" font-medium" >
72
+ {token .representations [0 ]?.symbol ?? token .denom }
73
+ </div >
74
+ </div >
75
+ <div class =" text-zinc-400 text-nowrap text-xs flex items-center gap-1" >
76
+ {#if Option .isSome (chains .data )}
77
+ {#each token .wrapping as wrapping , i }
78
+ {#if i !== 0 }
79
+ <SharpArrowLeft class =" text-sky-300" />
80
+ {/if }
81
+ {toDisplayName (
82
+ wrapping .unwrapped_chain .universal_chain_id ,
83
+ chains .data .value ,
84
+ )}
85
+ {/each }
65
86
{/if }
66
87
</div >
67
- <svg xmlns =" http://www.w3.org/2000/svg" width =" 16" height =" 16" viewBox =" 0 0 24 24" fill =" none"
68
- stroke =" currentColor" stroke-width =" 2" stroke-linecap =" round" stroke-linejoin =" round" >
69
- <polyline points =" 9 18 15 12 9 6" ></polyline >
70
- </svg >
71
- </div >
72
88
</button >
0 commit comments