Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address breaking changes in UI library #6054

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"@leather.io/query": "2.26.16",
"@leather.io/stacks": "1.4.0",
"@leather.io/tokens": "0.12.1",
"@leather.io/ui": "1.44.4",
"@leather.io/ui": "1.48.2",
"@leather.io/utils": "0.25.0",
"@ledgerhq/hw-transport-webusb": "6.27.19",
"@noble/hashes": "1.5.0",
Expand Down
640 changes: 286 additions & 354 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/app/components/fees/fee-item-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import type { FeeType } from '@app/common/fees/use-fees';
import { IconWrapper } from '../icon-wrapper';

const feeTypeToIconMap: Record<FeeType, ReactNode> = {
slow: <AnimalSnailIcon variant="small" />,
standard: <AnimalRabbitIcon variant="small" />,
fast: <AnimalEagleIcon variant="small" />,
custom: <AnimalChameleonIcon variant="small" />,
slow: <AnimalSnailIcon />,
standard: <AnimalRabbitIcon />,
fast: <AnimalEagleIcon />,
custom: <AnimalChameleonIcon />,
};

export function FeeItemIcon({ feeType }: { feeType: FeeType }) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createMoney, formatMoney, truncateMiddle } from '@leather.io/utils';

import { PsbtInput } from '@app/features/psbt-signer/hooks/use-parsed-inputs';
import { TagWithTooltip } from '@app/ui/components/tag/tag-with-tooltip';
import { BadgeWithTooltip } from '@app/ui/components/badge/badge-with-tooltip';

import { PsbtInputOutputItemLayout } from '../../psbt-input-output-item.layout';

Expand All @@ -15,7 +15,7 @@ export function PsbtInputItem({ utxo }: { utxo: PsbtInput }) {
amount={formatMoney(createMoney(utxo.value, 'BTC'))}
label={
utxo.toSign ? (
<TagWithTooltip hoverLabel={hoverLabel} label="Approve" transparent />
<BadgeWithTooltip hoverLabel={hoverLabel} label="Approve" outlined />
) : undefined
}
txId={truncateMiddle(utxo.txid)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createMoney, formatMoney, truncateMiddle } from '@leather.io/utils';

import { PsbtOutput } from '@app/features/psbt-signer/hooks/use-parsed-outputs';
import { TagWithTooltip } from '@app/ui/components/tag/tag-with-tooltip';
import { BadgeWithTooltip } from '@app/ui/components/badge/badge-with-tooltip';

import { PsbtInputOutputItemLayout } from '../../psbt-input-output-item.layout';

Expand All @@ -19,7 +19,7 @@ export function PsbtOutputItem({ output }: { output: PsbtOutput }) {
amount={formatMoney(createMoney(Number(output.value), 'BTC'))}
label={
output.toSign ? (
<TagWithTooltip transparent hoverLabel={hoverLabel} label="You" />
<BadgeWithTooltip outlined hoverLabel={hoverLabel} label="You" />
) : undefined
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HStack, styled } from 'leather-styles/jsx';
import { LockIcon, UnlockIcon } from '@leather.io/ui';

import { usePsbtSignerContext } from '@app/features/psbt-signer/psbt-signer.context';
import { TagWithTooltip } from '@app/ui/components/tag/tag-with-tooltip';
import { BadgeWithTooltip } from '@app/ui/components/badge/badge-with-tooltip';

const immutableLabel =
'Any modification to the transaction, including the fee amount or other inputs/outputs, will invalidate the signature.';
Expand All @@ -16,12 +16,12 @@ export function PsbtRequestDetailsHeader() {
return (
<HStack alignItems="center" gap="space.02">
<styled.h2 textStyle="heading.05">Transaction</styled.h2>
<TagWithTooltip
<BadgeWithTooltip
hoverLabel={isPsbtMutable ? uncertainLabel : immutableLabel}
icon={isPsbtMutable ? <UnlockIcon variant="small" /> : <LockIcon variant="small" />}
label={isPsbtMutable ? 'Uncertain' : 'Certain'}
transparent
variant={isPsbtMutable ? 'warning' : 'default'}
outlined
/>
</HStack>
);
Expand Down
6 changes: 3 additions & 3 deletions src/app/pages/fund/components/fiat-provider-item.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FundPageSelectors } from '@tests/selectors/fund.selectors';

import { StarIcon, Tag, ZapIcon } from '@leather.io/ui';
import { Badge, StarIcon, ZapIcon } from '@leather.io/ui';

import { AvailableRegions } from '@app/query/common/remote-config/remote-config.query';

Expand Down Expand Up @@ -38,10 +38,10 @@ export function FiatProviderItem(props: FiatProviderProps) {
const Attributes = (
<>
{hasFastCheckoutProcess && (
<Tag icon={<ZapIcon variant="small" />} label="Fast checkout" variant="success" />
<Badge icon={<ZapIcon variant="small" />} label="Fast checkout" variant="success" />
)}
{!hasTradingFees && (
<Tag icon={<StarIcon variant="small" />} label="0 % Fees" variant="warning" />
<Badge icon={<StarIcon variant="small" />} label="0 % Fees" variant="warning" />
)}
</>
);
Expand Down
17 changes: 17 additions & 0 deletions src/app/ui/components/badge/badge-with-tooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Badge, type BadgeProps } from '@leather.io/ui';

import { BasicTooltip } from '../tooltip/basic-tooltip';

type TooltipSideType = 'bottom' | 'left' | 'right' | 'top';

interface BadgeWithTooltipProps extends BadgeProps {
hoverLabel: string;
side?: TooltipSideType;
}
export function BadgeWithTooltip({ hoverLabel, side = 'bottom', ...props }: BadgeWithTooltipProps) {
return (
<BasicTooltip label={hoverLabel} side={side}>
<Badge {...props} />
</BasicTooltip>
);
}
21 changes: 0 additions & 21 deletions src/app/ui/components/tag/tag-with-tooltip.tsx

This file was deleted.

Loading