Skip to content

Commit

Permalink
add icon
Browse files Browse the repository at this point in the history
  • Loading branch information
zed-wong committed Dec 18, 2024
1 parent 5c7982c commit 51466f1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<script lang="ts">
import { _ } from "svelte-i18n";
import { qr } from '@svelte-put/qr/img';
import colors from "tailwindcss/colors";
import { onMount } from 'svelte';
import emptyToken from '$lib/images/empty-token.svg';
import { createQrSvgString } from "@svelte-put/qr";
import { copyToClipboard, findCoinIconBySymbol } from "$lib/helpers/helpers";

Check failure on line 5 in interface/src/lib/components/admin/rebalance/deposit/mixinDepositCard.svelte

View workflow job for this annotation

GitHub Actions / lint (18.x)

'findCoinIconBySymbol' is defined but never used
export let assetSymbol: string;
export let assetIcon: string;
export let chainSymbol: string;
export let chainIcon: string;
export let depositAddress: string;
export let depositMemo: string;
export let miniumDepositAmount: string;
Expand Down Expand Up @@ -43,7 +42,7 @@
<span class="text-base font-bold text-base-content">{assetSymbol}</span>
</div>

<img src={findCoinIconBySymbol(assetSymbol)} alt='' class="size-8" />
<img src={assetIcon} alt='' class="size-8" />
</div>

{#if chainSymbol != assetSymbol}
Expand All @@ -54,7 +53,7 @@
<span class="text-base font-bold text-base-content">{chainSymbol}</span>
</div>

<img src={findCoinIconBySymbol(chainSymbol)} alt='' class="size-8" />
<img src={chainIcon} alt='' class="size-8" />
</div>
{/if}

Expand Down Expand Up @@ -93,7 +92,7 @@
<div class="flex flex-row justify-center items-center w-full">
<div class="relative rounded-2xl border p-1">
<div class="absolute inset-0 flex items-center justify-center">
<img src={findCoinIconBySymbol(assetSymbol)} alt='' class="size-8" />
<img src={assetIcon} alt='' class="size-8" />
</div>
{@html memoQrSrc}

Check failure on line 97 in interface/src/lib/components/admin/rebalance/deposit/mixinDepositCard.svelte

View workflow job for this annotation

GitHub Actions / lint (18.x)

`{@html}` can lead to XSS attack
</div>
Expand Down Expand Up @@ -134,7 +133,7 @@
<div class="flex flex-row justify-center items-center w-full">
<div class="relative rounded-2xl border p-1">
<div class="absolute inset-0 flex items-center justify-center">
<img src={findCoinIconBySymbol(assetSymbol)} alt='' class="size-8" />
<img src={assetIcon} alt='' class="size-8" />
</div>
{@html addressQrSrc}

Check failure on line 138 in interface/src/lib/components/admin/rebalance/deposit/mixinDepositCard.svelte

View workflow job for this annotation

GitHub Actions / lint (18.x)

`{@html}` can lead to XSS attack
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</div>

<div class="mx-8 mb-4">
<input type="text" class="input input-bordered w-full" placeholder={$_("search")}
<input type="text" class="input input-bordered w-full focus:outline-none rounded-lg" placeholder={$_("search")}
bind:value={search} on:keyup={async () => {
if (filteredAssets.length === 0) {
searchingAsset = true;
Expand All @@ -58,15 +58,15 @@
</div>

{#if filteredAssets.length > 0}
<div class="flex flew-row flex-wrap gap-4 p-8 pt-2">
<div class="flex flew-row flex-wrap gap-5 p-8 pt-2">
{#each filteredAssets as asset}
<button class="flex flex-row items-center justify-center gap-4 p-4 bg-base-100 rounded-lg shadow-md"
<button class="flex flex-row items-center justify-center gap-2 px-4 py-2 bg-base-100 rounded-full shadow-md"
on:click={() => {
goto(`/manage/rebalance/deposit/mixin/${asset.asset_id}`);
}}>
<AssetIcon assetIcon={asset.icon_url} chainIcon={findChainIcon(asset.chain_id)} clazz="size-8" />
<div class="flex flex-col items-start justify-center">
<span class="text-lg font-bold text-center">{asset.symbol}</span>
<span class="text-base font-bold text-center">{asset.symbol}</span>
<span class="text-xs text-center opacity-60">{asset.name}</span>
</div>
</button>
Expand All @@ -78,15 +78,15 @@
<Loading />
</div>
{:else if searchAssets.length > 0}
<div class="flex flex-wrap gap-4 p-8 pt-2">
<div class="flex flew-row flex-wrap gap-5 p-8 pt-2">
{#each searchAssets as asset}
<button class="flex flex-row items-center justify-center gap-4 p-4 bg-base-100 rounded-lg shadow-md"
<button class="flex flex-row items-center justify-center gap-2 px-4 py-2 bg-base-100 rounded-full shadow-md"
on:click={() => {
goto(`/manage/rebalance/deposit/${asset.asset_id}`);
goto(`/manage/rebalance/deposit/mixin/${asset.asset_id}`);
}}>
<AssetIcon assetIcon={asset.icon_url} chainIcon={findChainIcon(asset.chain_id)} clazz="size-8" />
<div class="flex flex-col items-start justify-center">
<span class="text-lg font-bold text-center">{asset.symbol}</span>
<span class="text-base font-bold text-center">{asset.symbol}</span>
<span class="text-xs text-center opacity-60">{asset.name}</span>
</div>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import { _ } from "svelte-i18n";
import { onMount } from "svelte";
import { page } from "$app/stores";
import { goto } from "$app/navigation";
import { getMixinDepositAddress } from "$lib/helpers/hufi/admin/rebalance";
import MixinDepositCard from "$lib/components/admin/rebalance/deposit/mixinDepositCard.svelte";
import { goto } from "$app/navigation";
let asset;
let chain;
Expand All @@ -17,20 +17,19 @@
let failure = false;
asset = $page.data.asset;
chain = $page.data.chain;
console.log(asset);
console.log(chain);
onMount(async () => {
console.log(asset);
console.log(chain);
const token = localStorage.getItem('admin-access-token');
if (!token) {
return;
}
loading = true;
try {
const result = await getMixinDepositAddress(asset.asset_id, token);
console.log('getMixinDepositAddress', result.data);
if (result.code === 500) {
failure = true;
console.error(result.message);
}
const data = result.data;
if (data) {
depositAddress = data.address;
Expand Down Expand Up @@ -75,7 +74,9 @@
{:else if loaded}
<MixinDepositCard
assetSymbol={asset.symbol}
assetIcon={asset.icon_url}
chainSymbol={chain.symbol}
chainIcon={chain.icon_url}
depositAddress={depositAddress}
depositMemo={depositMemo}
miniumDepositAmount={minDepositAmount}
Expand Down

0 comments on commit 51466f1

Please sign in to comment.