Skip to content

Commit

Permalink
chore: fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
reza-bm committed Nov 25, 2023
1 parent ea9988d commit 3b3f268
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 100 deletions.
5 changes: 4 additions & 1 deletion components/Button/LinkButton.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/restrict-plus-operands */
import Link from 'next/link';
import { LinkButtonProps } from './Button.types';
import { PropsWithChildren } from 'react';
Expand All @@ -23,7 +24,9 @@ export function LinkButton(props: PropsWithChildren<LinkButtonProps>) {
return (
<Link
onClick={onClick}
className={`transition-all hover:bg-opacity-90 overflow-hidden relative py-15 flex items-center justify-center px-20 font-medium text-18 md:leading-snug md:text-18 text-baseForeground bg-secondary-500 rounded-soft ${props.className}`}
className={`transition-all hover:bg-opacity-90 overflow-hidden relative py-15 flex items-center justify-center px-20 font-medium text-18 md:leading-snug md:text-18 text-baseForeground bg-secondary-500 rounded-soft ${
props.className ? props.className : ''
}`}
href={props.href}>
{props.children}
</Link>
Expand Down
1 change: 1 addition & 0 deletions components/Button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/restrict-plus-operands */
import { ButtonProps } from './Button.types';
import { PropsWithChildren } from 'react';

Expand Down
6 changes: 3 additions & 3 deletions components/Table/old table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Table(props: TableProps) {
console.log('old item', item, key);
return (
<div
key={`${item.id as number}-row-${key}`}
key={`row-${key}`}
className="rounded-xl bg-neutral-100 w-full grid grid-cols-1 mb-4 px-2 lg:mb-0 lg:px-0 lg:flex lg:items-center lg:justify-center lg:border-b lg:!border-primary lg:border-opacity-50 lg:rounded-none">
{columns.map((row) => (
<div
Expand All @@ -33,9 +33,9 @@ function Table(props: TableProps) {
</div>
)}

{row.render
{/* {row.render
? row.render(item[row.key], item, key)
: item[row.key]}
: item[row.key]} */}
</div>
))}
</div>
Expand Down
22 changes: 13 additions & 9 deletions components/TxSteps/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import group from '../../public/img/group.svg'
import { StepType } from '../../types'
import Image from 'next/image'
import React from 'react'
import Step from './Step'
import group from '../../public/img/group.svg';
import { StepType } from '../../types';
import Image from 'next/image';
import React from 'react';
import Step from './Step';

interface PropsType {
steps: StepType[]
steps: StepType[];
}

const TxSteps: React.FC<PropsType> = ({ steps }) =>
steps.length > 0 ? (
<div className="w-full bg-neutral-100 p-3 rounded-lg lg:p-10">
<div className="flex items-center lg:mb-0 mb-3">
<Image className="w-11 h-11 hidden lg:block mr-3 ml-6" src={group} alt="steps" />
<Image
className="w-11 h-11 hidden lg:block mr-3 ml-6"
src={group}
alt="steps"
/>
<h3 className="text-16 font-bold lg:text-28">Swap Steps</h3>
</div>
{steps.map((step: StepType, key: number) => (
Expand All @@ -23,6 +27,6 @@ const TxSteps: React.FC<PropsType> = ({ steps }) =>
</div>
) : (
<div />
)
);

export default TxSteps
export default TxSteps;
8 changes: 4 additions & 4 deletions components/media.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createMedia } from '@artsy/fresnel'
import { createMedia } from '@artsy/fresnel';

const ExampleAppMedia = createMedia({
breakpoints: { xs: 0, sm: 640, md: 768, lg: 1024, xl: 1280 },
})
});

export const mediaStyles = ExampleAppMedia.createMediaStyle()
export const mediaStyles = ExampleAppMedia.createMediaStyle();

export const { Media, MediaContextProvider } = ExampleAppMedia
export const { Media, MediaContextProvider } = ExampleAppMedia;
33 changes: 16 additions & 17 deletions pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
import Layout from '../components/Layout'
import NotFoundAnything from '../components/NotFoundAnything'
import type { NextPage } from 'next'
import { useRouter } from 'next/router'
import copy from '../public/img/copy.svg'
import { CopyText } from '../utils/copyText'
import Image from 'next/image'
import Layout from '../components/Layout';
import NotFoundAnything from '../components/NotFoundAnything';
import type { NextPage } from 'next';
import { useRouter } from 'next/router';
import copy from '../public/img/copy.svg';
import { CopyText } from '../utils/copyText';
import Image from 'next/image';

const NotFound: NextPage = () => {
const router = useRouter()
const { query }: { query?: string } = router.query
const router = useRouter();
const { query }: { query?: string } = router.query;
return (
<Layout pageTitle="404-Not Found">
<Layout title="404-Not Found">
{query != null && (
<div className="flex items-center text-base font-bold mb-3 lg:mb-6 lg:text-28">
search results: <span className="font-normal ml-1">{query}</span>
<button
onClick={(e) => {
e.stopPropagation()
CopyText(query)
e.stopPropagation();
CopyText(query);
}}
className="group relative cursor-pointer"
>
className="group relative cursor-pointer">
<Image src={copy} alt="copy_to_clipboard" />
</button>
</div>
)}
<NotFoundAnything />
</Layout>
)
}
);
};

export default NotFound
export default NotFound;
23 changes: 9 additions & 14 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import NextNProgress from 'nextjs-progressbar'
import { ReactNode } from 'react'
import 'react-toastify/dist/ReactToastify.css'
import { ToastContainer } from 'react-toastify'
import '../styles/globals.css';
import type { AppProps } from 'next/app';
import NextNProgress from 'nextjs-progressbar';
import { ReactNode } from 'react';
import 'react-toastify/dist/ReactToastify.css';
import { ToastContainer } from 'react-toastify';

export default function App ({ Component, pageProps }: AppProps): ReactNode {
export default function App({ Component, pageProps }: AppProps): ReactNode {
return (
<>
<NextNProgress
color="#00A9BB"
height={2}
showOnShallow={true}
/>
<NextNProgress color="#00A9BB" height={2} showOnShallow={true} />

<Component {...pageProps} />
<ToastContainer />

</>
)
);
}
22 changes: 14 additions & 8 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
/* eslint-disable @typescript-eslint/explicit-function-return-type */
import Document, { Html, Head, Main, NextScript, DocumentContext } from 'next/document'
import Document, {
Html,
Head,
Main,
NextScript,
DocumentContext,
} from 'next/document';

const description =
'Multi-chain DEX aggregator, binance bridge, 1inch, Thorchain, Terra Bridge, Terra Swap, crypto API under a unified UX'
'Multi-chain DEX aggregator, binance bridge, 1inch, Thorchain, Terra Bridge, Terra Swap, crypto API under a unified UX';
class MyDocument extends Document {
static async getInitialProps (ctx: DocumentContext) {
const initialProps = await Document.getInitialProps(ctx)
return { ...initialProps }
static async getInitialProps(ctx: DocumentContext) {
const initialProps = await Document.getInitialProps(ctx);
return { ...initialProps };
}

render () {
render() {
return (
<Html lang="en">
<Head>
Expand All @@ -27,8 +33,8 @@ class MyDocument extends Document {
<NextScript />
</body>
</Html>
)
);
}
}

export default MyDocument
export default MyDocument;
6 changes: 3 additions & 3 deletions pages/old index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ChartBox from '../components/ChartBox';
import { makeColumns } from '../components/Table/MakeColumns';
import Navbar from '../components/Navbar';
// import Navbar from '../components/Navbar';
import SearchBox from '../components/SearchBox';
import Table from '../components/Table';
import { GetServerSideProps, NextPage } from 'next';
Expand Down Expand Up @@ -49,12 +49,12 @@ const Home: NextPage<PropsType> = ({ swaps, summary, status }: PropsType) => {
<Head>
<title>Rango Scanner</title>
</Head>
<Navbar />
{/* <Navbar /> */}
<main>
<SearchBox />
<div className="relative">
<div className="absolute w-full -top-14 md:-top-6 lg:-top-16">
<ChartBox summary={summary} />
<ChartBox data={summary.dailyInterval} />
<div className="mx-4 my-5 lg:mx-16 lg:mt-12">
<div className="flex mb-2.5 lg:mb-6">
<h3 className="text-base font-bold lg:text-3xl">
Expand Down
83 changes: 43 additions & 40 deletions pages/search.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
/* eslint-disable @typescript-eslint/prefer-optional-chain */
import { makeColumns } from '../components/Table/MakeColumns'
import Layout from '../components/Layout'
import Table from '../components/Table'
import { GetServerSideProps, NextPage } from 'next'
import { useRouter } from 'next/router'
import { useCallback } from 'react'
import { getSearchResult, getWalletSwaps } from '../services'
import { MATCH_TYPE } from '../constant'
import NotFoundAnything from '../components/NotFoundAnything'
import Loading from '../components/Loading'
import useSWR from 'swr'
import Error from 'next/error'
import Image from 'next/image'
import copy from '../public/img/copy.svg'
import { CopyText } from '../utils/copyText'
import { makeColumns } from '../components/Table/MakeColumns';
import Layout from '../components/Layout';
import Table from '../components/Table';
import { GetServerSideProps, NextPage } from 'next';
import { useRouter } from 'next/router';
import { useCallback } from 'react';
import { getSearchResult, getWalletSwaps } from '../services';
import { MATCH_TYPE } from '../constant';
import NotFoundAnything from '../components/NotFoundAnything';
import Loading from '../components/Loading';
import useSWR from 'swr';
import Error from 'next/error';
import Image from 'next/image';
import copy from '../public/img/copy.svg';
import { CopyText } from '../utils/copyText';
interface PropsType {
status?: number
status?: number;
}
const Home: NextPage<PropsType> = ({ status }: PropsType) => {
const router = useRouter()
const { query } = router.query
const { data } = useSWR(query, getWalletSwaps)
const router = useRouter();
const { query } = router.query;
const { data } = useSWR(query, getWalletSwaps);

const handleSwapDetails = useCallback((id: string) => {
router.push(`/swap/${id}`)
}, [])
router.push(`/swap/${id}`);
}, []);

return status || (data && data.error && data.status) ? (
<Error statusCode={data?.status || status} />
) : (
<Layout pageTitle={`Address ${query as string}`}>
<Layout title={`Address ${query as string}`}>
<div className="flex items-center text-base text-black truncate font-bold mb-3 lg:text-28 lg:mb-6">
search results: <span className="font-normal ml-1">{query}</span>
<button
onClick={(e) => {
e.stopPropagation()
CopyText(query as string)
e.stopPropagation();
CopyText(query as string);
}}
className="group relative cursor-pointer"
>
className="group relative cursor-pointer">
<Image src={copy} alt="copy_to_clipboard" />
</button>
</div>
Expand All @@ -50,28 +49,32 @@ const Home: NextPage<PropsType> = ({ status }: PropsType) => {
) : !data.transactions.length ? (
<NotFoundAnything />
) : (
<Table makeColumns={makeColumns} data={data.transactions} onClick={handleSwapDetails} />
<Table
makeColumns={makeColumns}
data={data.transactions}
onClick={handleSwapDetails}
/>
)}
</Layout>
)
}
);
};

export const getServerSideProps: GetServerSideProps = async (context) => {
const query = context.query.query
const query = context.query.query;

const result = await getSearchResult(query as string)
if (result?.error) return { props: { status: result.status } }
if (!result.length) return { notFound: true }
const result = await getSearchResult(query as string);
if (result?.error) return { props: { status: result.status } };
if (!result.length) return { notFound: true };
if (result[0].matchType === MATCH_TYPE.REQUESTID) {
return {
redirect: {
permanent: false,
destination: `/swap/${query as string}`
}
}
destination: `/swap/${query as string}`,
},
};
}
return {
props: {}
}
}
export default Home
props: {},
};
};
export default Home;
2 changes: 1 addition & 1 deletion pages/swap/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const SwapDetails: NextPage<PropsType> = ({ details, status }: PropsType) => {
return status ? (
<Error statusCode={status} />
) : (
<Layout pageTitle={`Swap ${id}`}>
<Layout title={`Swap ${id}`}>
<p className="text-12 font-normal mb-1 lg:mb-3.5 lg:text-28 lg:font-bold">
Swap From <span className="font-bold">{details.from.symbol}</span> (On{' '}
{details.from.blockchain}) to{' '}
Expand Down

0 comments on commit 3b3f268

Please sign in to comment.