Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit 462174c

Browse files
authored
Support ahUSDT on mainnet and PINK (#18)
* Support ahUSDT on mainnet and PINK * Add dev deploy * Update website metadata * Improve no-data style * Add gap between chain options * Fix fee asset id
1 parent e7838a5 commit 462174c

28 files changed

+366
-85
lines changed

.github/workflows/deploy-dev.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deploy development
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
deploy-package:
9+
name: Deploy package
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- uses: actions/checkout@v2
15+
with:
16+
repository: darwinia-network/devops
17+
path: .github
18+
19+
- uses: ./.github/actions/smart-vercel
20+
name: Deploy app
21+
with:
22+
vercel_token: ${{ secrets.VERCEL_TOKEN }}
23+
vercel_group: itering
24+
preview_output: true
25+
alias_domain: "crosschain-dev"
26+
project_name: "crosschain-ui"
27+
script_run: false
28+
dist_path: .
29+
enable_notify_slack: true
30+
slack_channel: darwinia-apps
31+
slack_webhook: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }}

public/images/asset/pink.jpg

23.1 KB
Loading

public/images/network/darwinia.png

1.07 KB
Loading

public/images/warning.svg

Lines changed: 7 additions & 0 deletions
Loading

src/app/globals.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ body {
2828

2929
@layer components {
3030
.border-radius {
31-
@apply rounded-lg;
31+
@apply rounded-2xl;
3232
}
3333

3434
.app-header {

src/app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import TransferProvider from "@/providers/transfer-provider";
1010
const inter = Inter({ subsets: ["latin"] });
1111

1212
export const metadata: Metadata = {
13-
title: "Darwinia Cross-Chain",
14-
description: "Darwinia USDT Cross-Chain",
13+
title: "Asset Hub Bridge - Darwinia",
14+
description: "Assets cross-chain between Darwinia and Asset Hub.",
1515
};
1616

1717
export default function RootLayout({ children }: { children: React.ReactNode }) {

src/components/address-input.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default function AddressInput({
7171
clickable={!!options?.length || !canInput}
7272
canInput={canInput}
7373
innerSuffix={<ConnectWallet who={who} height="full" />}
74-
wrapClassName={`h-10 bg-transparent flex items-center justify-between p-1 border border-radius transition-colors duration-200 ${
74+
wrapClassName={`h-12 bg-transparent flex items-center justify-between p-1 border border-radius transition-colors duration-200 ${
7575
value?.valid === false ? "border-alert" : "border-transparent"
7676
}`}
7777
inputClassName="w-full border-radius h-full bg-transparent px-1"
@@ -100,8 +100,8 @@ export default function AddressInput({
100100
</button>
101101
))
102102
) : (
103-
<div className="px-middle py-small">
104-
<span className="text-sm font-medium">No data</span>
103+
<div className="inline-flex justify-center px-middle py-small">
104+
<span className="text-sm font-medium text-slate-400">No data</span>
105105
</div>
106106
)}
107107
</InputSelect>

src/components/asset-select.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,31 @@ export default function AssetSelect({ value, options, disabled, onChange = () =>
1414
return (
1515
<Select
1616
label={
17-
<div className="flex items-center gap-small truncate">
18-
<Image width={16} height={16} alt="Asset icon" src={getAssetIconSrc(value.icon)} />
17+
<div className="flex items-center gap-small truncate px-1">
18+
<Image width={22} height={22} alt="Asset icon" src={getAssetIconSrc(value.icon)} className="rounded-full" />
1919
<span>{value.symbol}</span>
2020
</div>
2121
}
2222
disabled={disabled}
2323
sameWidth
24-
labelClassName="flex items-center gap-middle shrink-0 w-28 justify-between bg-component h-full border-radius px-1 hover:opacity-80 transition-[transform,color] active:translate-y-1 disabled:translate-y-0 disabled:opacity-100 disabled:cursor-not-allowed"
25-
childClassName="flex flex-col py-small bg-component border-primary border border-radius"
24+
labelClassName="flex items-center gap-middle shrink-0 w-28 justify-between bg-component h-full border-radius px-1 hover:opacity-80 transition-[transform,color] disabled:translate-y-0 disabled:opacity-100 disabled:cursor-not-allowed"
25+
childClassName="flex flex-col py-small bg-component border-primary border border-radius gap-[1px]"
2626
>
2727
{options?.length ? (
2828
options.map((asset) => (
2929
<button
3030
key={asset.symbol}
31+
disabled={asset.id === value.id}
3132
onClick={() => onChange(asset)}
32-
className="flex items-center gap-small px-middle py-2 transition-colors hover:bg-white/10"
33+
className="flex items-center gap-small px-middle py-2 transition-colors hover:bg-white/10 disabled:bg-white/10"
3334
>
34-
<Image width={16} height={16} alt="Asset icon" src={getAssetIconSrc(asset.icon)} />
35+
<Image width={20} height={20} alt="Asset icon" src={getAssetIconSrc(asset.icon)} className="rounded-full" />
3536
<span className="text-sm font-medium">{asset.symbol}</span>
3637
</button>
3738
))
3839
) : (
39-
<div className="px-middle py-2">
40-
<span className="text-sm font-medium">No data</span>
40+
<div className="inline-flex justify-center px-middle py-2">
41+
<span className="text-sm font-medium text-slate-400">No data</span>
4142
</div>
4243
)}
4344
</Select>

src/components/balance-input.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Asset } from "@/types";
1+
import { Asset, Cross } from "@/types";
22
import Input from "@/ui/input";
33
import { BN, BN_ZERO, bnToBn } from "@polkadot/util";
44
import AssetSelect from "./asset-select";
@@ -18,7 +18,7 @@ interface Props {
1818
disabled?: boolean;
1919
placeholder?: string;
2020
balance?: BN;
21-
min?: BN;
21+
cross?: Cross;
2222
asset?: Asset;
2323
assetSupply?: BN;
2424
assetLimit?: BN;
@@ -32,7 +32,7 @@ export default function BalanceInput({
3232
disabled,
3333
placeholder,
3434
balance,
35-
min,
35+
cross,
3636
asset,
3737
assetSupply,
3838
assetLimit,
@@ -52,6 +52,13 @@ export default function BalanceInput({
5252
return placeholder ?? "Enter an amount";
5353
}, [balance, asset, placeholder]);
5454

55+
const min = useMemo(() => {
56+
if (cross && cross.fee.asset.native) {
57+
return cross.fee.amount;
58+
}
59+
return undefined;
60+
}, [cross]);
61+
5562
const handleInputChange = useCallback<ChangeEventHandler<HTMLInputElement>>(
5663
(e) => {
5764
if (e.target.value) {
@@ -77,9 +84,7 @@ export default function BalanceInput({
7784
const inputWidth = inputRef.current?.clientWidth || 1;
7885
const spanWidth = spanRef.current?.clientWidth || 0;
7986
const percent = (spanWidth / inputWidth) * 100;
80-
if (percent < 10) {
81-
setDynamicStyle("text-[3rem] font-extralight");
82-
} else if (percent < 20) {
87+
if (percent < 20) {
8388
setDynamicStyle("text-[2.25rem] font-light");
8489
} else if (percent < 30) {
8590
setDynamicStyle("text-[1.875rem] font-light");

src/components/chain-select.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,31 @@ export default function ChainSelect({ value, options, disabled, onChange = () =>
1515
<Select
1616
label={
1717
<div className="flex max-w-[140px] items-center gap-small">
18-
<Image width={18} height={18} alt="Chain logo" src={getChainLogoSrc(value.logo)} />
18+
<Image width={20} height={20} alt="Chain logo" src={getChainLogoSrc(value.logo)} />
1919
<span className="truncate text-white/50">{value.name}</span>
2020
</div>
2121
}
2222
disabled={disabled}
2323
sameWidth
2424
labelClassName="flex items-center gap-middle py-[4px] px-[6px] bg-transparent hover:bg-white/10 border-radius"
25-
childClassName="flex flex-col py-small bg-component border-primary border border-radius"
25+
childClassName="flex flex-col py-small bg-component border-primary border border-radius gap-[1px]"
2626
arrowClassName="opacity-50"
2727
>
2828
{options?.length ? (
2929
options.map((chain) => (
3030
<button
3131
key={chain.network}
32+
disabled={chain.network === value.network}
3233
onClick={() => onChange(chain)}
33-
className="flex items-center gap-small px-middle py-2 transition-colors hover:bg-white/10"
34+
className="flex items-center gap-small px-middle py-2 transition-colors hover:bg-white/10 disabled:bg-white/10"
3435
>
35-
<Image width={16} height={16} alt="Chain logo" src={getChainLogoSrc(chain.logo)} />
36+
<Image width={18} height={18} alt="Chain logo" src={getChainLogoSrc(chain.logo)} />
3637
<span className="truncate text-sm font-medium">{chain.name}</span>
3738
</button>
3839
))
3940
) : (
40-
<div className="px-middle py-2">
41-
<span className="text-sm font-medium">No data</span>
41+
<div className="inline-flex justify-center px-middle py-2">
42+
<span className="text-sm font-medium text-slate-400">No data</span>
4243
</div>
4344
)}
4445
</Select>

0 commit comments

Comments
 (0)