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

fix(tangle-dapp): Bridge UI fixes #2813

Merged
merged 5 commits into from
Feb 10, 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 apps/tangle-dapp/src/components/ErrorMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function ErrorMessage({
<p
{...props}
className={twMerge(
'flex items-center justify-center gap-0.5 text-red-70 dark:text-red-50 mt-2 ml-2',
'flex items-center justify-start gap-0.5 text-red-70 dark:text-red-50 mt-2',
className,
)}
>
Expand Down
2 changes: 1 addition & 1 deletion apps/tangle-dapp/src/components/Sidebar/sidebarProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const SIDEBAR_STATIC_ITEMS: SideBarItemProps[] = [
subItems: [],
},
{
name: 'Nominate',
name: 'Nomination',
href: PagePath.NOMINATION,
isInternal: true,
isNext: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,11 @@ const ConfirmationItem: FC<{
className={cx(`shrink-0 grow-0 ${getFlexBasic('lg')}`)}
/>

<Typography variant="h5" fw="bold" className="text-nowrap">
<Typography
variant="body1"
fw="normal"
className="text-nowrap text-mono-200 dark:text-mono-0"
>
{chain.displayName ?? chain.name}
</Typography>
</div>
Expand All @@ -825,7 +829,11 @@ const ConfirmationItem: FC<{
rel="noreferrer"
className="flex items-center gap-1"
>
<Typography variant="h5" fw="bold" className="whitespace-nowrap">
<Typography
variant="body1"
fw="normal"
className="whitespace-nowrap text-mono-200 dark:text-mono-0"
>
{isSolanaAddress(accAddress)
? shortenString(accAddress, 10)
: shortenHex(accAddress, 10)}
Expand All @@ -840,16 +848,20 @@ const ConfirmationItem: FC<{
<Typography variant="body1">Amount</Typography>

<div className="flex items-center gap-2">
<Typography variant="h5" fw="bold" className="text-nowrap">
{amount ?? EMPTY_VALUE_PLACEHOLDER}
</Typography>

<TokenIcon
name={tokenName}
size="lg"
spinnerSize="lg"
className={cx(`shrink-0 grow-0 ${getFlexBasic('lg')}`)}
/>

<Typography
variant="body1"
fw="normal"
className="text-nowrap text-mono-200 dark:text-mono-0"
>
{amount ?? EMPTY_VALUE_PLACEHOLDER}
</Typography>
</div>
</div>
</div>
Expand Down
52 changes: 30 additions & 22 deletions apps/tangle-dapp/src/components/bridge/FeeDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,29 @@ export const FeeDetail = ({
'group flex items-center justify-between w-full px-4 pt-3 pb-2',
)}
>
<Typography variant="body1" fw="bold">
<Typography variant="body1" fw="normal">
Total Receiving
</Typography>

<div className="flex items-center gap-2">
<div className="flex items-center gap-1">
<Typography variant="h4" fw="bold" className="whitespace-nowrap">
<TokenIcon
size="lg"
name={token.tokenType.toLowerCase()}
className={cx(`shrink-0 ${getFlexBasic('lg')}`)}
/>

<Typography
variant="h5"
fw="normal"
className="whitespace-nowrap"
>
{amounts.receiving.split(' ')[0].split('.')[0]}
{amounts.receiving.split(' ')[0].split('.')[1]
? `.${amounts.receiving.split(' ')[0].split('.')[1].slice(0, 4)}`
: ''}{' '}
{amounts.receiving.split(' ')[1]}
</Typography>

<TokenIcon
size="lg"
name={token.tokenType.toLowerCase()}
className={cx(`shrink-0 ${getFlexBasic('lg')}`)}
/>
</div>

{isCollapsible && (
Expand All @@ -101,28 +105,28 @@ export const FeeDetail = ({
<div className="h-[2px] bg-mono-40 dark:bg-mono-160" />

<div className="flex items-center justify-between">
<Typography variant="body1" fw="bold">
<Typography variant="body1" fw="normal">
Sending
</Typography>

<Typography
variant="body1"
fw="bold"
className="whitespace-nowrap"
fw="normal"
className="whitespace-nowrap text-mono-200 dark:text-mono-0"
>
{amounts.sending}
</Typography>
</div>

<div className="flex items-center justify-between">
<Typography variant="body1" fw="bold">
<Typography variant="body1" fw="normal">
Bridge Fee
</Typography>

<Typography
variant="body1"
fw="bold"
className="whitespace-nowrap"
fw="normal"
className="whitespace-nowrap text-mono-200 dark:text-mono-0"
>
{amounts.bridgeFee.split('.')[0]}
{amounts.bridgeFee.split('.')[1]
Expand All @@ -132,7 +136,7 @@ export const FeeDetail = ({
</div>

<div className="flex items-center justify-between">
<Typography variant="body1" fw="bold">
<Typography variant="body1" fw="normal">
Bridge Route
</Typography>

Expand All @@ -143,7 +147,11 @@ export const FeeDetail = ({
<TokenIcon name="hyperlane" size="lg" />
)}

<Typography variant="body1" fw="bold">
<Typography
variant="body1"
fw="normal"
className="whitespace-nowrap text-mono-200 dark:text-mono-0"
>
{token.bridgeType.charAt(0).toUpperCase() +
token.bridgeType.slice(1)}
</Typography>
Expand All @@ -152,14 +160,14 @@ export const FeeDetail = ({

{amounts.gasFee && (
<div className="flex items-center justify-between">
<Typography variant="body1" fw="bold">
<Typography variant="body1" fw="normal">
Gas Fee
</Typography>

<Typography
variant="body1"
fw="bold"
className="whitespace-nowrap"
fw="normal"
className="whitespace-nowrap text-mono-200 dark:text-mono-0"
>
{amounts.gasFee}
</Typography>
Expand All @@ -168,7 +176,7 @@ export const FeeDetail = ({

{recipientExplorerUrl && (
<div className="flex items-center justify-between">
<Typography variant="body1" fw="bold">
<Typography variant="body1" fw="normal">
Recipient
</Typography>

Expand All @@ -180,8 +188,8 @@ export const FeeDetail = ({
>
<Typography
variant="body1"
fw="bold"
className="whitespace-nowrap"
fw="normal"
className="whitespace-nowrap text-mono-200 dark:text-mono-0"
>
{shortenHex(recipientExplorerUrl)}
</Typography>
Expand Down
20 changes: 12 additions & 8 deletions apps/tangle-dapp/src/containers/bridge/BridgeContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,14 @@ export default function BridgeContainer({ className }: BridgeContainerProps) {

return (
<>
<Typography
variant="h4"
fw="bold"
className="text-mono-200 dark:text-mono-0 max-w-[550px] mx-auto w-full text-left"
>
Bridge
</Typography>

<Card
withShadow
className={twMerge(
Expand All @@ -709,6 +717,7 @@ export default function BridgeContainer({ className }: BridgeContainerProps) {
)}
>
<div className="flex flex-col gap-7">
{' '}
{/* Source and Destination Chain Selector */}
<div className="flex flex-col items-center justify-center md:flex-row md:justify-between md:items-end md:gap-2">
{/** Source chain */}
Expand Down Expand Up @@ -756,7 +765,6 @@ export default function BridgeContainer({ className }: BridgeContainerProps) {
/>
</div>
</div>

<div className="flex flex-col gap-4">
{/* Sending Amount and Token Selector */}
<div className="flex flex-col gap-2">
Expand Down Expand Up @@ -809,7 +817,7 @@ export default function BridgeContainer({ className }: BridgeContainerProps) {
<div className="flex flex-col gap-1 duration-300 ease-out animate-in fade-in">
<ErrorMessage
className="mt-0"
typographyProps={{ variant: 'body1' }}
typographyProps={{ variant: 'body2', fw: 'normal' }}
>
{amountInputErrorMessage}
</ErrorMessage>
Expand Down Expand Up @@ -868,14 +876,13 @@ export default function BridgeContainer({ className }: BridgeContainerProps) {
{addressInputErrorMessage !== null && (
<ErrorMessage
className="mt-0"
typographyProps={{ variant: 'body1' }}
typographyProps={{ variant: 'body2', fw: 'normal' }}
>
{addressInputErrorMessage}
</ErrorMessage>
)}
</div>
</div>

{routerQuote && !isRouterQuoteLoading && routerFeeDetails && (
<FeeDetail
token={routerFeeDetails.token}
Expand All @@ -887,7 +894,6 @@ export default function BridgeContainer({ className }: BridgeContainerProps) {
recipientExplorerUrl={recipientExplorerUrl}
/>
)}

{hyperlaneQuote &&
!isHyperlaneQuoteLoading &&
hyperlaneFeeDetails && (
Expand All @@ -902,16 +908,14 @@ export default function BridgeContainer({ className }: BridgeContainerProps) {
recipientExplorerUrl={recipientExplorerUrl}
/>
)}

{routerQuoteError?.error !== undefined && (
<ErrorMessage
className="mt-0 duration-300 ease-out animate-in fade-in"
typographyProps={{ variant: 'body1' }}
typographyProps={{ variant: 'body2', fw: 'normal' }}
>
{routerQuoteError.error}
</ErrorMessage>
)}

{/* Action button */}
<Button
variant="primary"
Expand Down
8 changes: 8 additions & 0 deletions apps/tangle-dapp/src/pages/liquid-staking/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ const LiquidStakingPage: FC = () => {

return (
<div>
<Typography
variant="h4"
fw="bold"
className="text-mono-200 dark:text-mono-0 max-w-[532px] mx-auto w-full text-left mb-5"
>
Liquid Stake
</Typography>

<LsCreatePoolModal
isOpen={isCreatePoolModalOpen}
setIsOpen={setIsCreatePoolModalOpen}
Expand Down
2 changes: 1 addition & 1 deletion apps/tangle-dapp/src/pages/nomination/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function NominationPage() {
<div className="space-y-6 md:space-y-9 lg:space-y-12">
<div className="flex items-center justify-between">
<Typography variant="h4" fw="bold">
Overview
Nomination
</Typography>

<NominationHeaderChips />
Expand Down
Loading