mirror of
https://github.com/haveno-dex/haveno-ui.git
synced 2025-08-06 21:54:36 -04:00
chore: Implementing the markets offers page.
This commit is contained in:
parent
25ccdd9e77
commit
35376ef16f
20 changed files with 299 additions and 68 deletions
|
@ -30,7 +30,7 @@ import {
|
||||||
PaymentMethods,
|
PaymentMethods,
|
||||||
} from "@pages/Account";
|
} from "@pages/Account";
|
||||||
import { MyWallet } from "@pages/MyWallet";
|
import { MyWallet } from "@pages/MyWallet";
|
||||||
import { MarketsTransactions } from "@pages/Markets";
|
import { MarketsTransactionsPage } from "@pages/Markets";
|
||||||
|
|
||||||
export function AppRoutes() {
|
export function AppRoutes() {
|
||||||
return (
|
return (
|
||||||
|
@ -39,7 +39,7 @@ export function AppRoutes() {
|
||||||
<Route path={ROUTES.Login} element={<Login />} />
|
<Route path={ROUTES.Login} element={<Login />} />
|
||||||
<Route path={ROUTES.Welcome} element={<Welcome />} />
|
<Route path={ROUTES.Welcome} element={<Welcome />} />
|
||||||
<Route path={ROUTES.CreateAccount} element={<CreateAccount />} />
|
<Route path={ROUTES.CreateAccount} element={<CreateAccount />} />
|
||||||
<Route path={ROUTES.Markets} element={<MarketsTransactions />} />
|
<Route path={ROUTES.Markets} element={<MarketsTransactionsPage />} />
|
||||||
<Route
|
<Route
|
||||||
path={ROUTES.MyWallet}
|
path={ROUTES.MyWallet}
|
||||||
element={
|
element={
|
||||||
|
|
|
@ -1 +1,17 @@
|
||||||
|
// =============================================================================
|
||||||
|
// Copyright 2022 Haveno
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
export * from "./DetailItemCard";
|
export * from "./DetailItemCard";
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
// =============================================================================
|
||||||
|
// Copyright 2022 Haveno
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
import { Anchor as MAnchor, createStyles } from "@mantine/core";
|
import { Anchor as MAnchor, createStyles } from "@mantine/core";
|
||||||
import type { AnchorProps as MAnchorProps } from "@mantine/core";
|
import type { AnchorProps as MAnchorProps } from "@mantine/core";
|
||||||
|
|
||||||
|
|
|
@ -15,16 +15,16 @@
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
||||||
import { MarketTransactions } from "./MarketTransactions";
|
import { MarketTransactionsTable } from "./MarketTransactionsTable";
|
||||||
import { MarketTransactionPaymentMethod } from "./_types";
|
import { MarketTransactionPaymentMethod } from "./_types";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: "organisms/Markets/MarketsTransactions",
|
title: "molecules/MarketTransactionsTable",
|
||||||
component: MarketTransactions,
|
component: MarketTransactionsTable,
|
||||||
} as ComponentMeta<typeof MarketTransactions>;
|
} as ComponentMeta<typeof MarketTransactionsTable>;
|
||||||
|
|
||||||
const Template: ComponentStory<typeof MarketTransactions> = () => {
|
const Template: ComponentStory<typeof MarketTransactionsTable> = () => {
|
||||||
return <MarketTransactions data={data} />;
|
return <MarketTransactionsTable data={data} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Default = Template.bind({});
|
export const Default = Template.bind({});
|
|
@ -16,15 +16,15 @@
|
||||||
|
|
||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { render, screen } from "@testing-library/react";
|
import { render, screen } from "@testing-library/react";
|
||||||
import { MarketTransactions } from "./MarketTransactions";
|
import { MarketTransactionsTable } from "./MarketTransactionsTable";
|
||||||
import { AppProviders } from "@atoms/AppProviders";
|
import { AppProviders } from "@atoms/AppProviders";
|
||||||
import { MarketTransactionPaymentMethod } from "./_types";
|
import { MarketTransactionPaymentMethod } from "./_types";
|
||||||
|
|
||||||
describe("organisms::MarketTransactions", () => {
|
describe("molecules::MarketTransactionsTable", () => {
|
||||||
it("renders without exploding.", () => {
|
it("renders without exploding.", () => {
|
||||||
const { asFragment, unmount } = render(
|
const { asFragment, unmount } = render(
|
||||||
<AppProviders>
|
<AppProviders>
|
||||||
<MarketTransactions data={data} />
|
<MarketTransactionsTable data={data} />
|
||||||
</AppProviders>
|
</AppProviders>
|
||||||
);
|
);
|
||||||
expect(asFragment()).toMatchSnapshot();
|
expect(asFragment()).toMatchSnapshot();
|
||||||
|
@ -34,7 +34,7 @@ describe("organisms::MarketTransactions", () => {
|
||||||
it("renders all columns.", () => {
|
it("renders all columns.", () => {
|
||||||
const { unmount } = render(
|
const { unmount } = render(
|
||||||
<AppProviders>
|
<AppProviders>
|
||||||
<MarketTransactions data={data} />
|
<MarketTransactionsTable data={data} />
|
||||||
</AppProviders>
|
</AppProviders>
|
||||||
);
|
);
|
||||||
expect(screen.queryByText("Price")).toBeInTheDocument();
|
expect(screen.queryByText("Price")).toBeInTheDocument();
|
||||||
|
@ -49,7 +49,7 @@ describe("organisms::MarketTransactions", () => {
|
||||||
it("renders formatted price value with currency sign.", () => {
|
it("renders formatted price value with currency sign.", () => {
|
||||||
const { unmount } = render(
|
const { unmount } = render(
|
||||||
<AppProviders>
|
<AppProviders>
|
||||||
<MarketTransactions data={data} />
|
<MarketTransactionsTable data={data} />
|
||||||
</AppProviders>
|
</AppProviders>
|
||||||
);
|
);
|
||||||
expect(screen.queryByText("€5,000.96")).toBeInTheDocument();
|
expect(screen.queryByText("€5,000.96")).toBeInTheDocument();
|
||||||
|
@ -60,7 +60,7 @@ describe("organisms::MarketTransactions", () => {
|
||||||
it("renders formatted amount value with currency code.", () => {
|
it("renders formatted amount value with currency code.", () => {
|
||||||
const { unmount } = render(
|
const { unmount } = render(
|
||||||
<AppProviders>
|
<AppProviders>
|
||||||
<MarketTransactions data={data} />
|
<MarketTransactionsTable data={data} />
|
||||||
</AppProviders>
|
</AppProviders>
|
||||||
);
|
);
|
||||||
expect(screen.queryByText("7,564.94 XMR")).toBeInTheDocument();
|
expect(screen.queryByText("7,564.94 XMR")).toBeInTheDocument();
|
||||||
|
@ -71,7 +71,7 @@ describe("organisms::MarketTransactions", () => {
|
||||||
it("renders formatted cost value with currency sign.", () => {
|
it("renders formatted cost value with currency sign.", () => {
|
||||||
const { unmount } = render(
|
const { unmount } = render(
|
||||||
<AppProviders>
|
<AppProviders>
|
||||||
<MarketTransactions data={data} />
|
<MarketTransactionsTable data={data} />
|
||||||
</AppProviders>
|
</AppProviders>
|
||||||
);
|
);
|
||||||
expect(screen.queryByText("$532.34")).toBeInTheDocument();
|
expect(screen.queryByText("$532.34")).toBeInTheDocument();
|
||||||
|
@ -82,7 +82,7 @@ describe("organisms::MarketTransactions", () => {
|
||||||
it("renders formatted account trades.", () => {
|
it("renders formatted account trades.", () => {
|
||||||
const { unmount } = render(
|
const { unmount } = render(
|
||||||
<AppProviders>
|
<AppProviders>
|
||||||
<MarketTransactions data={data} />
|
<MarketTransactionsTable data={data} />
|
||||||
</AppProviders>
|
</AppProviders>
|
||||||
);
|
);
|
||||||
expect(screen.queryByText("3,412")).toBeInTheDocument();
|
expect(screen.queryByText("3,412")).toBeInTheDocument();
|
|
@ -1,3 +1,19 @@
|
||||||
|
// =============================================================================
|
||||||
|
// Copyright 2022 Haveno
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
import { createStyles } from "@mantine/core";
|
import { createStyles } from "@mantine/core";
|
||||||
import { createTable } from "@tanstack/react-table";
|
import { createTable } from "@tanstack/react-table";
|
||||||
import { Table } from "@molecules/Table";
|
import { Table } from "@molecules/Table";
|
||||||
|
@ -9,17 +25,19 @@ import {
|
||||||
MarketTransactionsCostsCell,
|
MarketTransactionsCostsCell,
|
||||||
MarketTransactionsAccountAgeCell,
|
MarketTransactionsAccountAgeCell,
|
||||||
MarketTransactionsPaymentCell,
|
MarketTransactionsPaymentCell,
|
||||||
} from "./MarketTransactionsCell";
|
} from "./MarketTransactionsTableCell";
|
||||||
import { useIntl } from "react-intl";
|
import { useIntl } from "react-intl";
|
||||||
import { LangKeys } from "@constants/lang";
|
import { LangKeys } from "@constants/lang";
|
||||||
|
|
||||||
const table = createTable().setRowType<MarketTransaction>();
|
const table = createTable().setRowType<MarketTransaction>();
|
||||||
|
|
||||||
interface MarketTransactionsProps {
|
interface MarketTransactionsTableProps {
|
||||||
data: MarketTransaction[];
|
data: MarketTransaction[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MarketTransactions({ data }: MarketTransactionsProps) {
|
export function MarketTransactionsTable({
|
||||||
|
data,
|
||||||
|
}: MarketTransactionsTableProps) {
|
||||||
const { classes, cx } = useStyles();
|
const { classes, cx } = useStyles();
|
||||||
const columns = useMarketTransactionsColumns();
|
const columns = useMarketTransactionsColumns();
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
// =============================================================================
|
||||||
|
// Copyright 2022 Haveno
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
import { Currency } from "@atoms/Currency";
|
import { Currency } from "@atoms/Currency";
|
||||||
import { BodyText } from "@atoms/Typography";
|
import { BodyText } from "@atoms/Typography";
|
||||||
import { Group, Text } from "@mantine/core";
|
import { Group, Text } from "@mantine/core";
|
|
@ -0,0 +1,32 @@
|
||||||
|
// =============================================================================
|
||||||
|
// Copyright 2022 Haveno
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
export interface MarketTransaction {
|
||||||
|
price: number;
|
||||||
|
priceComparison: number;
|
||||||
|
priceCurrency: string;
|
||||||
|
amount: number;
|
||||||
|
amountCurrency: string;
|
||||||
|
cost: number;
|
||||||
|
costCurrency: string;
|
||||||
|
paymentMethod: MarketTransactionPaymentMethod;
|
||||||
|
accountAge: number;
|
||||||
|
accountTrades: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum MarketTransactionPaymentMethod {
|
||||||
|
CashByMail = "CashByMail",
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// =============================================================================
|
||||||
|
// Copyright 2022 Haveno
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
export * from "./MarketTransactionsTable";
|
|
@ -1,16 +0,0 @@
|
||||||
export interface MarketTransaction {
|
|
||||||
price: number;
|
|
||||||
priceComparison: number;
|
|
||||||
priceCurrency: string;
|
|
||||||
amount: number;
|
|
||||||
amountCurrency: string;
|
|
||||||
cost: number;
|
|
||||||
costCurrency: string;
|
|
||||||
paymentMethod: MarketTransactionPaymentMethod;
|
|
||||||
accountAge: number;
|
|
||||||
accountTrades: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum MarketTransactionPaymentMethod {
|
|
||||||
CashByMail = "CashByMail",
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
export * from "./MarketTransactions";
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
// =============================================================================
|
||||||
|
// Copyright 2022 Haveno
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
||||||
|
import { MarketsTransactions } from "./MarketsTransactions";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: "organisms/MarketsTransactions",
|
||||||
|
component: MarketsTransactions,
|
||||||
|
} as ComponentMeta<typeof MarketsTransactions>;
|
||||||
|
|
||||||
|
const Template: ComponentStory<typeof MarketsTransactions> = () => {
|
||||||
|
return <MarketsTransactions />;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Default = Template.bind({});
|
||||||
|
|
||||||
|
Default.args = {};
|
|
@ -0,0 +1,44 @@
|
||||||
|
// =============================================================================
|
||||||
|
// Copyright 2022 Haveno
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
import { useMarketsOffers } from "@hooks/haveno/useMarketsOffers";
|
||||||
|
import { Loader } from "@mantine/core";
|
||||||
|
import { MarketTransactionsTable } from "@molecules/MarketTransactionsTable";
|
||||||
|
import type { FC } from "react";
|
||||||
|
|
||||||
|
export function MarketsTransactionsLoaded() {
|
||||||
|
useMarketsOffers({
|
||||||
|
assetCode: "eth",
|
||||||
|
direction: "buy",
|
||||||
|
});
|
||||||
|
return <MarketTransactionsTable data={[]} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
const MarketsTransactionsBoot: FC = ({ children }) => {
|
||||||
|
const { isLoading: isOffersLoading } = useMarketsOffers({
|
||||||
|
assetCode: "eth",
|
||||||
|
direction: "buy",
|
||||||
|
});
|
||||||
|
return isOffersLoading ? <Loader color="gray" /> : <>{children}</>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function MarketsTransactions() {
|
||||||
|
return (
|
||||||
|
<MarketsTransactionsBoot>
|
||||||
|
<MarketsTransactionsLoaded />
|
||||||
|
</MarketsTransactionsBoot>
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// =============================================================================
|
||||||
|
// Copyright 2022 Haveno
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
export * from "./MarketsTransactions";
|
|
@ -29,6 +29,8 @@ export enum QueryKeys {
|
||||||
XmrSeed = "Haveno.XmrSeed",
|
XmrSeed = "Haveno.XmrSeed",
|
||||||
XmrPrimaryAddress = "Haveno.XmrPrimaryAddress",
|
XmrPrimaryAddress = "Haveno.XmrPrimaryAddress",
|
||||||
XmrTxs = "Haveno.XmrTransactions",
|
XmrTxs = "Haveno.XmrTransactions",
|
||||||
|
MarketsOffers = "Haveno.MarketsOffers",
|
||||||
|
MyOffers = "Haveno.MyOffers",
|
||||||
|
|
||||||
// Storage
|
// Storage
|
||||||
StorageAccountInfo = "Storage.AccountInfo",
|
StorageAccountInfo = "Storage.AccountInfo",
|
||||||
|
|
|
@ -27,8 +27,7 @@ interface MarketsOfferesQuery {
|
||||||
export function useMarketsOffers(query: MarketsOfferesQuery) {
|
export function useMarketsOffers(query: MarketsOfferesQuery) {
|
||||||
const client = useHavenoClient();
|
const client = useHavenoClient();
|
||||||
|
|
||||||
return useQuery<OfferInfo[], Error>(
|
return useQuery<OfferInfo[], Error>([QueryKeys.MarketsOffers, query], () =>
|
||||||
[QueryKeys.MoneroNodeIsRunning, query],
|
client.getOffers(query.assetCode, query.direction)
|
||||||
() => client.getOffers(query.assetCode, query.direction)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
33
packages/renderer/src/hooks/haveno/useMyOffers.ts
Normal file
33
packages/renderer/src/hooks/haveno/useMyOffers.ts
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
// =============================================================================
|
||||||
|
// Copyright 2022 Haveno
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
import { useQuery } from "react-query";
|
||||||
|
import type { OfferInfo } from "haveno-ts";
|
||||||
|
import { QueryKeys } from "@constants/query-keys";
|
||||||
|
import { useHavenoClient } from "./useHavenoClient";
|
||||||
|
|
||||||
|
interface MyOfferesQuery {
|
||||||
|
assetCode: string;
|
||||||
|
direction?: "buy" | "sell";
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useMarketsOffers(query: MyOfferesQuery) {
|
||||||
|
const client = useHavenoClient();
|
||||||
|
|
||||||
|
return useQuery<OfferInfo[], Error>([QueryKeys.MyOffers, query], () =>
|
||||||
|
client.getMyOffers(query.assetCode, query.direction)
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,35 +1,26 @@
|
||||||
import { NavbarLayout } from "@templates/NavbarLayout";
|
// =============================================================================
|
||||||
import { MarketTransactions } from "@organisms/MarketTransactions";
|
// Copyright 2022 Haveno
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
export function MarketsTransactions() {
|
import { NavbarLayout } from "@templates/NavbarLayout";
|
||||||
|
import { MarketsTransactions } from "@organisms/MarketsTransactions";
|
||||||
|
|
||||||
|
export function MarketsTransactionsPage() {
|
||||||
return (
|
return (
|
||||||
<NavbarLayout>
|
<NavbarLayout>
|
||||||
<MarketTransactions data={data} />
|
<MarketsTransactions />
|
||||||
</NavbarLayout>
|
</NavbarLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = [
|
|
||||||
{
|
|
||||||
price: 123,
|
|
||||||
priceComparison: 0.12,
|
|
||||||
amount: 123123,
|
|
||||||
amountCurrency: "EUR",
|
|
||||||
cost: 123,
|
|
||||||
costCurrency: "USD",
|
|
||||||
paymentMethod: "ASD",
|
|
||||||
accountAge: 12,
|
|
||||||
accountTrades: 1212,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
price: 123,
|
|
||||||
priceComparison: 0.12,
|
|
||||||
amount: 123123,
|
|
||||||
amountCurrency: "EUR",
|
|
||||||
cost: 123,
|
|
||||||
costCurrency: "USD",
|
|
||||||
paymentMethod: "ASD",
|
|
||||||
accountAge: 12,
|
|
||||||
accountTrades: 1212,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
|
@ -1 +1,17 @@
|
||||||
|
// =============================================================================
|
||||||
|
// Copyright 2022 Haveno
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
export * from "./MarketsTransactions";
|
export * from "./MarketsTransactions";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue