Skip to content

Commit

Permalink
chore: enhance the transaction visual UI (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickDinh authored Jun 18, 2024
1 parent 5872cc9 commit 9ded4ef
Show file tree
Hide file tree
Showing 23 changed files with 3,548 additions and 3,054 deletions.
6 changes: 0 additions & 6 deletions src/assets/svg/circle.svg

This file was deleted.

4 changes: 2 additions & 2 deletions src/assets/svg/pointer-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/assets/svg/pointer-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/features/common/components/display-algo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type Props = {

export function DisplayAlgo({ className, amount }: Props) {
return (
<div className={cn(className, 'inline-flex gap-0.5')}>
<div className={cn('inline-flex gap-0.5', className)}>
{amount.algos}
<SvgAlgorand className="h-auto w-2.5" />
</div>
Expand Down
17 changes: 12 additions & 5 deletions src/features/common/components/display-asset-amount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ type Props = {
asset: AssetSummary | AsyncMaybeAtom<AssetSummary>
isFrozen?: boolean
className?: string
linkClassName?: string
}

const Amount = ({ asset, amount, isFrozen }: { asset: AssetSummary; amount: number | bigint; isFrozen?: boolean }) => {
type AmountProps = {
asset: AssetSummary
amount: number | bigint
isFrozen?: boolean
linkClassName?: string
}
const Amount = ({ asset, amount, isFrozen, linkClassName }: AmountProps) => {
// asset decimals value must be from 0 to 19 so it is safe to use .toString() here
// the amount is uint64, should be safe to be .toString()
const amountToDisplay = new Decimal(amount.toString()).div(new Decimal(10).pow(asset.decimals)).toString()
Expand All @@ -22,7 +29,7 @@ const Amount = ({ asset, amount, isFrozen }: { asset: AssetSummary; amount: numb
<div className="flex items-center gap-1">
<span>{amountToDisplay}</span>
{asset.unitName ? (
<AssetIdLink assetId={asset.id} className={cn('text-primary underline')}>
<AssetIdLink assetId={asset.id} className={cn('underline', linkClassName ?? 'text-primary')}>
{asset.unitName}
</AssetIdLink>
) : undefined}
Expand All @@ -31,15 +38,15 @@ const Amount = ({ asset, amount, isFrozen }: { asset: AssetSummary; amount: numb
)
}

export const DisplayAssetAmount = ({ amount, asset, isFrozen, className }: Props) => {
export const DisplayAssetAmount = ({ amount, asset, isFrozen, className, linkClassName }: Props) => {
return (
<div className={cn(className)}>
{'read' in asset ? (
<RenderInlineAsyncAtom atom={asset}>
{(asset) => <Amount asset={asset} amount={amount} isFrozen={isFrozen} />}
{(asset) => <Amount asset={asset} amount={amount} isFrozen={isFrozen} linkClassName={linkClassName} />}
</RenderInlineAsyncAtom>
) : (
<Amount asset={asset} amount={amount} isFrozen={isFrozen} />
<Amount asset={asset} amount={amount} isFrozen={isFrozen} linkClassName={linkClassName} />
)}
</div>
)
Expand Down
21 changes: 0 additions & 21 deletions src/features/common/components/svg/circle.tsx

This file was deleted.

9 changes: 5 additions & 4 deletions src/features/common/components/svg/pointer-left.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ import type { SVGProps } from 'react'
const SvgPointerLeft = (props: SVGProps<SVGSVGElement>) => (
<svg
xmlnsXlink="http://www.w3.org/1999/xlink"
width="11px"
height="19px"
width="20px"
height="20px"
preserveAspectRatio="xMinYMid meet"
viewBox="159 229 7 10"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
d="M 165.8 228.1 L 159.1 234.1 L 165.8 240.1 L 163.5 234.1 L 165.8 228.1 Z"
d="M 14 15 L 20 10 L 14 5 L 14 10 L 14 16 Z"
fillRule="nonzero"
fill="currentColor"
stroke="none"
transform="scale(-1, 1) translate(-20, 0)"
/>
</svg>
)
Expand Down
8 changes: 4 additions & 4 deletions src/features/common/components/svg/pointer-right.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import type { SVGProps } from 'react'
const SvgPointerRight = (props: SVGProps<SVGSVGElement>) => (
<svg
xmlnsXlink="http://www.w3.org/1999/xlink"
width="11px"
height="19px"
width="20px"
height="20px"
preserveAspectRatio="xMinYMid meet"
viewBox="340 139 1 13"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path d="M 340.3 151.3 L 347 145.3 L 340.3 139.3 L 342.6 145.3 L 340.3 151.3 Z" fillRule="nonzero" fill="currentColor" stroke="none" />
<path d="M 14 15 L 20 10 L 14 5 L 14 10 L 14 16 Z" fillRule="nonzero" fill="currentColor" stroke="none" />
</svg>
)
export default SvgPointerRight
Loading

0 comments on commit 9ded4ef

Please sign in to comment.