Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Rewrite trader performance sync #543

Merged
merged 5 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"message": "Don't declare enums"
}
],
"sort-imports": "error",
"import/order": "error",
"react/jsx-closing-bracket-location": "error",
"react/jsx-max-props-per-line": "error",
"react/jsx-indent-props": ["error", 2],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run basic
- run: npm run shared
- run: npm run tsc
- run: npm run test
2 changes: 1 addition & 1 deletion client/src/actions/general.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as general from './general'
import * as requestAdapter from 'adapters/request'
import { act, waitFor } from 'test.utils'
import { globalSlice } from 'stores/global'
import { store } from 'stores'
import * as general from './general'

jest.mock('adapters/request', () => {
const actual = jest.requireActual('adapters/request')
Expand Down
2 changes: 1 addition & 1 deletion client/src/actions/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as interfaces from '@shared/interfaces'
import * as localeTool from 'tools/locale'
import * as requestAdapter from 'adapters/request'
import * as routerEnum from 'enums/router'
import { logout, refreshAccessToken } from './general'
import { createAsyncThunk } from '@reduxjs/toolkit'
import { logout, refreshAccessToken } from './general'

export const fetchUserEntity = createAsyncThunk(
'user/fetchUserEntity',
Expand Down
2 changes: 1 addition & 1 deletion client/src/adapters/request.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as localeTool from 'tools/locale'
import * as request from './request'
import axios from 'axios'
import * as request from './request'

describe('#setAuthToken', () => {
test('could set auth', () => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/Client.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as routerEnum from 'enums/router'
import { act, render, screen } from 'test.utils'
import Client from './Client'
import { createMemoryHistory } from 'history'
import { globalSlice } from 'stores/global'
import { store } from 'stores'
import Client from './Client'

jest.mock('react-select', () => '')

Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/Client.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as selectors from 'selectors'
import Router from './Router'
import { Spinner } from 'flowbite-react'
import { useSelector } from 'react-redux'
import Router from './Router'

const Client = () => {
const { isLoading } = useSelector(selectors.selectGlobal())
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/accounts/Activation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import * as routerTool from 'tools/router'
import * as usePublicGuard from 'hooks/usePublicGuard'
import * as userAction from 'actions/user'
import { Route, Routes } from 'react-router-dom'
import Activation from './Activation'
import { createAsyncThunk } from '@reduxjs/toolkit'
import { createMemoryHistory } from 'history'
import { render } from 'test.utils'
import Activation from './Activation'

jest.mock('hooks/usePublicGuard', () => {
const actual = jest.requireActual('hooks/usePublicGuard')
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/accounts/Forgot.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as routerTool from 'tools/router'
import * as usePublicGuard from 'hooks/usePublicGuard'
import * as userAction from 'actions/user'
import { fireEvent, render, screen } from 'test.utils'
import Forgot from './Forgot'
import { createAsyncThunk } from '@reduxjs/toolkit'
import { createMemoryHistory } from 'history'
import Forgot from './Forgot'

jest.mock('hooks/usePublicGuard', () => {
const actual = jest.requireActual('hooks/usePublicGuard')
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/accounts/Forgot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import * as localeTool from 'tools/locale'
import * as routerTool from 'tools/router'
import { Button, TextInput } from 'flowbite-react'
import { ChangeEvent, FormEvent, useState } from 'react'
import GoToButton from './elements/GoToButton'
import RequiredLabel from 'containers/elements/RequiredLabel'
import { useDispatch } from 'react-redux'
import { useNavigate } from 'react-router-dom'
import usePublicGuard from 'hooks/usePublicGuard'
import GoToButton from './elements/GoToButton'

const Forgot = () => {
usePublicGuard()
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/accounts/Reset.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import * as usePublicGuard from 'hooks/usePublicGuard'
import * as userAction from 'actions/user'
import { Route, Routes } from 'react-router-dom'
import { fireEvent, render, screen } from 'test.utils'
import Reset from './Reset'
import { createAsyncThunk } from '@reduxjs/toolkit'
import { createMemoryHistory } from 'history'
import { store } from 'stores'
import Reset from './Reset'

jest.mock('hooks/usePublicGuard', () => {
const actual = jest.requireActual('hooks/usePublicGuard')
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/accounts/Reset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import * as routerTool from 'tools/router'
import { Button, TextInput } from 'flowbite-react'
import { ChangeEvent, FormEvent, useState } from 'react'
import { useNavigate, useParams } from 'react-router-dom'
import GoToButton from './elements/GoToButton'
import RequiredLabel from 'containers/elements/RequiredLabel'
import { globalSlice } from 'stores/global'
import { useDispatch } from 'react-redux'
import usePasswordValidator from 'hooks/usePasswordValidator'
import usePublicGuard from 'hooks/usePublicGuard'
import GoToButton from './elements/GoToButton'

const Reset = () => {
usePublicGuard()
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/accounts/Setting.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as generalAction from 'actions/general'
import * as selectors from 'selectors'
import { act, fireEvent, render, screen, waitFor } from 'test.utils'
import { instance, mock } from 'ts-mockito'
import Setting from './Setting'
import { UserState } from 'stores/user'
import axios from 'axios'
import Setting from './Setting'

jest.mock('actions/general', () => {
const actual = jest.requireActual('actions/general')
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/accounts/SignIn.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import * as routerTool from 'tools/router'
import * as usePublicGuard from 'hooks/usePublicGuard'
import * as userAction from 'actions/user'
import { fireEvent, render, screen } from 'test.utils'
import SignIn from './SignIn'
import { createAsyncThunk } from '@reduxjs/toolkit'
import { createMemoryHistory } from 'history'
import { store } from 'stores'
import SignIn from './SignIn'

jest.mock('hooks/usePublicGuard', () => {
const actual = jest.requireActual('hooks/usePublicGuard')
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/accounts/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import * as localeTool from 'tools/locale'
import * as routerTool from 'tools/router'
import { Button, Checkbox, Label, TextInput } from 'flowbite-react'
import { ChangeEvent, FormEvent, useState } from 'react'
import GoToButton from './elements/GoToButton'
import RequiredLabel from 'containers/elements/RequiredLabel'
import { globalSlice } from 'stores/global'
import { useDispatch } from 'react-redux'
import { useNavigate } from 'react-router-dom'
import usePasswordValidator from 'hooks/usePasswordValidator'
import usePublicGuard from 'hooks/usePublicGuard'
import GoToButton from './elements/GoToButton'

const SignIn = () => {
usePublicGuard()
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/accounts/SignUp.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import * as routerTool from 'tools/router'
import * as usePublicGuard from 'hooks/usePublicGuard'
import * as userAction from 'actions/user'
import { act, fireEvent, render, screen } from 'test.utils'
import SignUp from './SignUp'
import axios from 'axios'
import { contentSlice } from 'stores/content'
import { createAsyncThunk } from '@reduxjs/toolkit'
import { createMemoryHistory } from 'history'
import { globalSlice } from 'stores/global'
import { store } from 'stores'
import SignUp from './SignUp'

jest.mock('hooks/usePublicGuard', () => {
const actual = jest.requireActual('hooks/usePublicGuard')
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/accounts/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import * as selectors from 'selectors'
import { Button, Checkbox, Label, TextInput, Textarea } from 'flowbite-react'
import { ChangeEvent, FormEvent, useEffect, useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import GoToButton from './elements/GoToButton'
import RequiredLabel from 'containers/elements/RequiredLabel'
import { globalSlice } from 'stores/global'
import { useNavigate } from 'react-router-dom'
import usePasswordValidator from 'hooks/usePasswordValidator'
import usePublicGuard from 'hooks/usePublicGuard'
import GoToButton from './elements/GoToButton'

const SignUp = () => {
usePublicGuard()
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/accounts/blocks/PaymentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import * as helpers from '@shared/helpers'
import * as localeTool from 'tools/locale'
import { Button, Card, Label, Modal, Radio, Select } from 'flowbite-react'
import { ChangeEvent, useEffect, useMemo, useState } from 'react'
import SubscribeButton from './SubscribeButton'
import classNames from 'classnames'
import SubscribeButton from './SubscribeButton'

const PaymentModal = ({
userType,
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/general/Home.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as routerEnum from 'enums/router'
import * as routerTool from 'tools/router'
import { Route, Routes } from 'react-router-dom'
import { fireEvent, render, screen } from 'test.utils'
import Home from './Home'
import { createMemoryHistory } from 'history'
import Home from './Home'

describe('#Home', () => {
test('could redirect correctly', () => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/general/Privacy.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as constants from '@shared/constants'
import * as requestAdapter from 'adapters/request'
import { render, screen, waitFor } from 'test.utils'
import Privacy from './Privacy'
import { contentSlice } from 'stores/content'
import { store } from 'stores'
import Privacy from './Privacy'

jest.mock('adapters/request', () => {
const actual = jest.requireActual('adapters/request')
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/general/Terms.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as constants from '@shared/constants'
import * as requestAdapter from 'adapters/request'
import { render, screen, waitFor } from 'test.utils'
import Terms from './Terms'
import { contentSlice } from 'stores/content'
import { store } from 'stores'
import Terms from './Terms'

jest.mock('adapters/request', () => {
const actual = jest.requireActual('adapters/request')
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/layouts/blocks/Footer.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as localeTool from 'tools/locale'
import * as routerTool from 'tools/router'
import { fireEvent, render, screen } from 'test.utils'
import Footer from './Footer'
import { createMemoryHistory } from 'history'
import Footer from './Footer'

describe('#Footer', () => {
test('could render Footer', () => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/layouts/blocks/Header.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as localeTool from 'tools/locale'
import * as routerTool from 'tools/router'
import { fireEvent, render, screen } from 'test.utils'
import Header from './Header'
import { createMemoryHistory } from 'history'
import { globalSlice } from 'stores/global'
import { store } from 'stores'
import Header from './Header'

afterEach(() => {
jest.clearAllMocks()
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/layouts/elements/HeaderLink.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fireEvent, render, screen } from 'test.utils'
import HeaderLink from './HeaderLink'
import { StarIcon } from '@heroicons/react/24/solid'
import { createMemoryHistory } from 'history'
import HeaderLink from './HeaderLink'

describe('#HeaderLink', () => {
test('could render Footer', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import * as selectors from 'selectors'
import { UserAccess, UserState } from 'stores/user'
import { act, fireEvent, render, screen } from 'test.utils'
import { instance, mock } from 'ts-mockito'
import BehaviorDetail from './BehaviorDetail'
import { GlobalState } from 'stores/global'
import axios from 'axios'
import BehaviorDetail from './BehaviorDetail'

afterEach(() => {
jest.clearAllMocks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as parseTool from 'tools/parse'
import * as selectors from 'selectors'
import { fireEvent, render, screen } from 'test.utils'
import { instance, mock } from 'ts-mockito'
import BehaviorList from './BehaviorList'
import { GlobalState } from 'stores/global'
import BehaviorList from './BehaviorList'

const navigate = jest.fn()
jest.mock('react-router-dom', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as interfaces from '@shared/interfaces'
import * as localeTool from 'tools/locale'
import * as selectors from 'selectors'
import { fireEvent, render, screen } from 'test.utils'
import ComboProfiles from './ComboProfiles'
import { mock } from 'ts-mockito'
import ComboProfiles from './ComboProfiles'

jest.mock('selectors', () => {
const actual = jest.requireActual('selectors')
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/traders/blocks/ComboProfiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as interfaces from '@shared/interfaces'
import * as localeTool from 'tools/locale'
import * as parseTool from 'tools/parse'
import TraderProfileCard from 'containers/traders/blocks/TraderProfileCard'
import WeightChart from '../elements/WeightChart'
import { useState } from 'react'
import WeightChart from '../elements/WeightChart'

interface ProfileWithEnv {
profile?: interfaces.response.TraderProfile;
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/traders/blocks/EachTops.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as localeTool from 'tools/locale'
import * as routerTool from 'tools/router'
import * as selectors from 'selectors'
import { Alert } from 'flowbite-react'
import TraderProfileCard from './TraderProfileCard'
import { useNavigate } from 'react-router-dom'
import { useSelector } from 'react-redux'
import TraderProfileCard from './TraderProfileCard'

const sectionClass = 'w-full m-4 max-sm:w-80'
const titleClass = 'font-semibold mb-4'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import * as selectors from 'selectors'
import { UserState, userSlice } from 'stores/user'
import { fireEvent, render, screen, waitFor } from 'test.utils'
import { instance, mock } from 'ts-mockito'
import TraderComboCard from './TraderComboCard'
import axios from 'axios'
import { store } from 'stores'
import { traderComboSlice } from 'stores/traderCombo'
import TraderComboCard from './TraderComboCard'

jest.mock('selectors', () => {
const actual = jest.requireActual('selectors')
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/traders/blocks/TraderComboCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import * as routerTool from 'tools/router'
import * as selectors from 'selectors'
import { useDispatch, useSelector } from 'react-redux'
import { Card } from 'flowbite-react'
import WatchButton from '../elements/WatchButton'
import classNames from 'classnames'
import { useNavigate } from 'react-router-dom'
import WatchButton from '../elements/WatchButton'

const TraderComboCard = ({
traderCombo,
Expand Down
Loading