chore(dev): eslint import rules

---

Co-authored-by: @schowdhuri 
Reviewed-by: @schowdhuri
This commit is contained in:
Ahmed Bouhuolia 2022-06-03 20:30:55 +02:00 committed by GitHub
parent ec2193b460
commit 07a984bb52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
129 changed files with 337 additions and 170 deletions

View File

@ -8,19 +8,38 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
"plugin:prettier/recommended",
"plugin:import/recommended",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"plugins": ["@typescript-eslint", "import"],
"ignorePatterns": ["node_modules/**", "**/dist/**"],
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/consistent-type-imports": "error",
"prettier/prettier": "error"
"@typescript-eslint/ban-ts-comment": "off",
"import/no-named-as-default": "off",
"prettier/prettier": "error",
"import/newline-after-import": ["error", { "count": 1 }],
"import/order": "error"
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
},
"typescript": {
"project": [
"packages/main/tsconfig.json",
"packages/preload/tsconfig.json"
]
}
}
}
}

View File

@ -70,6 +70,8 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-import-resolver-typescript": "^2.7.1",
"eslint-plugin-import": "^2.26.0",
"happy-dom": "2.41.0",
"husky": "^7.0.4",
"jsdom": "^19.0.0",

View File

@ -16,9 +16,9 @@
import { app } from "electron";
import "./security-restrictions";
import { registerHavenoHandlers } from "./services/haveno";
import { restoreOrCreateWindow } from "@src/mainWindow";
import { registerStoreHandlers } from "@src/services/store";
import { registerHavenoHandlers } from "./services/haveno";
/**
* Prevent multiple instances

View File

@ -14,9 +14,9 @@
// limitations under the License.
// =============================================================================
import { BrowserWindow } from "electron";
import { join } from "path";
import { URL } from "url";
import { BrowserWindow } from "electron";
async function createWindow() {
const browserWindow = new BrowserWindow({

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import { app, shell } from "electron";
import { URL } from "url";
import { app, shell } from "electron";
/**
* List of origins that you allow open INSIDE the application and permissions for each of them.

View File

@ -16,11 +16,10 @@
import fsPromises from "fs/promises";
import { ipcMain, dialog } from "electron";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import QRCode from "qrcode/lib/server";
import type { DownloadBackupInput } from "@src/types";
import { IpcChannels } from "@src/types";
import type { DownloadBackupInput } from "@src/types";
const { toFile } = require("qrcode/lib");
export function registerHavenoHandlers() {
ipcMain.handle(
@ -76,7 +75,7 @@ export function registerHavenoHandlers() {
if (!file?.filePath) {
return;
}
QRCode.toFile(
toFile(
file.filePath,
code,
{

View File

@ -16,6 +16,13 @@
import { ipcMain, safeStorage } from "electron";
import Store from "electron-store";
import { StorageKeys, IpcChannels, StoreSchema } from "@src/types";
import {
createAuthToken,
hashPassword,
verifyAuthAuthToken,
verifyPassword,
} from "@src/utils/password";
import type {
AccountInfoDto,
ChangePasswordInput,
@ -23,14 +30,6 @@ import type {
IStoreSchema,
SetPasswordInput,
} from "@src/types";
import { StorageKeys } from "@src/types";
import { IpcChannels, StoreSchema } from "@src/types";
import {
createAuthToken,
hashPassword,
verifyAuthAuthToken,
verifyPassword,
} from "@src/utils/password";
const store = new Store<IStoreSchema>({ schema: StoreSchema });

View File

@ -14,11 +14,10 @@
// limitations under the License.
// =============================================================================
import type { MaybeMocked } from "vitest";
import { beforeEach, expect, test, vi } from "vitest";
import { restoreOrCreateWindow } from "../src/mainWindow";
import { BrowserWindow } from "electron";
import type { MaybeMocked } from "vitest";
import { restoreOrCreateWindow } from "../src/mainWindow";
/**
* Mock real electron BrowserWindow API

View File

@ -14,9 +14,9 @@
// limitations under the License.
// =============================================================================
import { node } from "../../.electron-vendors.cache.json";
import { join } from "path";
import { builtinModules } from "module";
import { node } from "../../.electron-vendors.cache.json";
const PACKAGE_ROOT = __dirname;

View File

@ -16,8 +16,8 @@
import { ipcRenderer } from "electron";
import { exposeInMainWorld } from "./exposeInMainWorld";
import type { DownloadBackupInput } from "./types";
import { IpcChannels } from "./types";
import type { DownloadBackupInput } from "./types";
// Export for types in contracts.d.ts
export const haveno = {

View File

@ -16,13 +16,13 @@
import { ipcRenderer } from "electron";
import { exposeInMainWorld } from "./exposeInMainWorld";
import { IpcChannels } from "./types";
import type {
AccountInfoDto,
ChangePasswordInput,
IPreferences,
SetPasswordInput,
} from "./types";
import { IpcChannels } from "./types";
// Export for types in contracts.d.ts
export const store = {

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import { chrome } from "../../.electron-vendors.cache.json";
import { builtinModules } from "module";
import { chrome } from "../../.electron-vendors.cache.json";
const PACKAGE_ROOT = __dirname;

View File

@ -7,24 +7,41 @@
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:prettier/recommended"
"plugin:prettier/recommended",
"plugin:import/recommended",
"plugin:import/typescript"
],
"parserOptions": {
"parser": "@typescript-eslint/parser",
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "react"],
"plugins": ["@typescript-eslint", "react", "import"],
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/ban-ts-comment": "off",
"import/no-named-as-default": "off",
"prettier/prettier": "error",
"react/jsx-curly-brace-presence": "error"
"react/jsx-curly-brace-presence": "error",
"import/order": "error",
"import/newline-after-import": "error"
},
"settings": {
"react": {
"version": "detect"
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
},
"typescript": {
"project": ["packages/renderer/tsconfig.json"]
}
}
}
}

View File

@ -14,11 +14,11 @@
// limitations under the License.
// =============================================================================
import type { FC } from "react";
import { useEffect, useMemo, useState } from "react";
import { IntlProvider as ReacIntlProvider } from "react-intl";
import type { LangKeys } from "@src/constants/lang";
import type { FC } from "react";
import { LangPack, SupportedLocales } from "@src/constants/lang";
import type { LangKeys } from "@src/constants/lang";
const DEFAULT_LOCALE = SupportedLocales.EN;

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { FC } from "react";
import { QueryClient, QueryClientProvider as QCProvider } from "react-query";
import type { FC } from "react";
const queryClient = new QueryClient({
defaultOptions: {

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { FC } from "react";
import { MantineProvider, Global } from "@mantine/core";
import type { FC } from "react";
import { themeOverride, globalStyles } from "@src/theme";
export const ThemeProvider: FC = ({ children }) => {

View File

@ -14,14 +14,14 @@
// limitations under the License.
// =============================================================================
import type { FC } from "react";
import { RecoilRoot } from "recoil";
import { HashRouter } from "react-router-dom";
import { NotificationsProvider } from "@mantine/notifications";
import { ModalsProvider } from "@atoms/Modal";
import type { FC } from "react";
import { QueryClientProvider } from "./QueryClientProvider";
import { IntlProvider } from "./IntlProvider";
import { ThemeProvider } from "./ThemeProvider";
import { ModalsProvider } from "@atoms/Modal";
export const AppProviders: FC = ({ children }) => (
<HashRouter>

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { ButtonProps as MButtonProps } from "@mantine/core";
import { Button as MButton, createStyles } from "@mantine/core";
import type { ButtonProps as MButtonProps } from "@mantine/core";
type ButtonProps<TComponent> = MButtonProps<TComponent> & {
flavor?: "primary" | "neutral" | "success" | "danger";

View File

@ -14,9 +14,9 @@
// limitations under the License.
// =============================================================================
import { UnstyledButton } from "@mantine/core";
import type { ReactNode } from "react";
import type { UnstyledButtonProps } from "@mantine/core";
import { UnstyledButton } from "@mantine/core";
import { BodyText } from "@atoms/Typography";
interface TextButtonProps extends UnstyledButtonProps<"button"> {

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { Stack } from "@mantine/core";
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { CircleIcon } from "./CircleIcon";
import { ReactComponent as ArrowNorth } from "@assets/arrow-north.svg";
import { ReactComponent as ArrowWest } from "@assets/arrow-west.svg";

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { DefaultProps } from "@mantine/core";
import { Box, createStyles } from "@mantine/core";
import type { DefaultProps } from "@mantine/core";
export interface CircleIconProps extends DefaultProps {
color?: string;

View File

@ -16,8 +16,8 @@
import { describe, expect, it } from "vitest";
import { render } from "@testing-library/react";
import { AppProviders } from "@atoms/AppProviders";
import { ConnectionProgress } from ".";
import { AppProviders } from "@atoms/AppProviders";
describe("atoms::ConnectionProgress", () => {
it("renders without exploding", () => {

View File

@ -14,10 +14,10 @@
// limitations under the License.
// =============================================================================
import { BodyText } from "@atoms/Typography";
import { Stack } from "@mantine/core";
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { Currency } from ".";
import { BodyText } from "@atoms/Typography";
export default {
title: "atoms/Currency",

View File

@ -16,8 +16,8 @@
import { describe, expect, it } from "vitest";
import { render } from "@testing-library/react";
import { AppProviders } from "@atoms/AppProviders";
import { Currency } from ".";
import { AppProviders } from "@atoms/AppProviders";
describe("atoms::Currency", () => {
it("renders without exploding", () => {

View File

@ -14,9 +14,10 @@
// limitations under the License.
// =============================================================================
import type { DefaultProps } from "@mantine/core";
import { Stack, createStyles, Text } from "@mantine/core";
import type { DefaultProps } from "@mantine/core";
import { BodyText } from "@atoms/Typography";
export interface DetailItemProps extends DefaultProps {
label?: string;
textAlign?: "left" | "right";

View File

@ -15,8 +15,8 @@
// =============================================================================
import { createStyles, Group } from "@mantine/core";
import type { DetailItemProps } from "@atoms/DetailItem";
import { DetailItem } from "@atoms/DetailItem";
import type { DetailItemProps } from "@atoms/DetailItem";
export interface DetailItemCardProps extends DetailItemProps {
primary?: boolean;

View File

@ -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";

View File

@ -16,8 +16,8 @@
import { describe, expect, it } from "vitest";
import { render } from "@testing-library/react";
import { AppProviders } from "@atoms/AppProviders";
import { HeaderWithLogo } from ".";
import { AppProviders } from "@atoms/AppProviders";
describe("atoms::HeaderWithLogo", () => {
it("renders without exploding", () => {

View File

@ -16,8 +16,8 @@
import { Stack } from "@mantine/core";
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import type { LinkProps } from ".";
import { Link } from ".";
import type { LinkProps } from ".";
export default {
title: "atoms/Link",

View File

@ -16,8 +16,8 @@
import { describe, expect, it } from "vitest";
import { render } from "@testing-library/react";
import { AppProviders } from "@atoms/AppProviders";
import { Link } from ".";
import { AppProviders } from "@atoms/AppProviders";
describe("atoms::Link", () => {
it("renders without exploding", () => {

View File

@ -14,10 +14,10 @@
// limitations under the License.
// =============================================================================
import type { LinkProps as RouterLinkProps } from "react-router-dom";
import { Link as RouterLink } from "react-router-dom";
import { BodyText } from "@atoms/Typography";
import type { LinkProps as RouterLinkProps } from "react-router-dom";
import type { ReactText } from "react";
import { BodyText } from "@atoms/Typography";
export interface LinkProps extends RouterLinkProps {
children: ReactText;

View File

@ -14,10 +14,10 @@
// limitations under the License.
// =============================================================================
import type { ModalProps as MModalProps } from "@mantine/core";
import { createStyles, Modal as MModal } from "@mantine/core";
import type { ModalsProviderProps } from "@mantine/modals";
import { ModalsProvider as MModalsProvider } from "@mantine/modals";
import type { ModalProps as MModalProps } from "@mantine/core";
import type { ModalsProviderProps } from "@mantine/modals";
const commonModalProps = {
overlayOpacity: 0.25,

View File

@ -16,8 +16,8 @@
import { describe, expect, it } from "vitest";
import { render } from "@testing-library/react";
import { AppProviders } from "@atoms/AppProviders";
import { MoneroNodeListItem, NodeStatus } from "./MoneroNodeListItem";
import { AppProviders } from "@atoms/AppProviders";
describe("atoms::MoneroNodeListItem", () => {
it("renders without exploding", () => {

View File

@ -15,8 +15,8 @@
// =============================================================================
import { Stack } from "@mantine/core";
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { EyeCheck, EyeOff } from "tabler-icons-react";
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { PasswordInput } from ".";
export default {

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { PasswordInputProps as MPasswordInputProps } from "@mantine/core";
import { createStyles, PasswordInput as MPasswordInput } from "@mantine/core";
import type { PasswordInputProps as MPasswordInputProps } from "@mantine/core";
interface PasswordInputProps extends MPasswordInputProps {
id: string;

View File

@ -17,11 +17,11 @@
const navigateSpy = vi.fn();
const deleteSessionSpy = vi.fn();
import type { SpyInstanceFn } from "vitest";
import { beforeAll, describe, expect, it, vi, afterEach } from "vitest";
import { render, screen } from "@testing-library/react";
import { useAuth } from "@hooks/session/useAuth";
import type { SpyInstanceFn } from "vitest";
import { ProtectedRoute } from "./ProtectedRoute";
import { useAuth } from "@hooks/session/useAuth";
import { ROUTES } from "@constants/routes";
describe("atoms::ProtectedRoute", () => {

View File

@ -14,9 +14,9 @@
// limitations under the License.
// =============================================================================
import type { ReactNode } from "react";
import { useEffect } from "react";
import { useNavigate } from "react-router-dom";
import type { ReactNode } from "react";
import { useAuth } from "@hooks/session/useAuth";
import { deleteSession } from "@utils/session";
import { ROUTES } from "@constants/routes";

View File

@ -15,8 +15,8 @@
// =============================================================================
import { useState, useMemo } from "react";
import type { SelectProps as MSelectProps } from "@mantine/core";
import { createStyles, Select as MSelect } from "@mantine/core";
import type { SelectProps as MSelectProps } from "@mantine/core";
import { ReactComponent as ArrowIcon } from "@assets/arrow-down.svg";
interface SelectProps extends MSelectProps {

View File

@ -16,8 +16,8 @@
import { Stack } from "@mantine/core";
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { SyncStatus as SyncStatusOptions } from "@constants/sync-status";
import { SyncStatus } from ".";
import { SyncStatus as SyncStatusOptions } from "@constants/sync-status";
export default {
title: "molecules/Sync Status",

View File

@ -16,9 +16,9 @@
import { describe, expect, it } from "vitest";
import { render } from "@testing-library/react";
import { SyncStatus } from ".";
import { AppProviders } from "@atoms/AppProviders";
import { SyncStatus as SyncStatusOptions } from "@constants/sync-status";
import { SyncStatus } from ".";
describe("atoms::Sync Status", () => {
it("renders the not synced status by default", () => {

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { TabsProps as MTabsProps } from "@mantine/core";
import { Tabs as MTabs, Tab as MTab, createStyles } from "@mantine/core";
import type { TabsProps as MTabsProps } from "@mantine/core";
export function Tabs(props: MTabsProps) {
const style = useStyles();

View File

@ -16,8 +16,8 @@
import { Stack } from "@mantine/core";
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { ReactComponent as BtcIcon } from "@assets/btc.svg";
import { TextInput } from ".";
import { ReactComponent as BtcIcon } from "@assets/btc.svg";
export default {
title: "atoms/TextInput",

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { TextInputProps as MTextInputProps } from "@mantine/core";
import { createStyles, TextInput as MTextInput } from "@mantine/core";
import type { TextInputProps as MTextInputProps } from "@mantine/core";
interface TextInputProps extends MTextInputProps {
id: string;

View File

@ -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 type { AnchorProps as MAnchorProps } from "@mantine/core";

View File

@ -14,10 +14,10 @@
// limitations under the License.
// =============================================================================
import type { ReactText } from "react";
import { FormattedMessage } from "react-intl";
import type { TitleProps } from "@mantine/core";
import { Title } from "@mantine/core";
import type { ReactText } from "react";
import type { TitleProps } from "@mantine/core";
import type { LangKeys } from "@constants/lang";
interface HeadingProps extends TitleProps {

View File

@ -14,10 +14,10 @@
// limitations under the License.
// =============================================================================
import type { ReactNode, ReactText } from "react";
import { FormattedMessage } from "react-intl";
import type { TextProps as MTextProps } from "@mantine/core";
import { Text as MText, createStyles } from "@mantine/core";
import type { ReactNode, ReactText } from "react";
import type { TextProps as MTextProps } from "@mantine/core";
import type { LangKeys } from "@constants/lang";
type TextProps<TComponent> = MTextProps<TComponent> & {

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { Stack } from "@mantine/core";
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { AddressCard } from "./AddressCard";
export default {

View File

@ -16,11 +16,11 @@
import { FormattedMessage, useIntl } from "react-intl";
import QRCode from "react-qr-code";
import type { OpenConfirmModal } from "@mantine/modals/lib/context";
import { showNotification } from "@mantine/notifications";
import { useModals } from "@mantine/modals";
import { useClipboard } from "@mantine/hooks";
import { Box, createStyles, Group, SimpleGrid, Skeleton } from "@mantine/core";
import type { OpenConfirmModal } from "@mantine/modals/lib/context";
import { DetailItem } from "@atoms/DetailItem";
import { Button } from "@atoms/Buttons";
import { Anchor } from "@atoms/Typography";

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { Stack } from "@mantine/core";
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { AddressCardSkeleton } from "./AddressCard";
export default {

View File

@ -14,11 +14,11 @@
// limitations under the License.
// =============================================================================
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { Text } from "@mantine/core";
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { NodeConnectSwitch } from ".";
import { ReactComponent as CloudIcon } from "@assets/setting-cloud.svg";
import { ReactComponent as ServerIcon } from "@assets/setting-server.svg";
import { NodeConnectSwitch } from ".";
export default {
title: "molecules/NodeConnectSwitch",

View File

@ -16,10 +16,10 @@
import { describe, expect, it } from "vitest";
import { fireEvent, render, screen } from "@testing-library/react";
import { NodeConnectSwitch } from ".";
import { AppProviders } from "@atoms/AppProviders";
import { ReactComponent as CloudIcon } from "@assets/setting-cloud.svg";
import { ReactComponent as ServerIcon } from "@assets/setting-server.svg";
import { NodeConnectSwitch } from ".";
describe("molecules::NodeConnectSwitch", () => {
it("renders without exploding", () => {

View File

@ -14,10 +14,10 @@
// limitations under the License.
// =============================================================================
import type { ReactElement, ReactNode } from "react";
import { cloneElement, Children } from "react";
import { Box } from "@mantine/core";
import { useUncontrolled } from "@mantine/hooks";
import type { ReactElement, ReactNode } from "react";
import { NodeConnectSwitchMethod } from "./NodeConnectSwitchMethod";
import { useTabsStyles } from "./NodeConnectSwitch.style";

View File

@ -14,10 +14,10 @@
// limitations under the License.
// =============================================================================
import { LangKeys } from "@constants/lang";
import { Box } from "@mantine/core";
import { FormattedMessage } from "react-intl";
import { useControlStyles } from "./NodeConnectSwitch.style";
import { LangKeys } from "@constants/lang";
interface SettingTabProps {
active?: boolean;

View File

@ -15,8 +15,8 @@
// =============================================================================
import { createStyles, UnstyledButton } from "@mantine/core";
import { ReactComponent as AddIcon } from "@assets/circle-plus.svg";
import { HEIGHT, WIDTH } from "./_constants";
import { ReactComponent as AddIcon } from "@assets/circle-plus.svg";
interface AddCardProps {
onClick: () => void;

View File

@ -15,12 +15,12 @@
// =============================================================================
import { Stack } from "@mantine/core";
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import {
CryptoCurrencyAccountPayload,
PaymentAccount,
PaymentAccountPayload,
} from "haveno-ts";
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { AddPaymentMethodButton, PaymentMethodCard } from ".";
export default {

View File

@ -21,8 +21,8 @@ import {
PaymentAccount,
PaymentAccountPayload,
} from "haveno-ts";
import { AppProviders } from "@atoms/AppProviders";
import { PaymentMethodCard } from ".";
import { AppProviders } from "@atoms/AppProviders";
describe("molecules::PaymentMethodCard", () => {
it("renders without exploding", () => {

View File

@ -24,8 +24,8 @@ import {
UnstyledButton,
} from "@mantine/core";
import type { PaymentAccount } from "haveno-ts";
import { ReactComponent as MenuIcon } from "@assets/ellipsis.svg";
import { HEIGHT, WIDTH } from "./_constants";
import { ReactComponent as MenuIcon } from "@assets/ellipsis.svg";
import { BodyText } from "@atoms/Typography";
import {
getPaymentAccountLogo,

View File

@ -15,10 +15,10 @@
// =============================================================================
import type { FC } from "react";
import type { SupportedCurrencies } from "./_types";
import { ReactComponent as BtcLogo } from "@assets/btc.svg";
import { ReactComponent as EthLogo } from "@assets/eth.svg";
import { ReactComponent as EurLogo } from "@assets/eur.svg";
import type { SupportedCurrencies } from "./_types";
export const WIDTH = "17rem";
export const HEIGHT = "7.25rem";

View File

@ -16,8 +16,8 @@
import { describe, expect, it } from "vitest";
import { render } from "@testing-library/react";
import { AppProviders } from "@atoms/AppProviders";
import { SecondarySidebar, SecondarySidebarItem } from "./";
import { AppProviders } from "@atoms/AppProviders";
describe("molecules::SecondarySidebar", () => {
it("renders without exploding", () => {

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import { useNavLinkActive } from "@hooks/misc/useNavLinkActive";
import { UnstyledButton, Group, Text, createStyles } from "@mantine/core";
import { useNavLinkActive } from "@hooks/misc/useNavLinkActive";
interface SecondarySidebarItemProps {
isActive?: boolean;

View File

@ -20,10 +20,10 @@ import {
getExpandedRowModel,
} from "@tanstack/react-table";
import { Table as MTable } from "@mantine/core";
import type { TableProps } from "./_types";
import { TableProvider } from "./use-table-context";
import { TableHeader } from "./TableHeader";
import { TableBody } from "./TableBody";
import type { TableProps } from "./_types";
export function Table(props: TableProps) {
const { table, columns, data, tableWrap } = props;

View File

@ -16,8 +16,8 @@
import { beforeAll, describe, expect, it, vi } from "vitest";
import { render, waitForElementToBeRemoved } from "@testing-library/react";
import { AppProviders } from "@atoms/AppProviders";
import { WalletBalance } from ".";
import { AppProviders } from "@atoms/AppProviders";
describe("molecules::WalletBalance", () => {
beforeAll(() => {

View File

@ -16,8 +16,8 @@
import type { ComponentStory, ComponentMeta } from "@storybook/react";
import { WalletTransactions } from "./WalletTransactions";
import type { TWalletTransaction } from "./_types";
import { WalletTransactionType } from "./_types";
import type { TWalletTransaction } from "./_types";
export default {
title: "organisms/WalletTransactions",

View File

@ -15,7 +15,6 @@
// =============================================================================
import { createTable } from "@tanstack/react-table";
import { Table } from "@molecules/Table";
import { createStyles } from "@mantine/core";
import {
WalletTransactionnSignCell,
@ -23,6 +22,7 @@ import {
} from "./WalletTransactionsCells";
import { WalletTransactionRowExpanded } from "./WalletTransactionsRowExpanded";
import type { TWalletTransaction } from "./_types";
import { Table } from "@molecules/Table";
const table = createTable().setRowType<TWalletTransaction>();

View File

@ -16,13 +16,13 @@
import { FormattedDate, FormattedTime, useIntl } from "react-intl";
import { Box, Group, Stack, Text, useMantineTheme } from "@mantine/core";
import { WalletTransactionType } from "./_types";
import type { TWalletTransaction } from "./_types";
import { ReactComponent as ArrowNorth } from "@assets/arrow-north.svg";
import { ReactComponent as ArrowWest } from "@assets/arrow-west.svg";
import { LangKeys } from "@constants/lang";
import { Currency } from "@atoms/Currency";
import { CircleIcon } from "@atoms/CircleIcon/CircleIcon";
import type { TWalletTransaction } from "./_types";
import { WalletTransactionType } from "./_types";
export function WalletTransactionnSignCell({
row,

View File

@ -16,8 +16,8 @@
import { describe, expect, it } from "vitest";
import { render } from "@testing-library/react";
import { AppProviders } from "@atoms/AppProviders";
import { AccountSidebar } from "./AccountSidebar";
import { AppProviders } from "@atoms/AppProviders";
describe("molecules::AccountSidebar", () => {
it("renders without exploding", () => {

View File

@ -17,13 +17,13 @@
import { createStyles, Box, Title } from "@mantine/core";
import { FormattedMessage } from "react-intl";
import { useNavigate } from "react-router-dom";
import { WIDTH } from "./_constants";
import { useGetAccountSidebarMenu } from "./_hooks";
import {
SecondarySidebar,
SecondarySidebarItem,
} from "@molecules/SecondarySidebar";
import { LangKeys } from "@constants/lang";
import { WIDTH } from "./_constants";
import { useGetAccountSidebarMenu } from "./_hooks";
export function AccountSidebar() {
const { classes } = useStyles();

View File

@ -14,10 +14,10 @@
// limitations under the License.
// =============================================================================
import { LangKeys } from "@constants/lang";
import { ROUTES } from "@constants/routes";
import React from "react";
import { useIntl } from "react-intl";
import { LangKeys } from "@constants/lang";
import { ROUTES } from "@constants/routes";
export interface AccountSidebarItem {
label: string;

View File

@ -18,12 +18,12 @@ import { FormattedMessage } from "react-intl";
import { Stack, Box, Group } from "@mantine/core";
import { useForm, joiResolver } from "@mantine/form";
import { showNotification } from "@mantine/notifications";
import { useAccountSecurityFormSchema } from "./_hooks";
import type { ChangePasswordFormValues } from "./_types";
import { PasswordInput } from "@atoms/PasswordInput";
import { LangKeys } from "@constants/lang";
import { Button } from "@atoms/Buttons";
import { useChangePassword } from "@hooks/storage/useChangePassword";
import { useAccountSecurityFormSchema } from "./_hooks";
import type { ChangePasswordFormValues } from "./_types";
export function ChangePassword() {
const accountSecurityFormSchema = useAccountSecurityFormSchema();

View File

@ -14,10 +14,10 @@
// limitations under the License.
// =============================================================================
import { LangKeys } from "@constants/lang";
import Joi from "joi";
import { useIntl } from "react-intl";
import type { ChangePasswordFormValues } from "./_types";
import { LangKeys } from "@constants/lang";
const MIN_PASSWORD_CHARS = 8;

View File

@ -14,12 +14,12 @@
// limitations under the License.
// =============================================================================
import type { FC } from "react";
import { useIntl } from "react-intl";
import type { FC } from "react";
import { MyWalletMeneroBalanceSkeleton } from "./MyWalletMeneroBalanceSkeleton";
import { LangKeys } from "@constants/lang";
import { useBalances } from "@hooks/haveno/useBalances";
import { MoneroBalance } from "@organisms/MoneroBalance";
import { MyWalletMeneroBalanceSkeleton } from "./MyWalletMeneroBalanceSkeleton";
import { Currency } from "@atoms/Currency";
export function MyWalletMoneroBalanceContent() {

View File

@ -16,8 +16,8 @@
import { describe, expect, it, vi, beforeAll } from "vitest";
import { render, screen } from "@testing-library/react";
import { AppProviders } from "@atoms/AppProviders";
import { MyWalletPrimaryAddress } from "./MyWalletPrimaryAddress";
import { AppProviders } from "@atoms/AppProviders";
describe("organisms::MyWalletPrimaryAddress", () => {
beforeAll(() => {

View File

@ -17,11 +17,11 @@
import { useState } from "react";
import { FormattedMessage } from "react-intl";
import { Box, Button, Group, Stack, Text } from "@mantine/core";
import { getActiveReceiveAddresses, saveReceiveAddresss } from "./_utils";
import { LangKeys } from "@constants/lang";
import { Heading } from "@atoms/Typography";
import { AddressCard } from "@molecules/AddressCard/AddressCard";
import { useSetXmrNewSubaddress } from "@hooks/haveno/useSetXmrNewSubaddress";
import { getActiveReceiveAddresses, saveReceiveAddresss } from "./_utils";
export function MyWalletReceive() {
const { mutateAsync: setXmrNewSubaddress, isLoading: isSetXmrLoading } =

View File

@ -18,9 +18,9 @@ import { joiResolver, useForm } from "@mantine/form";
import { Group, SimpleGrid, Stack, Text } from "@mantine/core";
import { FormattedMessage, useIntl } from "react-intl";
import { useModals } from "@mantine/modals";
import { TextInput } from "@atoms/TextInput";
import type { MyWalletSendFormValues } from "./_hooks";
import { useMyWalletSendFormValidation } from "./_hooks";
import type { MyWalletSendFormValues } from "./_hooks";
import { TextInput } from "@atoms/TextInput";
import { LangKeys } from "@constants/lang";
import { Button } from "@atoms/Buttons";
import { useSetXmrSend } from "@hooks/haveno/useSetXmrSend";

View File

@ -16,8 +16,8 @@
import { describe, expect, it, vi, beforeAll } from "vitest";
import { render, screen } from "@testing-library/react";
import { AppProviders } from "@atoms/AppProviders";
import { MyWalletTransactions } from "./MyWalletTransactions";
import { AppProviders } from "@atoms/AppProviders";
describe("organisms::MyWalletMoneroBalance", () => {
beforeAll(() => {

View File

@ -14,12 +14,12 @@
// limitations under the License.
// =============================================================================
import type { FC } from "react";
import { useMemo } from "react";
import { Group, Loader } from "@mantine/core";
import type { FC } from "react";
import { transfromXmrTxs } from "./_utils";
import { useXmrTxs } from "@hooks/haveno/useXmrTxs";
import { WalletTransactions } from "@molecules/WalletTransactions";
import { transfromXmrTxs } from "./_utils";
export function MyWalletTransactionsTable() {
const { data: xmrTxs } = useXmrTxs();

View File

@ -16,8 +16,8 @@
import { isEmpty } from "lodash";
import type { XmrTx } from "haveno-ts";
import type { TWalletTransaction } from "@molecules/WalletTransactions/_types";
import { WalletTransactionType } from "@molecules/WalletTransactions/_types";
import type { TWalletTransaction } from "@molecules/WalletTransactions/_types";
export const transfromXmrTxs = (
xmrTxs: Array<XmrTx.AsObject>

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { FormEvent } from "react";
import { Stack, Space, Group } from "@mantine/core";
import type { FormEvent } from "react";
import { BodyText, Heading } from "@atoms/Typography";
import { Button, TextButton } from "@atoms/Buttons";
import { Select } from "@atoms/Select";

View File

@ -17,8 +17,8 @@
import { describe, expect, it, vi } from "vitest";
import { fireEvent, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { AppProviders } from "@atoms/AppProviders";
import { SetPassword } from ".";
import { AppProviders } from "@atoms/AppProviders";
describe("organisms::SetPassword", () => {
it("renders without exploding", () => {

View File

@ -16,9 +16,9 @@
import { beforeAll, describe, expect, it, vi } from "vitest";
import { render } from "@testing-library/react";
import { Sidebar } from ".";
import { AppProviders } from "@atoms/AppProviders";
import { SyncStatus } from "@constants/sync-status";
import { Sidebar } from ".";
describe("molecules::Sidebar", () => {
beforeAll(() => {

View File

@ -15,12 +15,12 @@
// =============================================================================
import { Box, createStyles, Navbar, Stack } from "@mantine/core";
import { NAV_LINKS, WIDTH } from "./_constants";
import { NavLink } from "./_NavLink";
import { WalletBalance } from "@molecules/WalletBalance";
import { ReactComponent as Logo } from "@assets/logo-icon.svg";
import { SyncStatus } from "@atoms/SyncStatus";
import { useSyncStatus } from "@hooks/haveno/useSyncStatus";
import { NAV_LINKS, WIDTH } from "./_constants";
import { NavLink } from "./_NavLink";
export function Sidebar() {
const { classes } = useStyles();

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { ReactNode } from "react";
import { UnstyledButton, Group, Text, createStyles } from "@mantine/core";
import type { ReactNode } from "react";
interface NavLinkProps {
icon: ReactNode;

View File

@ -16,9 +16,9 @@
import { beforeAll, describe, expect, it, vi } from "vitest";
import { render, waitForElementToBeRemoved } from "@testing-library/react";
import { AppProviders } from "@atoms/AppProviders";
import { WalletManagement } from ".";
import { SeedPhrase } from "./SeedPhrase";
import { WalletManagement } from ".";
import { AppProviders } from "@atoms/AppProviders";
describe("molecules::WalletManagement", () => {
beforeAll(() => {

View File

@ -19,11 +19,11 @@ import { FormattedMessage } from "react-intl";
import { useForm } from "@mantine/hooks";
import { Group, Space, Stack } from "@mantine/core";
import { showNotification } from "@mantine/notifications";
import { SeedPhrase } from "./SeedPhrase";
import { Button } from "@atoms/Buttons";
import { PasswordInput } from "@atoms/PasswordInput";
import { useValidatePassword } from "@hooks/haveno/useValidatePassword";
import { LangKeys } from "@constants/lang";
import { SeedPhrase } from "./SeedPhrase";
export function WalletManagement() {
const [isRevealed, setRevealed] = useState(false);

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { FC } from "react";
import { Container, Stack } from "@mantine/core";
import type { FC } from "react";
import { HeaderWithLogo } from "@atoms/Header";
interface CenteredLayoutProps {

View File

@ -14,8 +14,8 @@
// limitations under the License.
// =============================================================================
import type { FC } from "react";
import { Box, createStyles, Group } from "@mantine/core";
import type { FC } from "react";
import { Sidebar } from "@organisms/Sidebar";
export const NavbarLayout: FC = (props) => {

View File

@ -14,10 +14,10 @@
// limitations under the License.
// =============================================================================
import { PaymentMethodIds } from "./payment-methods";
import { ReactComponent as BtcLogo } from "@assets/btc.svg";
import { ReactComponent as EthLogo } from "@assets/eth.svg";
import { ReactComponent as EurLogo } from "@assets/eur.svg";
import { PaymentMethodIds } from "./payment-methods";
export type SupportedFiat = "USD" | "EUR" | "GBP";

View File

@ -16,8 +16,8 @@
import { useMutation, useQueryClient } from "react-query";
import { UrlConnection } from "haveno-ts";
import { QueryKeys } from "@constants/query-keys";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
interface Variables {
address: string;

View File

@ -15,8 +15,8 @@
// =============================================================================
import { useQuery } from "react-query";
import { QueryKeys } from "@constants/query-keys";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
export function useAddress() {
const client = useHavenoClient();

View File

@ -15,8 +15,8 @@
// =============================================================================
import { useQuery } from "react-query";
import { QueryKeys } from "@constants/query-keys";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
interface BalanceInfo {
balance: number;

View File

@ -15,8 +15,8 @@
// =============================================================================
import { useQuery } from "react-query";
import { QueryKeys } from "@constants/query-keys";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
export function useGetMoneroConnection() {
const client = useHavenoClient();

View File

@ -15,8 +15,8 @@
// =============================================================================
import { useQuery } from "react-query";
import { QueryKeys } from "@constants/query-keys";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
export function useHavenoVersion() {
const client = useHavenoClient();

View File

@ -15,8 +15,8 @@
// =============================================================================
import { useQuery } from "react-query";
import { QueryKeys } from "@constants/query-keys";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
export function useIsMoneroNodeRunning() {
const client = useHavenoClient();

View File

@ -16,8 +16,8 @@
import { useQuery } from "react-query";
import type { UrlConnection } from "haveno-ts";
import { QueryKeys } from "@constants/query-keys";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
export function useMoneroConnections() {
const client = useHavenoClient();

View File

@ -16,8 +16,8 @@
import { useQuery } from "react-query";
import type { MoneroNodeSettings } from "haveno-ts";
import { QueryKeys } from "@constants/query-keys";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
export function useMoneroNodeSettings() {
const client = useHavenoClient();

View File

@ -16,8 +16,8 @@
import { useQuery } from "react-query";
import type { PaymentAccount } from "haveno-ts";
import { QueryKeys } from "@constants/query-keys";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
export function usePaymentAccounts() {
const client = useHavenoClient();

View File

@ -16,8 +16,8 @@
import { useQuery } from "react-query";
import type { MarketPriceInfo } from "haveno-ts";
import { QueryKeys } from "@constants/query-keys";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
export function usePrices() {
const client = useHavenoClient();

View File

@ -16,9 +16,9 @@
import { useMutation, useQueryClient } from "react-query";
import { MoneroNodeSettings } from "haveno-ts";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
import { useSaveRemoteNode } from "@hooks/storage/useSaveRemoteNode";
import { useHavenoClient } from "./useHavenoClient";
interface Variables {
blockchainPath: string;

View File

@ -15,9 +15,9 @@
// =============================================================================
import { useMutation, useQueryClient } from "react-query";
import { useHavenoClient } from "./useHavenoClient";
import { useSaveRemoteNode } from "@hooks/storage/useSaveRemoteNode";
import { QueryKeys } from "@constants/query-keys";
import { useHavenoClient } from "./useHavenoClient";
interface Variables {
uri: string;

View File

@ -17,8 +17,8 @@
import { useMutation, useQueryClient } from "react-query";
import { XmrDestination } from "haveno-ts";
import { showNotification } from "@mantine/notifications";
import { QueryKeys } from "@constants/query-keys";
import { useHavenoClient } from "./useHavenoClient";
import { QueryKeys } from "@constants/query-keys";
interface SetXmrSendVariables {
address: string;

Some files were not shown because too many files have changed in this diff Show More