Skip to content

Commit a64aac7

Browse files
committed
More cohesive UI
1 parent abe666f commit a64aac7

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

explorer/src/components/DropdownSelector.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export function DropdownSelector<T>({
110110
>
111111
<Button
112112
variant='outline'
113-
className={`w-full justify-start p-2 h-12 ${className ?? ''}`}
113+
className={`w-full justify-start p-2 h-16 ${className ?? ''}`}
114114
onClick={() => setIsOpen(!isOpen)}
115115
aria-expanded={isOpen}
116116
aria-haspopup='listbox'
@@ -123,7 +123,7 @@ export function DropdownSelector<T>({
123123

124124
{isOpen && (
125125
<div
126-
className={`absolute z-50 ${width} bg-background border rounded-md shadow-lg`}
126+
className={`absolute z-50 ${width} bg-background border rounded-b-md shadow-lg`}
127127
role='listbox'
128128
aria-label='Options'
129129
>
@@ -156,13 +156,13 @@ export function DropdownSelector<T>({
156156
role='option'
157157
aria-selected={i === selectedIndex}
158158
aria-disabled={disabled}
159-
className={`px-2 py-1.5 text-sm rounded-sm cursor-pointer ${
159+
className={`px-2 py-3 text-sm cursor-pointer ${
160160
disabled
161161
? 'opacity-50 cursor-not-allowed'
162162
: i === selectedIndex
163163
? 'bg-accent'
164164
: 'hover:bg-accent'
165-
}`}
165+
} ${i === loadedItems.length - 1 ? 'rounded-b-md' : ''}`}
166166
>
167167
{renderItem(item)}
168168
</div>

explorer/src/lib/parser.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export interface ParsedSpendBundle {
1616
coinSpends: ParsedCoinSpend[];
1717
aggregatedSignature: string;
1818
fee: string;
19+
totalCost: string;
20+
hash: string;
1921
}
2022

2123
export interface ParsedCoinSpend {
@@ -202,6 +204,10 @@ export function parseSpendBundle(
202204
),
203205
aggregatedSignature: `0x${toHex(spendBundle.aggregatedSignature.toBytes())}`,
204206
fee: '0',
207+
totalCost: deserializedCoinSpends
208+
.reduce((acc, coinSpend) => acc + coinSpend.cost, 0n)
209+
.toLocaleString(),
210+
hash: `0x${toHex(spendBundle.hash())}`,
205211
};
206212
}
207213

explorer/src/pages/Tools.tsx

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,24 @@ function BundleViewer({ bundle }: BundleViewerProps) {
8080
);
8181
const { tokens } = useDexie();
8282

83-
const totalCost = useMemo(() => {
84-
return bundle.coinSpends.reduce((acc, spend) => {
85-
const cost = typeof spend.cost === 'number' ? spend.cost : 0;
86-
return acc + cost;
87-
}, 0);
88-
}, [bundle.coinSpends]);
89-
9083
return (
9184
<div className='flex flex-col gap-4 mt-4'>
92-
<div className='p-4 rounded-md bg-card'>
93-
<div className='text-lg font-medium mb-2'>Bundle Information</div>
94-
<div className='grid grid-cols-2 gap-4 text-sm'>
95-
<div>
96-
<div className='text-muted-foreground'>Total Cost</div>
97-
<div>{totalCost}</div>
85+
<div className='p-4 rounded-md bg-card border border-input'>
86+
<div className='text-lg font-medium mb-2'>Spend Bundle</div>
87+
<div className='flex flex-col gap-1 text-sm'>
88+
<div className='flex flex-col'>
89+
<div className='text-muted-foreground'>Cost</div>
90+
<div>{bundle.totalCost}</div>
9891
</div>
99-
<div>
100-
<div className='text-muted-foreground'>Total Spends</div>
92+
93+
<div className='flex flex-col'>
94+
<div className='text-muted-foreground'>Spends</div>
10195
<div>{bundle.coinSpends.length}</div>
10296
</div>
103-
<div className='col-span-2'>
97+
98+
<div className='flex flex-col'>
10499
<div className='text-muted-foreground'>Bundle Hash</div>
105-
<div className='truncate'>0x1234567890abcdef</div>
100+
<Truncated value={bundle.hash} />
106101
</div>
107102
</div>
108103
</div>
@@ -192,7 +187,7 @@ function SpendViewer({ spend }: SpendViewerProps) {
192187
return (
193188
<div className='flex flex-col gap-3 p-3 rounded-t-none rounded-md bg-card border border-t-0 border-input'>
194189
<div className='grid grid-cols-1 md:grid-cols-2 gap-3'>
195-
<div className='flex flex-col gap-1 p-2 rounded-md bg-accent text-sm'>
190+
<div className='flex flex-col gap-1 p-2 rounded-md text-sm border border-input/30 bg-accent/40'>
196191
<div className='flex flex-col'>
197192
<div className='text-muted-foreground'>Coin ID</div>
198193
<Truncated
@@ -217,7 +212,7 @@ function SpendViewer({ spend }: SpendViewerProps) {
217212
</div>
218213
</div>
219214

220-
<div className='flex flex-col gap-1 p-2 rounded-md bg-accent text-sm'>
215+
<div className='flex flex-col gap-1 p-2 rounded-md text-sm border border-input/30 bg-accent/40'>
221216
<div className='flex flex-col'>
222217
<div className='text-muted-foreground'>Puzzle Reveal</div>
223218
<Truncated value={spend.puzzleReveal} />

0 commit comments

Comments
 (0)