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

fix: add public_url on img src #27

Merged
merged 1 commit into from
Mar 9, 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
2 changes: 2 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"react-router-dom": "6",
"react-scripts": "5.0.0",
"typescript": "^4.5.5",
"url-join": "^4.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down Expand Up @@ -51,6 +52,7 @@
]
},
"devDependencies": {
"@types/url-join": "^4.0.1",
"autoprefixer": "^10.4.2",
"eslint": "^8.4.1",
"postcss": "^8.4.7",
Expand Down
5 changes: 4 additions & 1 deletion client/src/components/Assets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { Coin, CoinStatus } from "fuels";
import coinList from "../lib/assets.json";
import { BigNumber } from "ethers";
import { formatUnits } from "ethers/lib/utils";
import urlJoin from "url-join";

const { PUBLIC_URL } = process.env;

const style = {
wrapper: `w-screen flex flex-1 items-center justify-center mb-14`,
Expand Down Expand Up @@ -81,7 +84,7 @@ export const Assets = () => {
<div className={style.currencySelectorContent}>
<div className={style.currencySelectorIcon}>
<img
src={coinData.img}
src={urlJoin(PUBLIC_URL, coinData.img)}
alt={coinData.name}
height={20}
width={20}
Expand Down
5 changes: 4 additions & 1 deletion client/src/components/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { Fragment, useState } from "react";
import { RiSettings3Fill } from "react-icons/ri";
import { Menu, Transition } from "@headlessui/react";
import assets from "../lib/assets.json";
import urlJoin from "url-join";

const { PUBLIC_URL } = process.env;

const style = {
wrapper: `w-screen flex flex-1 items-center justify-center mb-14`,
Expand Down Expand Up @@ -63,7 +66,7 @@ export const Swap = () => {
<Menu.Button className={`${style.currencySelectorMenuButton}`}>
<div className={style.currencySelectorIcon}>
<img
src={currentCoin.img}
src={urlJoin(PUBLIC_URL, currentCoin.img)}
alt="eth"
height={20}
width={20}
Expand Down
10 changes: 10 additions & 0 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2325,6 +2325,11 @@
resolved "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz"
integrity sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==

"@types/url-join@^4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@types/url-join/-/url-join-4.0.1.tgz#4989c97f969464647a8586c7252d97b449cdc045"
integrity sha512-wDXw9LEEUHyV+7UWy7U315nrJGJ7p1BzaCxDpEoLr789Dk1WDVMMlf3iBfbG2F8NdWnYyFbtTxUn2ZNbm1Q4LQ==

"@types/ws@^8.2.2":
version "8.2.2"
resolved "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz"
Expand Down Expand Up @@ -8834,6 +8839,11 @@ uri-js@^4.2.2:
dependencies:
punycode "^2.1.0"

url-join@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7"
integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==

util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
Expand Down