Skip to content

Commit

Permalink
chore: cleanup src/test dir
Browse files Browse the repository at this point in the history
introduces `pages` dir for the different routes
  • Loading branch information
dni committed Jan 5, 2024
1 parent b31bc7d commit 95247fa
Show file tree
Hide file tree
Showing 36 changed files with 136 additions and 133 deletions.
2 changes: 1 addition & 1 deletion src/components/AddressInput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createEffect, on } from "solid-js";

import { decodeAddress } from "../compat";
import { RBTC } from "../consts";
import t from "../i18n";
import {
Expand All @@ -11,6 +10,7 @@ import {
setAddressValid,
setOnchainAddress,
} from "../signals";
import { decodeAddress } from "../utils/compat";
import { extractAddress } from "../utils/invoice";
import { setButtonLabel } from "./CreateButton";

Expand Down
2 changes: 1 addition & 1 deletion src/components/AssetSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { pairs } from "../config";
import { LN, sideSend } from "../consts";
import { fetchPairs } from "../helper";
import t from "../i18n";
import {
assetReceive,
Expand All @@ -12,6 +11,7 @@ import {
setAssetSelect,
setAssetSend,
} from "../signals";
import { fetchPairs } from "../utils/helper";

const assets = Object.keys(pairs).map((pair) => pair.split("/")[0]);
assets.push(LN);
Expand Down
4 changes: 2 additions & 2 deletions src/components/CreateButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { createEffect, createMemo, createSignal } from "solid-js";

import { RBTC } from "../consts";
import { useWeb3Signer } from "../context/Web3";
import { ECPair } from "../ecpair/ecpair";
import { feeCheck, fetcher } from "../helper";
import t from "../i18n";
import {
asset,
Expand All @@ -32,6 +30,8 @@ import {
valid,
wasmSupported,
} from "../signals";
import { ECPair } from "../utils/ecpair";
import { feeCheck, fetcher } from "../utils/helper";
import { extractAddress, fetchLnurl } from "../utils/invoice";
import { validateResponse } from "../utils/validation";

Expand Down
2 changes: 1 addition & 1 deletion src/components/DownloadRefund.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import log from "loglevel";
import QRCode from "qrcode/lib/server";

import { isIos, isMobile } from "../helper";
import t from "../i18n";
import { swap } from "../signals";
import { download, downloadJson } from "../utils/download";
import { isIos, isMobile } from "../utils/helper";

const createRefundData = (swap: any) => {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Fees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { createEffect } from "solid-js";

import btcSvg from "../assets/btc.svg";
import satSvg from "../assets/sat.svg";
import { fetchPairs } from "../helper";
import t from "../i18n";
import {
asset,
Expand All @@ -23,6 +22,7 @@ import {
calculateSendAmount,
} from "../utils/calculate";
import { denominations, formatAmount } from "../utils/denomination";
import { fetchPairs } from "../utils/helper";

const Fees = () => {
createEffect(() => {
Expand Down
16 changes: 8 additions & 8 deletions src/Footer.tsx → src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import discord from "./assets/discord.svg";
import github from "./assets/github.svg";
import nostr from "./assets/nostr.svg";
import substack from "./assets/substack.svg";
import twitter from "./assets/twitter.svg";
import discord from "../assets/discord.svg";
import github from "../assets/github.svg";
import nostr from "../assets/nostr.svg";
import substack from "../assets/substack.svg";
import twitter from "../assets/twitter.svg";
import {
blogUrl,
discordUrl,
githubUrl,
nostrUrl,
repoUrl,
twitterUrl,
} from "./config";
import t from "./i18n";
import "./style/footer.scss";
} from "../config";
import t from "../i18n";
import "../style/footer.scss";

const Footer = () => {
return (
Expand Down
16 changes: 8 additions & 8 deletions src/Nav.tsx → src/components/Nav.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { A } from "@solidjs/router";
import { For, Show, createSignal } from "solid-js";

import { setHideHero } from "./Hero";
import logo from "./assets/boltz.svg";
import Warnings from "./components/Warnings";
import { blogUrl, discordUrl, docsUrl, torUrl } from "./config";
import t from "./i18n";
import locales from "./i18n/i18n";
import { setI18nConfigured } from "./signals";
import "./style/nav.scss";
import logo from "../assets/boltz.svg";
import Warnings from "../components/Warnings";
import { blogUrl, discordUrl, docsUrl, torUrl } from "../config";
import t from "../i18n";
import locales from "../i18n/i18n";
import { setHideHero } from "../pages/Hero";
import { setI18nConfigured } from "../signals";
import "../style/nav.scss";

const Nav = ({ network }) => {
let timeout: ReturnType<typeof setTimeout> | undefined;
Expand Down
4 changes: 2 additions & 2 deletions src/Notification.tsx → src/components/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
notificationType,
setNotification,
setNotificationType,
} from "./signals";
import "./style/notification.scss";
} from "../signals";
import "../style/notification.scss";

const Notification = () => {
createEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Refund.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Accessor, createSignal } from "solid-js";

import { RBTC } from "../consts";
import { useWeb3Signer } from "../context/Web3";
import { refund, refundAddressChange, updateSwaps } from "../helper";
import t from "../i18n";
import { refund, refundAddressChange, updateSwaps } from "../utils/helper";
import { decodeInvoice } from "../utils/invoice";
import { prefix0x, satoshiToWei } from "../utils/rootstock";
import ContractTransaction from "./ContractTransaction";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Warnings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Show } from "solid-js";

import reload_svg from "../assets/reload.svg";
import { isBeta } from "../config";
import { fetchPairs } from "../helper";
import t from "../i18n";
import { online, wasmSupported } from "../signals";
import { fetchPairs } from "../utils/helper";

const Warnings = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/context/Web3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

import { pairs } from "../config";
import { RBTC } from "../consts";
import { getApiUrl } from "../helper";
import { getApiUrl } from "../utils/helper";

// TODO: check network and add option to add RSK as network
// TODO: handle network and account change events
Expand Down
24 changes: 12 additions & 12 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ import log from "loglevel";
import { Show, createRoot, createSignal } from "solid-js";
import { render } from "solid-js/web";

import Create from "./Create";
import Error from "./Error";
import Footer from "./Footer";
import { Hero, setHideHero } from "./Hero";
import History from "./History";
import Nav from "./Nav";
import NotFound from "./NotFound";
import Notification from "./Notification";
import Pay from "./Pay";
import Refund from "./Refund";
import RefundStep from "./RefundStep";
import Footer from "./components/Footer";
import Nav from "./components/Nav";
import Notification from "./components/Notification";
import { loglevel, network } from "./config";
import { Web3SignerProvider } from "./context/Web3";
import { checkReferralId } from "./helper";
import { detectLanguage } from "./i18n/detect";
import Create from "./pages/Create";
import Error from "./pages/Error";
import { Hero, setHideHero } from "./pages/Hero";
import History from "./pages/History";
import NotFound from "./pages/NotFound";
import Pay from "./pages/Pay";
import Refund from "./pages/Refund";
import RefundStep from "./pages/RefundStep";
import { setWasmSupported, setWebln } from "./signals";
import "./style/index.scss";
import { detectEmbedded } from "./utils/embed";
import { checkReferralId } from "./utils/helper";
import "./utils/patches";
import { swapChecker } from "./utils/swapChecker";
import { checkWasmSupported } from "./utils/wasmSupport";
Expand Down
37 changes: 20 additions & 17 deletions src/Create.tsx → src/pages/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ import { BigNumber } from "bignumber.js";
import log from "loglevel";
import { Show, createEffect, createMemo, on, onMount } from "solid-js";

import AddressInput from "./components/AddressInput";
import Asset from "./components/Asset";
import AssetSelect from "./components/AssetSelect";
import ClickableAmount from "./components/ClickableAmount";
import ConnectMetamask from "./components/ConnectMetamask";
import { CreateButton, setButtonLabel } from "./components/CreateButton";
import Fees from "./components/Fees";
import InvoiceInput from "./components/InvoiceInput";
import QrScan from "./components/QrScan";
import Reverse from "./components/Reverse";
import { RBTC, sideReceive, sideSend } from "./consts";
import { isMobile } from "./helper";
import t from "./i18n";
import AddressInput from "../components/AddressInput";
import Asset from "../components/Asset";
import AssetSelect from "../components/AssetSelect";
import ClickableAmount from "../components/ClickableAmount";
import ConnectMetamask from "../components/ConnectMetamask";
import { CreateButton, setButtonLabel } from "../components/CreateButton";
import Fees from "../components/Fees";
import InvoiceInput from "../components/InvoiceInput";
import QrScan from "../components/QrScan";
import Reverse from "../components/Reverse";
import { RBTC, sideReceive, sideSend } from "../consts";
import t from "../i18n";
import {
addressValid,
amountChanged,
Expand Down Expand Up @@ -45,15 +44,19 @@ import {
setValid,
wasmSupported,
webln,
} from "./signals";
import { calculateReceiveAmount, calculateSendAmount } from "./utils/calculate";
} from "../signals";
import {
calculateReceiveAmount,
calculateSendAmount,
} from "../utils/calculate";
import {
calculateDigits,
convertAmount,
formatAmount,
getValidationRegex,
} from "./utils/denomination";
import { enableWebln } from "./utils/webln";
} from "../utils/denomination";
import { isMobile } from "../utils/helper";
import { enableWebln } from "../utils/webln";

const Create = () => {
let receiveAmountRef: HTMLInputElement, sendAmountRef: HTMLInputElement;
Expand Down
2 changes: 1 addition & 1 deletion src/Error.tsx → src/pages/Error.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import t from "./i18n";
import t from "../i18n";

const Error = () => {
return (
Expand Down
16 changes: 8 additions & 8 deletions src/Hero.tsx → src/pages/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { useNavigate } from "@solidjs/router";
import log from "loglevel";
import { Show, createMemo, createSignal } from "solid-js";

import Create from "./Create";
import bitcoin from "./assets/bitcoin-icon.svg";
import lightning from "./assets/lightning-icon.svg";
import liquid from "./assets/liquid-icon.svg";
import { ambossUrl } from "./config";
import { fetcher } from "./helper";
import t from "./i18n";
import "./style/hero.scss";
import bitcoin from "../assets/bitcoin-icon.svg";
import lightning from "../assets/lightning-icon.svg";
import liquid from "../assets/liquid-icon.svg";
import { ambossUrl } from "../config";
import t from "../i18n";
import Create from "../pages/Create";
import "../style/hero.scss";
import { fetcher } from "../utils/helper";

export const [hideHero, setHideHero] = createSignal(false);

Expand Down
10 changes: 5 additions & 5 deletions src/History.tsx → src/pages/History.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { useNavigate } from "@solidjs/router";
import log from "loglevel";
import { Show } from "solid-js";

import SwapList from "./components/SwapList";
import { isIos } from "./helper";
import t from "./i18n";
import SwapList from "../components/SwapList";
import t from "../i18n";
import {
setNotification,
setNotificationType,
setSwaps,
swaps,
} from "./signals";
import { downloadJson } from "./utils/download";
} from "../signals";
import { downloadJson } from "../utils/download";
import { isIos } from "../utils/helper";

// Throws when the file is invalid
const validateBackupFile = (file: any) => {
Expand Down
2 changes: 1 addition & 1 deletion src/NotFound.tsx → src/pages/NotFound.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useNavigate } from "@solidjs/router";

import t from "./i18n";
import t from "../i18n";

const NotFound = () => {
const navigate = useNavigate();
Expand Down
36 changes: 18 additions & 18 deletions src/Pay.tsx → src/pages/Pay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { useParams } from "@solidjs/router";
import log from "loglevel";
import { Show, createEffect, createSignal, onCleanup } from "solid-js";

import BlockExplorer from "./components/BlockExplorer";
import LoadingSpinner from "./components/LoadingSpinner";
import { RBTC } from "./consts";
import { fetcher } from "./helper";
import t from "./i18n";
import BlockExplorer from "../components/BlockExplorer";
import LoadingSpinner from "../components/LoadingSpinner";
import { RBTC } from "../consts";
import t from "../i18n";
import {
setFailureReason,
setSwap,
Expand All @@ -16,19 +15,20 @@ import {
swapStatus,
swapStatusTransaction,
swaps,
} from "./signals";
import InvoiceExpired from "./status/InvoiceExpired";
import InvoiceFailedToPay from "./status/InvoiceFailedToPay";
import InvoicePending from "./status/InvoicePending";
import InvoiceSet from "./status/InvoiceSet";
import SwapCreated from "./status/SwapCreated";
import SwapExpired from "./status/SwapExpired";
import SwapRefunded from "./status/SwapRefunded";
import TransactionClaimed from "./status/TransactionClaimed";
import TransactionConfirmed from "./status/TransactionConfirmed";
import TransactionLockupFailed from "./status/TransactionLockupFailed";
import TransactionMempool from "./status/TransactionMempool";
import { swapStatusFailed } from "./utils/swapStatus";
} from "../signals";
import InvoiceExpired from "../status/InvoiceExpired";
import InvoiceFailedToPay from "../status/InvoiceFailedToPay";
import InvoicePending from "../status/InvoicePending";
import InvoiceSet from "../status/InvoiceSet";
import SwapCreated from "../status/SwapCreated";
import SwapExpired from "../status/SwapExpired";
import SwapRefunded from "../status/SwapRefunded";
import TransactionClaimed from "../status/TransactionClaimed";
import TransactionConfirmed from "../status/TransactionConfirmed";
import TransactionLockupFailed from "../status/TransactionLockupFailed";
import TransactionMempool from "../status/TransactionMempool";
import { fetcher } from "../utils/helper";
import { swapStatusFailed } from "../utils/swapStatus";

const Pay = () => {
const params = useParams();
Expand Down
14 changes: 7 additions & 7 deletions src/Refund.tsx → src/pages/Refund.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import log from "loglevel";
import QrScanner from "qr-scanner";
import { Show, createEffect, createSignal } from "solid-js";

import BlockExplorer from "./components/BlockExplorer";
import RefundEta from "./components/RefundEta";
import SwapList from "./components/SwapList";
import { fetcher, refund, refundAddressChange } from "./helper";
import t from "./i18n";
import BlockExplorer from "../components/BlockExplorer";
import RefundEta from "../components/RefundEta";
import SwapList from "../components/SwapList";
import t from "../i18n";
import {
refundTx,
setTimeoutBlockheight,
setTimeoutEta,
setTransactionToRefund,
swaps,
} from "./signals";
} from "../signals";
import { fetcher, refund, refundAddressChange } from "../utils/helper";
import {
swapStatusFailed,
swapStatusSuccess,
updateSwapStatus,
} from "./utils/swapStatus";
} from "../utils/swapStatus";

const refundJsonKeys = ["id", "asset", "privateKey", "redeemScript"];
const refundJsonKeysLiquid = refundJsonKeys.concat("blindingKey");
Expand Down
Loading

0 comments on commit 95247fa

Please sign in to comment.