-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
94 additions
and
11 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/app/components/crypto-assets/bitcoin/runes-asset-list/runes-asset-item.layout.tsx
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,39 @@ | ||
import { styled } from 'leather-styles/jsx'; | ||
|
||
import { createMoney } from '@shared/models/money.model'; | ||
|
||
import { formatBalance } from '@app/common/format-balance'; | ||
import type { RuneBalance } from '@app/query/bitcoin/bitcoin-client'; | ||
import { OrdinalAvatarIcon } from '@app/ui/components/avatar/ordinal-avatar-icon'; | ||
import { ItemLayout } from '@app/ui/components/item-layout/item-layout'; | ||
import { BasicTooltip } from '@app/ui/components/tooltip/basic-tooltip'; | ||
import { Pressable } from '@app/ui/pressable/pressable'; | ||
|
||
interface RunesAssetItemLayoutProps { | ||
rune: RuneBalance; | ||
} | ||
export function RunesAssetItemLayout({ rune }: RunesAssetItemLayoutProps) { | ||
const balance = createMoney(Number(rune.total_balance), rune.rune_name, 0).amount.toString(); | ||
const formattedBalance = formatBalance(balance); | ||
|
||
return ( | ||
<Pressable my="space.02"> | ||
<ItemLayout | ||
flagImg={<OrdinalAvatarIcon />} | ||
titleLeft={rune.rune_name.toUpperCase()} | ||
captionLeft="RUNE" | ||
titleRight={ | ||
<BasicTooltip | ||
asChild | ||
label={formattedBalance.isAbbreviated ? balance : undefined} | ||
side="left" | ||
> | ||
<styled.span data-testid={rune.rune_name} fontWeight={500} textStyle="label.02"> | ||
{formattedBalance.value} | ||
</styled.span> | ||
</BasicTooltip> | ||
} | ||
/> | ||
</Pressable> | ||
); | ||
} |
10 changes: 10 additions & 0 deletions
10
src/app/components/crypto-assets/bitcoin/runes-asset-list/runes-asset-list.tsx
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,10 @@ | ||
import type { RuneBalance } from '@app/query/bitcoin/bitcoin-client'; | ||
|
||
import { RunesAssetItemLayout } from './runes-asset-item.layout'; | ||
|
||
interface RunesAssetListProps { | ||
runes: RuneBalance[]; | ||
} | ||
export function RunesAssetList({ runes }: RunesAssetListProps) { | ||
return runes.map(rune => <RunesAssetItemLayout key={rune.rune_id} rune={rune} />); | ||
} |
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
File renamed without changes.
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,14 @@ | ||
import type { RuneBalance } from '@app/query/bitcoin/bitcoin-client'; | ||
import { useGetRunesWalletBalancesQuery } from '@app/query/bitcoin/runes/runes-wallet-balances.query'; | ||
|
||
interface RunesLoaderProps { | ||
address: string; | ||
children(runes: RuneBalance[]): React.ReactNode; | ||
} | ||
export function RunesLoader({ address, children }: RunesLoaderProps) { | ||
// TODO: Remove, only here for testing runes | ||
address = 'tb1pd368q84tuark4naym2u5382p59jkd27nw5vu5s44uz8dwdlrcwhqzdl2l2'; | ||
|
||
const { data: runes = [] } = useGetRunesWalletBalancesQuery(address); | ||
return children(runes); | ||
} |
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