Browse Source
Re-organize frontend modules
1. "Components" refers to React components. "Types" and "HttpError"
are not React components and should thus be moved out.
2. Only components use JSX syntax, other files can/should have a regular
.ts extension.
3. If a file only exports one thing, make it a default export.
debug-collab-settlement
Thomas Eizinger
3 years ago
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
9 changed files with
9 additions and
9 deletions
taker-frontend/src/App.tsx
taker-frontend/src/HttpError.ts
taker-frontend/src/components/ErrorToast.tsx
taker-frontend/src/components/History.tsx
taker-frontend/src/components/NavBar.tsx
taker-frontend/src/components/Timestamp.tsx
taker-frontend/src/components/Trade.tsx
taker-frontend/src/components/Wallet.tsx
taker-frontend/src/types.ts
@ -20,6 +20,7 @@ import Footer from "./components/Footer";
import History from "./components/History" ;
import Nav from "./components/NavBar" ;
import Trade from "./components/Trade" ;
import { Wallet , WalletInfoBar } from "./components/Wallet" ;
import {
BXBTData ,
Cfd ,
@ -31,8 +32,7 @@ import {
Order ,
StateGroupKey ,
WalletInfo ,
} from "./components/Types" ;
import { Wallet , WalletInfoBar } from "./components/Wallet" ;
} from "./types" ;
import useLatestEvent from "./useLatestEvent" ;
import usePostRequest from "./usePostRequest" ;
@ -1,6 +1,6 @@
// A wrapper to parse RFC 7807
// Pass result of `await response.json()` into the constructor.
export class HttpError extends Error {
export default class HttpError extends Error {
title : string ;
detail? : string ;
@ -1,4 +1,4 @@
import { HttpError } from "./HttpError" ;
import HttpError from ". ./HttpError" ;
// A generic way of creating an error toast
// TODO: Don't use any (`toast: typeof useToast` did not work :( )
@ -28,8 +28,8 @@ import {
VStack ,
} from "@chakra-ui/react" ;
import * as React from "react" ;
import { Cfd , StateGroupKey , StateKey , Tx , TxLabel } from "../types" ;
import usePostRequest from "../usePostRequest" ;
import { Cfd , StateGroupKey , StateKey , Tx , TxLabel } from "./Types" ;
interface HistoryProps {
cfds : Cfd [ ] ;
@ -17,7 +17,7 @@ import * as React from "react";
import { useNavigate } from "react-router-dom" ;
import logoBlack from "../images/logo_nav_bar_black.svg" ;
import logoWhite from "../images/logo_nav_bar_white.svg" ;
import { WalletInfo } from "./T ypes" ;
import { WalletInfo } from "../t ypes" ;
interface NavProps {
walletInfo : WalletInfo | null ;
@ -1,6 +1,6 @@
import { Text } from "@chakra-ui/react" ;
import React from "react" ;
import { unixTimestampToDate } from "./T ypes" ;
import { unixTimestampToDate } from "../t ypes" ;
interface Props {
timestamp : number ;
@ -45,7 +45,7 @@ import {
} from "@chakra-ui/react" ;
import { motion } from "framer-motion" ;
import * as React from "react" ;
import { CfdOrderRequestPayload } from "./T ypes" ;
import { CfdOrderRequestPayload } from "../t ypes" ;
const MotionBox = motion < BoxProps > ( Box ) ;
@ -26,9 +26,9 @@ import {
import * as React from "react" ;
import { useState } from "react" ;
import { useNavigate } from "react-router-dom" ;
import { WalletInfo , WithdrawRequest } from "../types" ;
import usePostRequest from "../usePostRequest" ;
import Timestamp from "./Timestamp" ;
import { WalletInfo , WithdrawRequest } from "./Types" ;
interface WalletProps {
walletInfo : WalletInfo | null ;