Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

fix: update icons url #114

Merged
merged 1 commit into from
May 19, 2022
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
5 changes: 1 addition & 4 deletions client/src/components/CoinSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import { useState, useEffect } from "react";
import { FiChevronDown } from "react-icons/fi";
import CoinsMetadata from "src/lib/CoinsMetadata";
import { Coin } from "src/types";
import urlJoin from "url-join";

import { Button } from "./Button";
import { CoinsListDialog } from "./CoinsListDialog";
import { Dialog, useDialogProps } from "./Dialog";

const { PUBLIC_URL } = process.env;

const style = {
currencySelector: `flex1`,
};
Expand Down Expand Up @@ -49,7 +46,7 @@ export function CoinSelector({
{selected && selected.img && (
<img
className="rounded-full border-none ml-1"
src={`/${urlJoin(PUBLIC_URL, selected.img)}`}
src={selected.img}
alt={selected.name}
height={20}
width={20}
Expand Down
5 changes: 1 addition & 4 deletions client/src/components/CoinsListDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { useState } from "react";
import CoinsMetadata from "src/lib/CoinsMetadata";
import { Coin } from "src/types";
import urlJoin from "url-join";
import { Input } from "./Input";
import { Menu } from "./Menu";

const { PUBLIC_URL } = process.env;

const style = {
input: `appearance-none w-full rounded-md bg-gray-700 px-4 py-2 focus-ring text-gray-100`,
coinItem: `py-2 px-6 flex items-center gap-3 border-t border-gray-700
Expand Down Expand Up @@ -50,7 +47,7 @@ export function CoinsListDialog({ onSelect }: CoinListModalProps) {
<Menu.Item key={coin.assetId} className={style.coinItem}>
<img
className="rounded-full border-none ml-1"
src={`/${urlJoin(PUBLIC_URL, coin.img!)}`}
src={coin.img}
alt={coin.name}
height={30}
width={30}
Expand Down
5 changes: 4 additions & 1 deletion client/src/hooks/useAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { CoinQuantity, toBigInt } from 'fuels';
import { Coin } from 'src/types';
import CoinsMetadata from 'src/lib/CoinsMetadata';
import { useQuery } from 'react-query';
import urljoin from 'url-join';

const { PUBLIC_URL } = process.env;

type Asset = Coin & { amount: bigint };
const mergeCoinsWithMetadata = (coins: CoinQuantity[] = []): Array<Asset> => {
Expand All @@ -13,7 +16,7 @@ const mergeCoinsWithMetadata = (coins: CoinQuantity[] = []): Array<Asset> => {
// Another options could be querying from the contract
// https://github.com/FuelLabs/swayswap-demo/issues/33
name: coinMetadata?.name || '404',
img: coinMetadata?.img || '/icons/other.svg',
img: urljoin(PUBLIC_URL, coinMetadata?.img || '/icons/other.svg'),
assetId: coin.assetId,
amount: toBigInt(coin.amount || 0),
};
Expand Down