diff --git a/src/Managing.WebApp/.env b/src/Managing.WebApp/.env deleted file mode 100644 index a673da2..0000000 --- a/src/Managing.WebApp/.env +++ /dev/null @@ -1,6 +0,0 @@ -VITE_API_URL_LOCAL=https://localhost:5001 -VITE_API_URL_SERVER=https://localhost -VITE_WORKER_URL_LOCAL=https://localhost:5002 -VITE_WORKER_URL_SERVER=https://localhost:444 -ALCHEMY_ID=Bao7OirVe4bmYiDbPh0l8cs5gYb5D4_9 -WALLET_CONNECT_PROJECT_ID=363bf09c10fec2293b21ee199b2ce8d5 \ No newline at end of file diff --git a/src/Managing.WebApp/.eslintignore b/src/Managing.WebApp/.eslintignore deleted file mode 100644 index f06235c..0000000 --- a/src/Managing.WebApp/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -dist diff --git a/src/Managing.WebApp/.eslintrc b/src/Managing.WebApp/.eslintrc deleted file mode 100644 index 2d7c78b..0000000 --- a/src/Managing.WebApp/.eslintrc +++ /dev/null @@ -1,98 +0,0 @@ -{ - "root": true, - "extends": [ - "plugin:@typescript-eslint/recommended", - "plugin:jsx-a11y/recommended" - ], - "parser": "@typescript-eslint/parser", - "plugins": [ - "jsx-a11y", - "import", - "sort-keys-fix", - "react-hooks", - "@typescript-eslint", - "prettier" - ], - "env": { - "browser": true, - "node": true, - "es6": true, - "jest": true - }, - "globals": { - "JSX": "readonly" - }, - "settings": { - "react": { - "version": "detect" - }, - "import/parsers": { - "@typescript-eslint/parser": [".ts", ".tsx"] - }, - "import/resolver": { - "node": { - "extensions": [".js", ".jsx", ".ts", ".tsx"] - }, - "typescript": { - "alwaysTryTypes": true, - // always try to resolve types under `@types` directory even it doesn't contain any source code, like `@types/unist` - "project": ["tsconfig.json"] - } - } - }, - "rules": { - "no-alert": "error", - "no-console": "error", - "react-hooks/rules-of-hooks": "error", - "prettier/prettier": [ - "warn", - {}, - { - "properties": { - "usePrettierrc": true - } - } - ], - "import/order": [ - "warn", - { - "groups": [ - "builtin", - "external", - "internal", - "parent", - "sibling", - "index", - "object" - ], - "newlines-between": "always", - "alphabetize": { - "order": "asc", - "caseInsensitive": true - } - } - ], - "import/named": "error", - "import/default": "error", - "import/export": "error", - "import/no-named-as-default": "warn", - "import/no-duplicates": "error", - "sort-keys-fix/sort-keys-fix": "warn", - "@import/no-named-as-default-member": "off", - "@typescript-eslint/consistent-type-imports": "warn", - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/ban-types": "off", - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/no-empty-function": "off" - }, - "overrides": [ - { - "files": ["*.js"], - "rules": { - "@typescript-eslint/explicit-module-boundary-types": ["off"], - "@typescript-eslint/no-var-requires": ["off"] - } - } - ] -} diff --git a/src/Managing.WebApp/.gitattributes b/src/Managing.WebApp/.gitattributes deleted file mode 100644 index 2dd6f4d..0000000 --- a/src/Managing.WebApp/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -.jest/* linguist-vendored -mocks/* linguist-vendored -mockServiceWorker.js linguist-vendored diff --git a/src/Managing.WebApp/.github/workflows/build.yml b/src/Managing.WebApp/.github/workflows/build.yml deleted file mode 100644 index cf9565c..0000000 --- a/src/Managing.WebApp/.github/workflows/build.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Build -on: - push: - branches: - - main - pull_request: - branches: - - main -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2-beta - with: - node-version: '18.1.0' - - run: yarn install - - run: yarn build diff --git a/src/Managing.WebApp/.github/workflows/lint.yml b/src/Managing.WebApp/.github/workflows/lint.yml deleted file mode 100644 index d84f5b7..0000000 --- a/src/Managing.WebApp/.github/workflows/lint.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Lint -on: - push: - branches: - - main - pull_request: - branches: - - main -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2-beta - with: - node-version: '18.1.0' - - run: yarn install - - run: yarn lint diff --git a/src/Managing.WebApp/.github/workflows/test.yml b/src/Managing.WebApp/.github/workflows/test.yml deleted file mode 100644 index c409935..0000000 --- a/src/Managing.WebApp/.github/workflows/test.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Test -on: - push: - branches: - - main - pull_request: - branches: - - main -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2-beta - with: - node-version: '18.1.0' - - run: yarn install - - run: yarn test diff --git a/src/Managing.WebApp/.github/workflows/typecheck.yml b/src/Managing.WebApp/.github/workflows/typecheck.yml deleted file mode 100644 index eeb1640..0000000 --- a/src/Managing.WebApp/.github/workflows/typecheck.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Typecheck -on: - push: - branches: - - main - pull_request: - branches: - - main -jobs: - typecheck: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2-beta - with: - node-version: '18.1.0' - - run: yarn install - - run: yarn typecheck diff --git a/src/Managing.WebApp/.gitignore b/src/Managing.WebApp/.gitignore deleted file mode 100644 index d451ff1..0000000 --- a/src/Managing.WebApp/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -.DS_Store -dist -dist-ssr -*.local diff --git a/src/Managing.WebApp/.prettierignore b/src/Managing.WebApp/.prettierignore deleted file mode 100644 index 4969764..0000000 --- a/src/Managing.WebApp/.prettierignore +++ /dev/null @@ -1,5 +0,0 @@ -.git -node_modules -.eslintignore -.gitignore -LICENSE diff --git a/src/Managing.WebApp/.prettierrc b/src/Managing.WebApp/.prettierrc deleted file mode 100644 index fd496a8..0000000 --- a/src/Managing.WebApp/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "singleQuote": true, - "semi": false -} diff --git a/src/Managing.WebApp/Dockerfile b/src/Managing.WebApp/Dockerfile deleted file mode 100644 index 9301ac7..0000000 --- a/src/Managing.WebApp/Dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -# Use an official Node.js runtime as a parent image -FROM node:18 - -# Set the working directory inside the container -WORKDIR /app - - -# Install xsel for clipboard access (useful for some applications) -RUN apt-get update && apt-get install -y xsel - -# Copy only package.json and package-lock.json (or yarn.lock) initially -# This takes advantage of cached Docker layers -COPY package*.json ./ - -# Install dependencies -# npm ci is used instead of npm install when you want a clean, exact installation -#RUN npm ci --verbose -# Try to install dependencies with a retry mechanism -RUN for i in 1 2 3; do npm ci --verbose && break || sleep 15; done - -# Copy the rest of your application code -COPY . . - -# Set necessary environment variables (if they are not secrets) -ENV NODE_ENV=development -ENV VITE_API_URL_LOCAL=https://localhost:5001 -ENV VITE_API_URL_SERVER=https://localhost - -# Expose port 3000 for the application -EXPOSE 3000 - -# Install global dependencies if absolutely necessary (generally not recommended to do globally) -RUN npm install -g serve vite - -# Build the application -RUN node --max-old-space-size=4096 node_modules/.bin/vite build - -# Command to run the application -CMD ["npm", "run", "serve"] diff --git a/src/Managing.WebApp/Dockerfile-web-ui-dev b/src/Managing.WebApp/Dockerfile-web-ui-dev deleted file mode 100644 index 791953d..0000000 --- a/src/Managing.WebApp/Dockerfile-web-ui-dev +++ /dev/null @@ -1,43 +0,0 @@ -ο»ΏARG NODE_VERSION=21.4.0 -ARG ALPINE_VERSION=3.19.0 - -FROM node:${NODE_VERSION}-alpine AS node - -FROM alpine:${ALPINE_VERSION} AS builder - -COPY --from=node /usr/lib /usr/lib -COPY --from=node /usr/local/lib /usr/local/lib -COPY --from=node /usr/local/include /usr/local/include -COPY --from=node /usr/local/bin /usr/local/bin - -RUN node -v - -# Set the working directory in the container -WORKDIR /app - -# Copy the package.json and package-lock.json first to leverage Docker's cache -COPY ./src/Managing.WebApp/package*.json ./ - -# Install dependencies -#RUN npm ci --production --loglevel=verbose -RUN npm i --omit=dev --loglevel=verbose -# Copy the application code -COPY . . - -# Build the Vite application -RUN npm run build - -# Stage 2: Create the runtime image -FROM nginx:alpine - -# Copy the built Vite application from the builder stage -COPY --from=builder /app/dist /usr/share/nginx/html - -# Copy a custom Nginx configuration file (if you need one) -# COPY nginx.conf /etc/nginx/nginx.conf - -# Expose port 80 -EXPOSE 80 - -# Start the Nginx server -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/src/Managing.WebApp/LICENSE b/src/Managing.WebApp/LICENSE deleted file mode 100644 index b229c5f..0000000 --- a/src/Managing.WebApp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Managing - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/src/Managing.WebApp/README.md b/src/Managing.WebApp/README.md deleted file mode 100644 index 5be74be..0000000 --- a/src/Managing.WebApp/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# vite-react-ts-extended [![Typecheck](https://github.com/laststance/vite-react-ts-extended/actions/workflows/typecheck.yml/badge.svg)](https://github.com/laststance/vite-react-ts-extended/actions/workflows/typecheck.yml) [![Test](https://github.com/laststance/vite-react-ts-extended/actions/workflows/test.yml/badge.svg)](https://github.com/laststance/vite-react-ts-extended/actions/workflows/test.yml) [![Build](https://github.com/laststance/vite-react-ts-extended/actions/workflows/build.yml/badge.svg)](https://github.com/laststance/vite-react-ts-extended/actions/workflows/build.yml) [![Lint](https://github.com/laststance/vite-react-ts-extended/actions/workflows/lint.yml/badge.svg)](https://github.com/laststance/vite-react-ts-extended/actions/workflows/lint.yml) [![Depfu](https://badges.depfu.com/badges/6c7775918ccc8647160750e168617a65/overview.svg)](https://depfu.com/github/laststance/vite-react-ts-extended?project_id=32682) - -> My CRA alternative. -> Create plain and lightweight React+TS programming environment with familiar pre-setup tooling -> eslint/prettier, jest/TS/react-testing-library/msw, tailwindcss, CI. - -## [Trying this Online!](https://codesandbox.io/s/vite-react-ts-extended-cbgyfz?file=/src/App.tsx) - - - -This is the official [Vite](https://vitejs.dev/) template(`npm init vite@latest myapp -- --template react-ts`) and some extended setup. - -- [eslint-typescript](https://github.com/typescript-eslint/typescript-eslint) and [Prettier](https://prettier.io/) integration. Rules are 100% my personal setup πŸ’… -- [jest](https://jestjs.io/), [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/), [react-hooks-testing-library](https://github.com/testing-library/react-hooks-testing-library), [MSW](https://mswjs.io/) -- [tailwindcss](https://tailwindcss.com/) -- [Github Actions](https://github.com/features/actions) - -All npm package are keeping least release version powered by [Depfu](https://depfu.com/). - -# Installation - -``` -npx degit laststance/vite-react-ts-extended myapp -``` - -### yarn - -```sh -cd myapp -yarn install -yarn validate # The installation was successful if no error occurs after running 'validate'. -yarn dev -``` - -### npm - -```sh -cd myapp -npm install -npm run validate # The installation was successful if no error occurs after running 'validate'. -npm run dev -``` - -### Commands - -```sh -yarn dev # start development server -yarn validate # run test,lint,build,typecheck concurrently -yarn test # run jest -yarn lint # run eslint -yarn lint:fix # run eslint with --fix option -yarn typecheck # run TypeScript compiler check -yarn build # build production bundle to 'dist' directly -yarn prettier # run prettier for json|yml|css|md|mdx files -yarn clean # remove 'node_modules' 'yarn.lock' 'dist' completely -yarn serve # launch server for production bundle in local -``` - -# Background - -The evolution of the React framework is accelerating more than ever before. -[Next.js](https://nextjs.org/), [Remix](https://remix.run/), [RedwoodJS](https://redwoodjs.com/), [Gatsby](https://www.gatsbyjs.com/), [Blitz](https://blitzjs.com/) etc... - -Ahthough I still need plain React programming starter some reason. (.e.g Demo, Experiment like Deep Dive React Core.) -So far, [create-react-app](https://github.com/facebook/create-react-app) **was** it. -In short, [create-react-app](https://github.com/facebook/create-react-app) development couldn't say active. Please read the [Issue](https://github.com/facebook/create-react-app/issues/11180) in details. - -So I created an alternative to [create-react-app](https://github.com/facebook/create-react-app) for myself, based on [Vite](https://github.com/facebook/create-react-app). -This project contains my very opinionted setup, -but I hope it will be a useful tool for people who have similar needs to mine! πŸ˜€ - -# License - -MIT - -## Contributors ✨ - -Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): - - - - - - - - -

ryota-murakami

πŸ’» πŸ“– ⚠️
- - - - - - -This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/src/Managing.WebApp/index.html b/src/Managing.WebApp/index.html deleted file mode 100644 index c6488fe..0000000 --- a/src/Managing.WebApp/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - Managing - - -
- - - - diff --git a/src/Managing.WebApp/install_problematic_packages.sh b/src/Managing.WebApp/install_problematic_packages.sh deleted file mode 100644 index 62a600e..0000000 --- a/src/Managing.WebApp/install_problematic_packages.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Array of known potentially hanging packages -hanging_packages=("xmlhttprequest-ssl@latest" "engine.io-parser@latest") - -# Timeout in seconds for each package installation attempt - - -install_with_timeout() { - package=$1 - echo "Attempting to install $package with a timeout of $timeout_duration seconds." - # Start npm install in the background - npm install $package --verbose &> $package.log & - - # Get PID of the npm process - pid=$! - - # Wait for the npm process to finish or timeout - (sleep $timeout_duration && kill -0 $pid 2>/dev/null && kill -9 $pid && echo "Timeout reached for $package, process killed." && echo $package >> exclude.log) & - waiter_pid=$! - - # Wait for the npm process to complete - wait $pid - - # Kill the waiter process in case npm finished before the timeout - kill -0 $waiter_pid 2>/dev/null && kill -9 $waiter_pid -} - -# Install potentially hanging packages first with a timeout -for package in "${hanging_packages[@]}"; do - install_with_timeout $package -done diff --git a/src/Managing.WebApp/jest.config.js b/src/Managing.WebApp/jest.config.js deleted file mode 100644 index dd7f4d9..0000000 --- a/src/Managing.WebApp/jest.config.js +++ /dev/null @@ -1,35 +0,0 @@ -const config = { - collectCoverageFrom: ['/src/**/*.{js,jsx,ts,tsx}', '!src/**/*.d.ts'], - moduleDirectories: ['node_modules'], - moduleFileExtensions: ['js', 'mjs', 'jsx', 'ts', 'tsx', 'json'], - moduleNameMapper: { - '^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy', - }, - notify: true, - notifyMode: 'success-change', - resetMocks: true, - roots: [''], - setupFilesAfterEnv: ['/jest/setupTests.ts'], - testEnvironment: 'jsdom', - testMatch: [ - '/src/**/*.{spec,test}.{js,jsx,ts,tsx}', - '/src/**/__tests__/**/*.{js,jsx,ts,tsx}', - ], - transform: { - '^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': - '/jest/fileTransform.js', - '^.+\\.[jt]sx?$': 'esbuild-jest', - '^.+\\.css$': '/jest/cssTransform.js', - }, - transformIgnorePatterns: [ - '[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$', - '^.+\\.module\\.(css|sass|scss)$', - ], - verbose: true, - watchPlugins: [ - 'jest-watch-typeahead/filename', - 'jest-watch-typeahead/testname', - ], -} - -module.exports = config diff --git a/src/Managing.WebApp/mockServiceWorker.js b/src/Managing.WebApp/mockServiceWorker.js deleted file mode 100644 index 4e18b44..0000000 --- a/src/Managing.WebApp/mockServiceWorker.js +++ /dev/null @@ -1,338 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ - -/** - * Mock Service Worker (0.36.5). - * @see https://github.com/mswjs/msw - * - Please do NOT modify this file. - * - Please do NOT serve this file on production. - */ - -const INTEGRITY_CHECKSUM = '02f4ad4a2797f85668baf196e553d929' -const bypassHeaderName = 'x-msw-bypass' -const activeClientIds = new Set() - -self.addEventListener('install', function () { - return self.skipWaiting() -}) - -self.addEventListener('activate', async function (event) { - return self.clients.claim() -}) - -self.addEventListener('message', async function (event) { - const clientId = event.source.id - - if (!clientId || !self.clients) { - return - } - - const client = await self.clients.get(clientId) - - if (!client) { - return - } - - const allClients = await self.clients.matchAll() - - switch (event.data) { - case 'KEEPALIVE_REQUEST': { - sendToClient(client, { - type: 'KEEPALIVE_RESPONSE', - }) - break - } - - case 'INTEGRITY_CHECK_REQUEST': { - sendToClient(client, { - type: 'INTEGRITY_CHECK_RESPONSE', - payload: INTEGRITY_CHECKSUM, - }) - break - } - - case 'MOCK_ACTIVATE': { - activeClientIds.add(clientId) - - sendToClient(client, { - type: 'MOCKING_ENABLED', - payload: true, - }) - break - } - - case 'MOCK_DEACTIVATE': { - activeClientIds.delete(clientId) - break - } - - case 'CLIENT_CLOSED': { - activeClientIds.delete(clientId) - - const remainingClients = allClients.filter((client) => { - return client.id !== clientId - }) - - // Unregister itself when there are no more clients - if (remainingClients.length === 0) { - self.registration.unregister() - } - - break - } - } -}) - -// Resolve the "main" client for the given event. -// Client that issues a request doesn't necessarily equal the client -// that registered the worker. It's with the latter the worker should -// communicate with during the response resolving phase. -async function resolveMainClient(event) { - const client = await self.clients.get(event.clientId) - - if (client.frameType === 'top-level') { - return client - } - - const allClients = await self.clients.matchAll() - - return allClients - .filter((client) => { - // Get only those clients that are currently visible. - return client.visibilityState === 'visible' - }) - .find((client) => { - // Find the client ID that's recorded in the - // set of clients that have registered the worker. - return activeClientIds.has(client.id) - }) -} - -async function handleRequest(event, requestId) { - const client = await resolveMainClient(event) - const response = await getResponse(event, client, requestId) - - // Send back the response clone for the "response:*" life-cycle events. - // Ensure MSW is active and ready to handle the message, otherwise - // this message will pend indefinitely. - if (client && activeClientIds.has(client.id)) { - ;(async function () { - const clonedResponse = response.clone() - sendToClient(client, { - type: 'RESPONSE', - payload: { - requestId, - type: clonedResponse.type, - ok: clonedResponse.ok, - status: clonedResponse.status, - statusText: clonedResponse.statusText, - body: - clonedResponse.body === null ? null : await clonedResponse.text(), - headers: serializeHeaders(clonedResponse.headers), - redirected: clonedResponse.redirected, - }, - }) - })() - } - - return response -} - -async function getResponse(event, client, requestId) { - const { request } = event - const requestClone = request.clone() - const getOriginalResponse = () => fetch(requestClone) - - // Bypass mocking when the request client is not active. - if (!client) { - return getOriginalResponse() - } - - // Bypass initial page load requests (i.e. static assets). - // The absence of the immediate/parent client in the map of the active clients - // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet - // and is not ready to handle requests. - if (!activeClientIds.has(client.id)) { - return await getOriginalResponse() - } - - // Bypass requests with the explicit bypass header - if (requestClone.headers.get(bypassHeaderName) === 'true') { - const cleanRequestHeaders = serializeHeaders(requestClone.headers) - - // Remove the bypass header to comply with the CORS preflight check. - delete cleanRequestHeaders[bypassHeaderName] - - const originalRequest = new Request(requestClone, { - headers: new Headers(cleanRequestHeaders), - }) - - return fetch(originalRequest) - } - - // Send the request to the client-side MSW. - const reqHeaders = serializeHeaders(request.headers) - const body = await request.text() - - const clientMessage = await sendToClient(client, { - type: 'REQUEST', - payload: { - id: requestId, - url: request.url, - method: request.method, - headers: reqHeaders, - cache: request.cache, - mode: request.mode, - credentials: request.credentials, - destination: request.destination, - integrity: request.integrity, - redirect: request.redirect, - referrer: request.referrer, - referrerPolicy: request.referrerPolicy, - body, - bodyUsed: request.bodyUsed, - keepalive: request.keepalive, - }, - }) - - switch (clientMessage.type) { - case 'MOCK_SUCCESS': { - return delayPromise( - () => respondWithMock(clientMessage), - clientMessage.payload.delay, - ) - } - - case 'MOCK_NOT_FOUND': { - return getOriginalResponse() - } - - case 'NETWORK_ERROR': { - const { name, message } = clientMessage.payload - const networkError = new Error(message) - networkError.name = name - - // Rejecting a request Promise emulates a network error. - throw networkError - } - - case 'INTERNAL_ERROR': { - const parsedBody = JSON.parse(clientMessage.payload.body) - - console.error( - `\ -[MSW] Uncaught exception in the request handler for "%s %s": - -${parsedBody.location} - -This exception has been gracefully handled as a 500 response, however, it's strongly recommended to resolve this error, as it indicates a mistake in your code. If you wish to mock an error response, please see this guide: https://mswjs.io/docs/recipes/mocking-error-responses\ -`, - request.method, - request.url, - ) - - return respondWithMock(clientMessage) - } - } - - return getOriginalResponse() -} - -self.addEventListener('fetch', function (event) { - const { request } = event - const accept = request.headers.get('accept') || '' - - // Bypass server-sent events. - if (accept.includes('text/event-stream')) { - return - } - - // Bypass navigation requests. - if (request.mode === 'navigate') { - return - } - - // Opening the DevTools triggers the "only-if-cached" request - // that cannot be handled by the worker. Bypass such requests. - if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') { - return - } - - // Bypass all requests when there are no active clients. - // Prevents the self-unregistered worked from handling requests - // after it's been deleted (still remains active until the next reload). - if (activeClientIds.size === 0) { - return - } - - const requestId = uuidv4() - - return event.respondWith( - handleRequest(event, requestId).catch((error) => { - if (error.name === 'NetworkError') { - console.warn( - '[MSW] Successfully emulated a network error for the "%s %s" request.', - request.method, - request.url, - ) - return - } - - // At this point, any exception indicates an issue with the original request/response. - console.error( - `\ -[MSW] Caught an exception from the "%s %s" request (%s). This is probably not a problem with Mock Service Worker. There is likely an additional logging output above.`, - request.method, - request.url, - `${error.name}: ${error.message}`, - ) - }), - ) -}) - -function serializeHeaders(headers) { - const reqHeaders = {} - headers.forEach((value, name) => { - reqHeaders[name] = reqHeaders[name] - ? [].concat(reqHeaders[name]).concat(value) - : value - }) - return reqHeaders -} - -function sendToClient(client, message) { - return new Promise((resolve, reject) => { - const channel = new MessageChannel() - - channel.port1.onmessage = (event) => { - if (event.data && event.data.error) { - return reject(event.data.error) - } - - resolve(event.data) - } - - client.postMessage(JSON.stringify(message), [channel.port2]) - }) -} - -function delayPromise(cb, duration) { - return new Promise((resolve) => { - setTimeout(() => resolve(cb()), duration) - }) -} - -function respondWithMock(clientMessage) { - return new Response(clientMessage.payload.body, { - ...clientMessage.payload, - headers: clientMessage.payload.headers, - }) -} - -function uuidv4() { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - const r = (Math.random() * 16) | 0 - const v = c == 'x' ? r : (r & 0x3) | 0x8 - return v.toString(16) - }) -} diff --git a/src/Managing.WebApp/package.json b/src/Managing.WebApp/package.json deleted file mode 100644 index e808132..0000000 --- a/src/Managing.WebApp/package.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "name": "managing", - "version": "2.0.0", - "license": "MIT", - "scripts": { - "dev": "vite", - "build": "vite build", - "preview": "vite preview", - "serve": "serve -s dist -p 3000", - "test": "jest", - "lint": "eslint . --ext .ts,.tsx,.js,jsx", - "lint:fix": "eslint . --ext .ts,.tsx,.js,jsx --fix", - "typecheck": "tsc --noEmit", - "prettier": "prettier --write \"**/*.+(json|yml|css|md|mdx)\"", - "clean": "rimraf node_modules yarn.lock dist", - "validate": "./scripts/validate" - }, - "dependencies": { - "@heroicons/react": "^1.0.6", - "@microsoft/signalr": "^6.0.5", - "@tanstack/react-query": "^5.0.0", - "@wagmi/chains": "^0.2.9", - "@wagmi/connectors": "^4.3.2", - "@wagmi/core": "^2.9.0", - "@walletconnect/universal-provider": "^2.8.6", - "axios": "^0.27.2", - "classnames": "^2.3.1", - "connectkit": "^1.7.3", - "date-fns": "^2.30.0", - "jotai": "^1.6.7", - "latest-version": "^9.0.0", - "lightweight-charts": "git+https://github.com/ntf/lightweight-charts.git", - "moment": "^2.29.3", - "plotly.js": "^2.18.1", - "react": "^18.1.0", - "react-cookie": "^4.1.1", - "react-dom": "^18.1.0", - "react-grid-layout": "^1.3.4", - "react-hook-form": "^7.31.2", - "react-hot-toast": "^2.2.0", - "react-icons": "^4.3.1", - "react-iframe": "^1.8.0", - "react-plotly.js": "^2.6.0", - "react-router-dom": "^6.3.0", - "react-slider": "^2.0.1", - "react-table": "^7.8.0", - "react-toastify": "^9.0.1", - "reactflow": "^11.8.3", - "viem": "^2.0.6", - "wagmi": "^2.2.1", - "web3": "^4.0.2", - "zustand": "^4.4.1" - }, - "devDependencies": { - "@tailwindcss/aspect-ratio": "^0.4.0", - "@tailwindcss/forms": "^0.5.1", - "@tailwindcss/line-clamp": "^0.4.0", - "@tailwindcss/typography": "^0.5.2", - "@tanstack/eslint-plugin-query": "^4.34.1", - "@testing-library/dom": "^8.13.0", - "@testing-library/react": "^13.2.0", - "@types/jest": "^27.5.1", - "@types/react": "^18.0.9", - "@types/react-dom": "^18.0.4", - "@types/react-grid-layout": "^1.3.2", - "@types/react-plotly.js": "^2.6.0", - "@types/react-slider": "^1.3.1", - "@types/react-table": "^7.7.12", - "@types/signalr": "^2.2.37", - "@types/testing-library__jest-dom": "^5.14.3", - "@typescript-eslint/eslint-plugin": "^5.23.0", - "@typescript-eslint/parser": "^5.23.0", - "@vitejs/plugin-react": "^1.3.2", - "all-contributors-cli": "^6.20.0", - "autoprefixer": "^10.4.7", - "daisyui": "^3.5.1", - "esbuild-jest": "^0.4.0", - "eslint": "^8.15.0", - "eslint-config-prettier": "^8.5.0", - "eslint-config-typescript": "^3.0.0", - "eslint-import-resolver-typescript": "^2.7.1", - "eslint-plugin-import": "^2.26.0", - "eslint-plugin-jsx-a11y": "^6.5.1", - "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-react-hooks": "^4.5.0", - "eslint-plugin-sort-keys-fix": "^1.1.2", - "identity-obj-proxy": "^3.0.0", - "jest": "^28.0.0", - "jest-watch-typeahead": "^1.1.0", - "node-notifier": "^10.0.1", - "postcss": "^8.4.13", - "prettier": "^2.6.1", - "prettier-plugin-tailwind-css": "^1.5.0", - "rimraf": "^3.0.2", - "serve": "^14.2.0", - "tailwindcss": "^3.0.23", - "typescript": "^5.0.4", - "vite": "^4.4.9", - "whatwg-fetch": "^3.6.2" - }, - "msw": { - "workerDirectory": "" - } -} diff --git a/src/Managing.WebApp/postcss.config.js b/src/Managing.WebApp/postcss.config.js deleted file mode 100644 index 6e41d95..0000000 --- a/src/Managing.WebApp/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - autoprefixer: {}, - tailwindcss: {}, - }, -} diff --git a/src/Managing.WebApp/prettier.config.js b/src/Managing.WebApp/prettier.config.js deleted file mode 100644 index 9280030..0000000 --- a/src/Managing.WebApp/prettier.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - plugins: [require('prettier-plugin-tailwindcss')], - tailwindConfig: './tailwind.config.js', -} diff --git a/src/Managing.WebApp/scripts/validate b/src/Managing.WebApp/scripts/validate deleted file mode 100644 index 738fceb..0000000 --- a/src/Managing.WebApp/scripts/validate +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -npx concurrently \ - --kill-others-on-fail \ - --prefix "[{name}]" \ - --names "test,lint:fix,typecheck,build" \ - --prefix-colors "bgRed.bold.white,bgGreen.bold.white,bgBlue.bold.white,bgMagenta.bold.white" \ - "npm run test --silent -- --watch=false" \ - "npm run lint:fix --silent" \ - "npm run typecheck --silent" \ - "npm run build --silent" diff --git a/src/Managing.WebApp/src/app/index.tsx b/src/Managing.WebApp/src/app/index.tsx deleted file mode 100644 index 96e64a1..0000000 --- a/src/Managing.WebApp/src/app/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { Auth } from '../pages/authPage/auth' - -import MyRoutes from './routes' - -const App = () => { - return ( - - - - ) -} - -export default App diff --git a/src/Managing.WebApp/src/app/providers/Hubs.tsx b/src/Managing.WebApp/src/app/providers/Hubs.tsx deleted file mode 100644 index f837f26..0000000 --- a/src/Managing.WebApp/src/app/providers/Hubs.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import type { HubConnection } from '@microsoft/signalr' -import { HubConnectionBuilder } from '@microsoft/signalr' -// https://www.abrahamberg.com/blog/aspnet-signalr-and-react/ -export class Hub { - public hub: HubConnection - constructor(name: string, baseUrl: string) { - this.hub = new HubConnectionBuilder() - .withUrl(baseUrl + '/' + name) - .withAutomaticReconnect() - .build() - try { - this.hub.start() - } catch (err) { - // eslint-disable-next-line no-console - console.log(err) - } - } -} diff --git a/src/Managing.WebApp/src/app/routes/index.tsx b/src/Managing.WebApp/src/app/routes/index.tsx deleted file mode 100644 index da67c32..0000000 --- a/src/Managing.WebApp/src/app/routes/index.tsx +++ /dev/null @@ -1,118 +0,0 @@ -import { Suspense, lazy } from 'react' -import { Route, Routes } from 'react-router-dom' - -import LayoutMain from '../../layouts' -import DeskWidget from '../../pages/desk/deskWidget' -import Scenario from '../../pages/scenarioPage/scenario' -import Tools from '../../pages/toolsPage/tools' -import Workflows from '../../pages/workflow/workflows' - -const Backtest = lazy(() => import('../../pages/backtestPage/backtest')) -const Bots = lazy(() => import('../../pages/botsPage/bots')) -const Dashboard = lazy(() => import('../../pages/dashboardPage/dashboard')) -const Settings = lazy(() => import('../../pages/settingsPage/settings')) - -const MyRoutes = () => { - return ( - - }> - - - - } - /> - - - }> - - - - } - /> - - - }> - - - - } - /> - - - }> - - - - } - /> - - - }> - - - - } - /> - - - }> - - - - } - /> - - }> - - - - } - /> - - - }> - - - - } - /> - - {/* }> - - - - } - /> - */} - - ) -} - -export default MyRoutes diff --git a/src/Managing.WebApp/src/app/store/accountStore.tsx b/src/Managing.WebApp/src/app/store/accountStore.tsx deleted file mode 100644 index b264119..0000000 --- a/src/Managing.WebApp/src/app/store/accountStore.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { create } from 'zustand' - -import type { AccountStore } from '../../global/type' - -export const useAuthStore = create((set) => ({ - accounts: [], - onInitialize: () => { - console.log('useFlowStore onInitialize') - - // const accountClient = new AccountClient({}, apiUrl) - // const accounts = await accountClient.account_GetAccounts() - // if (accounts.length > 0) { - // get().setAccounts(accounts) - // } - }, - setAccounts: (accounts) => { - set((state) => ({ - ...state, - accounts: accounts, - })) - }, -})) diff --git a/src/Managing.WebApp/src/app/store/apiStore.tsx b/src/Managing.WebApp/src/app/store/apiStore.tsx deleted file mode 100644 index 632fb70..0000000 --- a/src/Managing.WebApp/src/app/store/apiStore.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import create from 'zustand' - -type ApiStore = { - isProd: boolean - apiUrl: string - workerUrl: string - toggleApiUrl: () => void -} - -const useApiUrlStore = create((set) => ({ - // Mettez la valeur initiale de isProd ici - apiUrl: import.meta.env.VITE_API_URL_SERVER, - isProd: true, - toggleApiUrl: () => { - set((state) => ({ - apiUrl: state.isProd - ? import.meta.env.VITE_API_URL_LOCAL - : import.meta.env.VITE_API_URL_SERVER, - isProd: !state.isProd, - workerUrl: state.isProd - ? import.meta.env.VITE_WORKER_URL_LOCAL - : import.meta.env.VITE_WORKER_URL_SERVER, - })) - }, - workerUrl: import.meta.env.VITE_WORKER_URL_SERVER, -})) - -export default useApiUrlStore diff --git a/src/Managing.WebApp/src/app/store/flowStore.tsx b/src/Managing.WebApp/src/app/store/flowStore.tsx deleted file mode 100644 index f176552..0000000 --- a/src/Managing.WebApp/src/app/store/flowStore.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { create } from 'zustand' - -import type { IFlow } from '../../generated/ManagingApi' -import { WorkflowClient } from '../../generated/ManagingApi' - -type FlowStore = { - setFlows: (flows: IFlow[]) => void - getFlows: (apiUrl: string) => void - flows: IFlow[] -} - -export const useFlowStore = create((set) => ({ - flows: [] as IFlow[], - getFlows: async (apiUrl) => { - const client = new WorkflowClient({}, apiUrl) - await client.workflow_GetAvailableFlows().then((data) => { - set(() => ({ - flows: data, - })) - }) - }, - setFlows: (flows) => { - set((state) => ({ - ...state, - flows: flows, - })) - }, -})) diff --git a/src/Managing.WebApp/src/app/store/selectors/workflowSelector.tsx b/src/Managing.WebApp/src/app/store/selectors/workflowSelector.tsx deleted file mode 100644 index 5f8f754..0000000 --- a/src/Managing.WebApp/src/app/store/selectors/workflowSelector.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import type { IWorkflowStore } from '../workflowStore' - -export const WorkflowSelector = (state: IWorkflowStore) => ({ - edges: state.edges, - initWorkFlow: state.initWorkFlow, - nodes: state.nodes, - onConnect: state.onConnect, - onEdgesChange: state.onEdgesChange, - onNodesChange: state.onNodesChange, - resetWorkflow: state.resetWorkflow, - setNodes: state.setNodes, - updateNodeData: state.updateNodeData, -}) diff --git a/src/Managing.WebApp/src/app/store/workflowStore.tsx b/src/Managing.WebApp/src/app/store/workflowStore.tsx deleted file mode 100644 index 834b72a..0000000 --- a/src/Managing.WebApp/src/app/store/workflowStore.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import type { - Connection, - Edge, - EdgeChange, - Node, - NodeChange, - OnNodesChange, - OnEdgesChange, - OnConnect, -} from 'reactflow' -import { addEdge, applyNodeChanges, applyEdgeChanges } from 'reactflow' -import { create } from 'zustand' - -import type { - SyntheticFlowParameter, - FlowParameter, - IFlow, -} from '../../generated/ManagingApi' - -export type IWorkflowStore = { - nodes: Node[] - initialNodes: Node[] - edges: Edge[] - initialEdges: Edge[] - onNodesChange: OnNodesChange - onEdgesChange: OnEdgesChange - onConnect: OnConnect - updateNodeData: (nodeId: string, parameterName: string, value: string) => void - initWorkFlow: (nodes: Node[], edges: Edge[]) => void - setNodes: (nodes: Node[]) => void - resetWorkflow: () => void -} - -// this is our useStore hook that we can use in our components to get parts of the store and call actions -const useWorkflowStore = create((set, get) => ({ - edges: [], - initWorkFlow: (nodes: Node[], edges: Edge[]) => { - set({ - edges: edges, - initialEdges: edges, - initialNodes: nodes, - nodes: nodes, - }) - }, - initialEdges: [], - initialNodes: [], - nodes: [], - onConnect: (connection: Connection, callback: void) => { - set({ - edges: addEdge(connection, get().edges), - }) - }, - onEdgesChange: (changes: EdgeChange[]) => { - set({ - edges: applyEdgeChanges(changes, get().edges), - }) - }, - onNodesChange: (changes: NodeChange[]) => { - set({ - nodes: applyNodeChanges(changes, get().nodes), - }) - }, - resetWorkflow: () => { - set({ - edges: get().initialEdges, - initialEdges: get().initialEdges, - initialNodes: get().initialNodes, - nodes: get().initialNodes, - }) - }, - setNodes: (nodes: Node[]) => { - set({ - nodes: nodes, - }) - }, - updateNodeData: (nodeId: string, parameterName: string, value: string) => { - set({ - nodes: get().nodes.map((node) => { - if (node.id === nodeId) { - node.data.parameters = updateParameters( - node.data.parameters, - parameterName, - value - ) - } - return node - }), - }) - }, -})) - -const updateParameters = ( - parameters: FlowParameter[], - name: string, - value: string -) => { - if (!parameters.find((parameter) => parameter.name === name)) { - parameters.push({ - name: name, - value: value, - } as SyntheticFlowParameter) - } else { - parameters = parameters.map((parameter) => { - if (parameter.name === name) { - parameter.value = value - } - return parameter - }) - } - return parameters -} - -export default useWorkflowStore diff --git a/src/Managing.WebApp/src/assets/img/logo.png b/src/Managing.WebApp/src/assets/img/logo.png deleted file mode 100644 index c4ccd58..0000000 Binary files a/src/Managing.WebApp/src/assets/img/logo.png and /dev/null differ diff --git a/src/Managing.WebApp/src/assets/img/tradingview.png b/src/Managing.WebApp/src/assets/img/tradingview.png deleted file mode 100644 index 4be6f84..0000000 Binary files a/src/Managing.WebApp/src/assets/img/tradingview.png and /dev/null differ diff --git a/src/Managing.WebApp/src/components/atoms/List/List.tsx b/src/Managing.WebApp/src/components/atoms/List/List.tsx deleted file mode 100644 index 57c5eac..0000000 --- a/src/Managing.WebApp/src/components/atoms/List/List.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import type { IListProp } from '../../../global/type' - -const List = (prop: IListProp): JSX.Element => ( -
  • {prop.children}
  • -) - -export default List diff --git a/src/Managing.WebApp/src/components/atoms/Loader/Loader.tsx b/src/Managing.WebApp/src/components/atoms/Loader/Loader.tsx deleted file mode 100644 index 3ddfea1..0000000 --- a/src/Managing.WebApp/src/components/atoms/Loader/Loader.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import type { ILoader } from '../../../global/type' - -const defaultClasses = 'loading loading-ring ' - -const loaderSize = { - lg: defaultClasses + 'loading-lg', - md: defaultClasses + 'loading-md', - sm: defaultClasses + 'loading-sm', - xs: defaultClasses + 'loading-xs', -} - -const Loader = ({ size = 'md' }: ILoader) => { - return -} - -export default Loader diff --git a/src/Managing.WebApp/src/components/atoms/MyLink/MyLink.tsx b/src/Managing.WebApp/src/components/atoms/MyLink/MyLink.tsx deleted file mode 100644 index c979720..0000000 --- a/src/Managing.WebApp/src/components/atoms/MyLink/MyLink.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { Link, NavLink } from 'react-router-dom' - -import type { IMyLinkProps } from '../../../global/type' - -const MyLink = ({ - children, - href, - as: asof = 'link', - ...props -}: IMyLinkProps): JSX.Element => { - const navLink = asof === 'navlink' - const onlyLink = asof === 'link' - - if (navLink) { - return ( - - {children} - - ) - } - - if (onlyLink) { - return ( - - {children} - - ) - } - - return ( - - {children} - - ) -} - -export default MyLink diff --git a/src/Managing.WebApp/src/components/atoms/Select/Select.tsx b/src/Managing.WebApp/src/components/atoms/Select/Select.tsx deleted file mode 100644 index f31dcf8..0000000 --- a/src/Managing.WebApp/src/components/atoms/Select/Select.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import type { IListProp } from '../../../global/type' - -const Select = (prop: IListProp): JSX.Element => ( - -) - -export default Select diff --git a/src/Managing.WebApp/src/components/atoms/Slider/Slider.tsx b/src/Managing.WebApp/src/components/atoms/Slider/Slider.tsx deleted file mode 100644 index a19e1e8..0000000 --- a/src/Managing.WebApp/src/components/atoms/Slider/Slider.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import type { FunctionComponent } from 'react' - -import type { IPropsComponent } from '../../../global/type' - -const Slider: FunctionComponent = (props: IPropsComponent) => { - return ( - <> -
    - -
    -
    - {props.prefixValue} - {props.value} - {props.suffixValue} -
    - - ) -} - -export default Slider diff --git a/src/Managing.WebApp/src/components/atoms/index.tsx b/src/Managing.WebApp/src/components/atoms/index.tsx deleted file mode 100644 index 77ced26..0000000 --- a/src/Managing.WebApp/src/components/atoms/index.tsx +++ /dev/null @@ -1,5 +0,0 @@ -export { default as List } from './List/List' -export { default as MyLink } from './MyLink/MyLink' -export { default as Select } from './Select/Select' -export { default as Slider } from './Slider/Slider' -export { default as Loader } from './Loader/Loader' diff --git a/src/Managing.WebApp/src/components/mollecules/Card/Card.tsx b/src/Managing.WebApp/src/components/mollecules/Card/Card.tsx deleted file mode 100644 index 7c5c677..0000000 --- a/src/Managing.WebApp/src/components/mollecules/Card/Card.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import type { CardProps } from '../../../global/type' - -const Card = ({ name, children, showCloseButton, info }: CardProps) => { - return ( -
    -
    -
    - {name} - {info && ( -
    - i -
    - )} -
    - -
    - {showCloseButton && ( - - )} -
    -
    -
    {children}
    -
    - ) -} - -export default Card diff --git a/src/Managing.WebApp/src/components/mollecules/CardText/CardText.tsx b/src/Managing.WebApp/src/components/mollecules/CardText/CardText.tsx deleted file mode 100644 index 64f51a3..0000000 --- a/src/Managing.WebApp/src/components/mollecules/CardText/CardText.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import ArrowDownIcon from '@heroicons/react/solid/ArrowDownIcon' -import ArrowUpIcon from '@heroicons/react/solid/ArrowUpIcon' - -import { Position, TradeDirection } from '../../../generated/ManagingApi' -import type { ICardPosition, ICardSignal, ICardText } from '../../../global/type' - -function getItemTextHeaderClass() { - return 'text-xs ' -} -function getItemTextValueClass() { - return 'text-md ' -} - -export function CardText({ title, content }: ICardText) { - return ( -
    -

    {title}

    -

    {content}

    -
    - ) -} - -export function CardPosition({ positions, positivePosition }: ICardPosition) { - return ( - <> -
    -

    - {positivePosition ? 'Winning position' : 'Losing position'} -

    -

    - { - positions.filter((p: Position) => p.originDirection == TradeDirection.Long) - .length - }{' '} - {' '} - { - positions.filter((p) => p.originDirection == TradeDirection.Short) - .length - }{' '} - -

    -
    - - ) -} - -export function CardSignal({ signals }: ICardSignal) { - return ( - <> -
    -

    Signals

    -

    - {signals.filter((p) => p.direction == TradeDirection.Long).length}{' '} - {' '} - {signals.filter((p) => p.direction == TradeDirection.Short).length}{' '} - -

    -
    - - ) -} diff --git a/src/Managing.WebApp/src/components/mollecules/FormInput/FormInput.tsx b/src/Managing.WebApp/src/components/mollecules/FormInput/FormInput.tsx deleted file mode 100644 index beb18c1..0000000 --- a/src/Managing.WebApp/src/components/mollecules/FormInput/FormInput.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import React from 'react' - -import type { IFormInput } from '../../../global/type' - -const FormInput: React.FC = ({ - children, - label, - htmlFor, - inline = false, -}) => { - const groupStyle = inline ? 'flex-wrap' : '' - return ( -
    -
    - - {children} -
    -
    - ) -} - -export default FormInput diff --git a/src/Managing.WebApp/src/components/mollecules/GridTile/GridTile.tsx b/src/Managing.WebApp/src/components/mollecules/GridTile/GridTile.tsx deleted file mode 100644 index a59d89f..0000000 --- a/src/Managing.WebApp/src/components/mollecules/GridTile/GridTile.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import type { IGridTile } from '../../../global/type' - -const GridTile = ({ children, title }: IGridTile) => { - return ( -
    -
    -
    - {title} -
    - -
    - -
    -
    -
    {children}
    -
    - ) -} - -export default GridTile diff --git a/src/Managing.WebApp/src/components/mollecules/LogIn/LogIn.tsx b/src/Managing.WebApp/src/components/mollecules/LogIn/LogIn.tsx deleted file mode 100644 index b80ff7a..0000000 --- a/src/Managing.WebApp/src/components/mollecules/LogIn/LogIn.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import { StatusOfflineIcon } from '@heroicons/react/solid' -import type { SubmitHandler } from 'react-hook-form' -import { useForm } from 'react-hook-form' -import { useAccount, useDisconnect, useSignMessage } from 'wagmi' - -import useApiUrlStore from '../../../app/store/apiStore' -import { UserClient } from '../../../generated/ManagingApi' -import type { ILoginFormInput } from '../../../global/type' -import useCookie from '../../../hooks/useCookie' -import { SecondaryNavbar } from '../NavBar/NavBar' - -const LogIn = () => { - const { apiUrl } = useApiUrlStore() - const { register, handleSubmit } = useForm() - const { disconnect } = useDisconnect() - const { address } = useAccount() - const { isLoading, signMessageAsync } = useSignMessage({}) - const { setCookie } = useCookie() - - const onSubmit: SubmitHandler = async (form) => { - const message = 'wagmi' - const signature = await signMessageAsync({ message }) - - if (signature && address) { - const userClient = new UserClient({}, apiUrl) - await userClient - .user_CreateToken({ - address: address.toString(), - message: message, - name: form.name, - signature: signature, - }) - .then((data) => { - setCookie('token', data, 1) - location.reload() - }) - .catch((err) => { - // eslint-disable-next-line no-console - console.error(err) - }) - } else { - } - } - - return ( - <> -
    - -
    - -
    -
    -
    -
    -

    - Login -

    -
    -
    - - -
    - - -
    -
    -
    -
    -
    - - ) -} - -export default LogIn diff --git a/src/Managing.WebApp/src/components/mollecules/LogIn/Profile.tsx b/src/Managing.WebApp/src/components/mollecules/LogIn/Profile.tsx deleted file mode 100644 index 6292525..0000000 --- a/src/Managing.WebApp/src/components/mollecules/LogIn/Profile.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { useConnect } from 'wagmi' - -// export function Profile() { -// const { connect, connectors, error, isLoading, pendingConnector } = -// useConnect() - -// return ( -//
    -// {connectors.map((connector) => ( -// -// ))} - -// {error &&
    {error.message}
    } -//
    -// ) -// } diff --git a/src/Managing.WebApp/src/components/mollecules/Modal/Modal.tsx b/src/Managing.WebApp/src/components/mollecules/Modal/Modal.tsx deleted file mode 100644 index 752bc3b..0000000 --- a/src/Managing.WebApp/src/components/mollecules/Modal/Modal.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react' - -import type { IModalProps } from '../../../global/type' - -import ModalHeader from './ModalHeader' - -const Modal: React.FC = ({ - showModal, - onSubmit, - onClose, - titleHeader, - children, -}) => { - return ( -
    - {showModal ? ( -
    -
    -
    - - {children} -
    -
    -
    - ) : null} -
    - ) -} - -export default Modal diff --git a/src/Managing.WebApp/src/components/mollecules/Modal/ModalHeader.tsx b/src/Managing.WebApp/src/components/mollecules/Modal/ModalHeader.tsx deleted file mode 100644 index 688ff90..0000000 --- a/src/Managing.WebApp/src/components/mollecules/Modal/ModalHeader.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react' - -import type { IModalProps } from '../../../global/type' - -const ModalHeader: React.FC = ({ onClose, titleHeader }: any) => { - return ( -
    - -
    {titleHeader}
    -
    - ) -} - -export default ModalHeader diff --git a/src/Managing.WebApp/src/components/mollecules/NavBar/NavBar.tsx b/src/Managing.WebApp/src/components/mollecules/NavBar/NavBar.tsx deleted file mode 100644 index fd8bc49..0000000 --- a/src/Managing.WebApp/src/components/mollecules/NavBar/NavBar.tsx +++ /dev/null @@ -1,130 +0,0 @@ -import { useIsFetching } from '@tanstack/react-query' -import { ConnectKitButton } from 'connectkit' -import type { ReactNode } from 'react' -import { useState } from 'react' -import { Link } from 'react-router-dom' - -import { NavItem } from '..' -import useApiUrlStore from '../../../app/store/apiStore' -import Logo from '../../../assets/img/logo.png' -import { Loader } from '../../atoms' - -const navigation = [ - { href: '/desk', name: 'Desk' }, - { href: '/bots', name: 'Bots' }, - { href: '/workflow', name: 'Workflows' }, - { href: '/scenarios', name: 'Scenarios' }, - { href: '/backtest', name: 'Backtest' }, - { href: '/tools', name: 'Tools' }, - { href: '/settings', name: 'Settings' }, -] - -function navItems(isMobile = false) { - return navigation.map((item) => ( - - {item.name} - - )) -} - -function PrimaryNavbar() { - return ( -
    - - logo - - {/* */} -
    {navItems()}
    -
    - ) -} - -const GlobalLoader = () => { - const isFetching = useIsFetching() - return isFetching ? : null -} - -export function SecondaryNavbar() { - const { toggleApiUrl, isProd } = useApiUrlStore() - - return ( -
    - -
    - -
    - -
    - ) -} - -type MobileMenuButtonProps = { - onClick: VoidFunction -} - -function MobileMenuButton({ onClick }: MobileMenuButtonProps) { - return ( -
    - -
    - ) -} -type MobileMenuProps = { - isOpen: boolean -} - -function MobileMenu({ isOpen }: MobileMenuProps) { - return ( -
    -
      {navItems(true)}
    -
    - ) -} -type NavContainerProps = { - children: ReactNode - isMenuOpen: boolean -} - -function NavContainer({ children, isMenuOpen }: NavContainerProps) { - return ( - - ) -} -export default function NavBar() { - const [isMenuOpen, setIsMenuOpen] = useState(false) - - return ( - - - - setIsMenuOpen(!isMenuOpen)} /> - - ) -} diff --git a/src/Managing.WebApp/src/components/mollecules/NavItem/NavItem.tsx b/src/Managing.WebApp/src/components/mollecules/NavItem/NavItem.tsx deleted file mode 100644 index a492973..0000000 --- a/src/Managing.WebApp/src/components/mollecules/NavItem/NavItem.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { NavLink } from 'react-router-dom' - -import type { INavItemProps } from '../../../global/interface' - -function navLinkClasses(isActive: boolean, isMobile: boolean) { - let commonClasses = 'block text-sm px-2 py-4' - if (isMobile) { - return `${commonClasses} ${ - isActive - ? 'text-base-content bg-primary font-semibold' - : 'hover:bg-primary transition duration-300' - }` - } - commonClasses = - 'py-4 px-2 font-semibold hover:text-primary transition duration-300' - return `${commonClasses} ${isActive ? 'text-primary' : 'text-base-content'}` -} - -export default function NavItem({ - children, - href, - isMobile = false, -}: INavItemProps) { - const item = ( - navLinkClasses(isActive, isMobile)} - > - {children} - - ) - return isMobile ?
  • {item}
  • : item -} diff --git a/src/Managing.WebApp/src/components/mollecules/PieChart/PieChart.tsx b/src/Managing.WebApp/src/components/mollecules/PieChart/PieChart.tsx deleted file mode 100644 index 51c6c3b..0000000 --- a/src/Managing.WebApp/src/components/mollecules/PieChart/PieChart.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import * as React from 'react' -import Plot from 'react-plotly.js' - -type IPieChart = { - data: number[] - labels: string[] - colors: string[] -} - -const PieChart: React.FC = ({ data, labels, colors }) => { - return ( - <> - - - ) -} - -export default PieChart diff --git a/src/Managing.WebApp/src/components/mollecules/Table/SelectColumnFilter.tsx b/src/Managing.WebApp/src/components/mollecules/Table/SelectColumnFilter.tsx deleted file mode 100644 index f011b60..0000000 --- a/src/Managing.WebApp/src/components/mollecules/Table/SelectColumnFilter.tsx +++ /dev/null @@ -1,36 +0,0 @@ -// This is a custom filter UI for selecting - -import React from 'react' - -// a unique option from a list -export default function SelectColumnFilter({ - column: { filterValue, setFilter, preFilteredRows, id }, -}: any) { - // Calculate the options for filtering - // using the preFilteredRows - const options = React.useMemo(() => { - const options = new Set() - preFilteredRows.forEach((row: any) => { - options.add(row.values[id]) - }) - return [...options.values()] - }, [id, preFilteredRows]) - - // Render a multi-select box - return ( - - ) -} diff --git a/src/Managing.WebApp/src/components/mollecules/Table/Table.tsx b/src/Managing.WebApp/src/components/mollecules/Table/Table.tsx deleted file mode 100644 index c562ad9..0000000 --- a/src/Managing.WebApp/src/components/mollecules/Table/Table.tsx +++ /dev/null @@ -1,231 +0,0 @@ -import { ArrowDownIcon, ArrowUpIcon } from '@heroicons/react/solid' -import React from 'react' -import { - useTable, - usePagination, - useSortBy, - useFilters, - useExpanded, -} from 'react-table' - -import type { TableInstanceWithHooks } from '../../../global/type' - -// Define a default UI for filtering -function DefaultColumnFilter({ - column: { filterValue, preFilteredRows, setFilter }, -}: any) { - const count = preFilteredRows.length - - return ( - { - setFilter(e.target.value || undefined) // Set undefined to remove the filter entirely - }} - placeholder={`Search ${count} records...`} - /> - ) -} - -export default function Table({ - columns, - data, - renderRowSubCompontent, - showPagination, - hiddenColumns, - showTotal = false, -}: any) { - const defaultColumn = React.useMemo( - () => ({ - // Let's set up our default Filter UI - Filter: DefaultColumnFilter, - }), - [] - ) - // Use the state and functions returned from useTable to build your UI - const { - getTableProps, - getTableBodyProps, - headerGroups, - prepareRow, - visibleColumns, - page, // Instead of using 'rows', we'll use page, - // which has only the rows for the active page - - // The rest of these things are super handy, too ;) - canPreviousPage, - canNextPage, - pageOptions, - pageCount, - gotoPage, - nextPage, - previousPage, - setPageSize, - state: { pageIndex, pageSize }, - } = useTable( - { - columns, - data, - defaultColumn, // Be sure to pass the defaultColumn option - initialState: { - hiddenColumns: hiddenColumns ? hiddenColumns : [], - }, - }, - useFilters, - useSortBy, - useExpanded, - usePagination - ) as TableInstanceWithHooks - - // Calculez le total des valeurs dans la colonne USD - const total = data - ? data - .reduce((sum: number, row: any) => { - return sum + (row.value || 0) // Si la valeur est undefined = 0 - }, 0) - .toFixed(2) + ' $' - : '0.00 $' - - // Render the UI for your table - return ( - <> -
    - - - {headerGroups.map((headerGroup: any) => ( - - {headerGroup.headers.map((column: any) => ( - - ))} - - ))} - - - {page.map((row: any) => { - prepareRow(row) - return ( - <> - - {row.cells.map((cell: any) => { - return ( - - ) - })} - - {row.isExpanded ? ( - - - - ) : null} - - ) - })} - - {/* Afficher le total ici */} - {showTotal ? ( - - - - ) : null} -
    -

    - {column.render('Header')} -

    - - {column.isSorted ? ( - column.isSortedDesc ? ( - - ) : ( - - ) - ) : ( - '' - )} - -
    - {column.canFilter ? column.render('Filter') : null} -
    -
    {cell.render('Cell')}
    - {/* - Inside it, call our renderRowSubComponent function. In reality, - you could pass whatever you want as props to - a component like this, including the entire - table instance. But for this example, we'll just - pass the row - */} - {renderRowSubCompontent({ row })} -
    - Total: {total} -
    -
    - {/* - Pagination can be built however you'd like. - This is just a very basic UI implementation: - */} -
    - {showPagination ? ( -
    - {' '} - {' '} - {' '} - {' '} - - Page{' '} - - {pageIndex + 1} of {pageOptions.length} - {' '} - - {/* - | Go to page:{' '} - { - const page = e.target.value ? Number(e.target.value) - 1 : 0 - gotoPage(page) - }} - style={{ width: '100px' }} - /> - {' '} */} - -
    - ) : null} - - ) -} diff --git a/src/Managing.WebApp/src/components/mollecules/Tabs/Tabs.tsx b/src/Managing.WebApp/src/components/mollecules/Tabs/Tabs.tsx deleted file mode 100644 index 1f06e88..0000000 --- a/src/Managing.WebApp/src/components/mollecules/Tabs/Tabs.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import type { FC } from 'react' - -import type { ITabsProps } from '../../../global/type' - -/** - * Avalible Props - * @param className string - * @param tab Array of object - * @param selectedTab number - * @param onClick Function to set the active tab - * @param orientation Tab orientation Vertical | Horizontal - */ -const Tabs: FC = ({ - className = 'tabs-component', - tabs = [], - selectedTab = 0, - onClick, - orientation = 'horizontal', - addButton = false, - onAddButton, -}) => { - const Panel = tabs && tabs.find((tab) => tab.index === selectedTab) - - return ( -
    -
    - {tabs.map((tab) => ( - - ))} - {addButton && ( - - )} -
    -
    - {Panel && ( - - )} -
    -
    - ) -} -export default Tabs diff --git a/src/Managing.WebApp/src/components/mollecules/ThemeSelector/ThemeSelector.tsx b/src/Managing.WebApp/src/components/mollecules/ThemeSelector/ThemeSelector.tsx deleted file mode 100644 index a526acf..0000000 --- a/src/Managing.WebApp/src/components/mollecules/ThemeSelector/ThemeSelector.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import useTheme from '../../../hooks/useTheme' -const themes = ['black', 'coffee', 'cyberpunk', 'lofi', 'retro'] - -const ThemeSelector = (): JSX.Element => { - const { setTheme } = useTheme() - - return ( - - ) -} - -export default ThemeSelector diff --git a/src/Managing.WebApp/src/components/mollecules/Toast/Toast.tsx b/src/Managing.WebApp/src/components/mollecules/Toast/Toast.tsx deleted file mode 100644 index 2a6c044..0000000 --- a/src/Managing.WebApp/src/components/mollecules/Toast/Toast.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import type { Id, TypeOptions, UpdateOptions } from 'react-toastify' -import { toast } from 'react-toastify' - -const baseOptions: UpdateOptions = { - autoClose: 5000, - closeOnClick: true, - draggable: true, - hideProgressBar: false, - isLoading: false, - position: 'top-right', - progress: undefined, - theme: 'dark', -} - -class Toast { - private id: Id - - constructor(content: string) { - this.id = toast.loading(content) - } - - update(type: TypeOptions, content: string, opts?: any) { - const options = { ...baseOptions, ...opts } - options.type = type - options.render = content - options.isLoading = false - - toast.update(this.id, options) - } -} -export default Toast diff --git a/src/Managing.WebApp/src/components/mollecules/index.tsx b/src/Managing.WebApp/src/components/mollecules/index.tsx deleted file mode 100644 index 15228eb..0000000 --- a/src/Managing.WebApp/src/components/mollecules/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -export { CardText, CardPosition, CardSignal } from './CardText/CardText' -export { default as NavItem } from './NavItem/NavItem' -export { default as Tabs } from './Tabs/Tabs' -export { default as Modal } from './Modal/Modal' -export { default as Toast } from './Toast/Toast' -export { default as ThemeSelector } from './ThemeSelector/ThemeSelector' -export { default as Table } from './Table/Table' -export { default as NavBar } from './NavBar/NavBar' -export { default as PieChart } from './PieChart/PieChart' -export { default as FormInput } from './FormInput/FormInput' -export { default as LogIn } from './LogIn/LogIn' -export { default as GridTile } from './GridTile/GridTile' -export { default as SelectColumnFilter } from './Table/SelectColumnFilter' -export { default as Card } from './Card/Card' diff --git a/src/Managing.WebApp/src/components/organism/Account/Account.tsx b/src/Managing.WebApp/src/components/organism/Account/Account.tsx deleted file mode 100644 index 0fe15c4..0000000 --- a/src/Managing.WebApp/src/components/organism/Account/Account.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { useAccount, useEnsName } from 'wagmi' - -export function Account() { - const { address } = useAccount() - const { data: ensName } = useEnsName({ address }) - - return ( -
    - {ensName ?? address?.slice(0, -35)} - {ensName ? ` (${address})` : null} -
    - ) -} diff --git a/src/Managing.WebApp/src/components/organism/ActiveBots/ActiveBots.tsx b/src/Managing.WebApp/src/components/organism/ActiveBots/ActiveBots.tsx deleted file mode 100644 index 4814f8a..0000000 --- a/src/Managing.WebApp/src/components/organism/ActiveBots/ActiveBots.tsx +++ /dev/null @@ -1,211 +0,0 @@ -import { - ArrowDownIcon, - ArrowUpIcon, - ChevronDownIcon, - ChevronRightIcon, - PlayIcon, -} from '@heroicons/react/solid' -import React, { useEffect, useState } from 'react' - -import { Hub } from '../../../app/providers/Hubs' -import useApiUrlStore from '../../../app/store/apiStore' -import type { Account, TradingBot } from '../../../generated/ManagingApi' -import { - AccountClient, - BotClient, - TradeDirection, - TradeStatus, -} from '../../../generated/ManagingApi' -import { SelectColumnFilter, Table } from '../../mollecules' -import BacktestRowDetails from '../Backtest/backtestRowDetails' -import StatusBadge from '../StatusBadge/StatusBadge' -import Summary from '../Trading/Summary' - -export default function ActiveBots() { - const [bots, setBots] = useState([]) - const [accounts, setAccounts] = useState([]) - const { apiUrl } = useApiUrlStore() - - const columns = React.useMemo( - () => [ - { - Cell: ({ row }: any) => ( - // Use Cell to render an expander for each row. - // We can use the getToggleRowExpandedProps prop-getter - // to build the expander. - - {row.isExpanded ? ( - - ) : ( - - )} - - ), - - // Make sure it has an ID - Header: ({ getToggleAllRowsExpandedProps, isAllRowsExpanded }: any) => ( - - {isAllRowsExpanded ? 'v' : '>'} - - ), - // Build our expander column - id: 'expander', - }, - { - Cell: ({ cell }: any) => ( - <> - - - ), - Header: 'Status', - accessor: 'status', - disableFilters: true, - sortType: 'basic', - }, - { - accessor: 'isForWatchingOnly', - }, - { - Filter: SelectColumnFilter, - Header: 'Ticker', - accessor: 'ticker', - disableSortBy: true, - }, - { - Header: 'Account', - accessor: 'accountName', - }, - { - Filter: SelectColumnFilter, - Header: 'Timeframe', - accessor: 'timeframe', - disableSortBy: true, - }, - { - Filter: SelectColumnFilter, - Header: 'Scenario', - accessor: 'scenario', - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => ( - <> - { - <> - { - cell.row.values.positions.filter( - (p: any) => p.originDirection == TradeDirection.Long - ).length - }{' '} - - {' | '} - { - cell.row.values.positions.filter( - (p: any) => p.originDirection == TradeDirection.Short - ).length - }{' '} - {' '} - { - cell.row.values.positions.filter( - (p: any) => p.status == TradeStatus.Filled - ).length - }{' '} - {' '} - - } - - ), - Header: 'Positions', - accessor: 'positions', - disableFilters: true, - }, - { - Cell: ({ cell }) => <>{cell.row.values.winRate} %, - Header: 'Winrate', - accessor: 'winRate', - disableFilters: true, - }, - { - Cell: ({ cell }) => <>{cell.row.values.profitAndLoss} $, - Header: 'PNL', - accessor: 'profitAndLoss', - disableFilters: true, - }, - ], - [] - ) - - useEffect(() => { - setupHubConnection().then(() => { - if (bots.length == 0) { - const client = new BotClient({}, apiUrl) - client.bot_GetActiveBots().then((data) => { - setBots(data) - }) - } - }) - const client = new AccountClient({}, apiUrl) - client.account_GetAccounts().then((data) => { - setAccounts(data) - }) - }, []) - - const setupHubConnection = async () => { - const hub = new Hub('bothub', apiUrl).hub - - hub.on('BotsSubscription', (data: TradingBot[]) => { - // eslint-disable-next-line no-console - console.log( - 'bot List', - bots.map((bot) => { - return bot.name - }) - ) - setBots(data) - }) - - return hub - } - - const renderRowSubComponent = React.useCallback( - ({ row }: any) => ( - <> - - - ), - [] - ) - - return ( - <> -
    - -
    -
    - - - - ) -} diff --git a/src/Managing.WebApp/src/components/organism/Backtest/backtestCards.tsx b/src/Managing.WebApp/src/components/organism/Backtest/backtestCards.tsx deleted file mode 100644 index 4bb97e0..0000000 --- a/src/Managing.WebApp/src/components/organism/Backtest/backtestCards.tsx +++ /dev/null @@ -1,309 +0,0 @@ -import { DotsVerticalIcon, TrashIcon } from '@heroicons/react/solid' -import moment from 'moment' -import React from 'react' - -import useApiUrlStore from '../../../app/store/apiStore' -import type { - Backtest, - MoneyManagement, - StartBotRequest, - Ticker, -} from '../../../generated/ManagingApi' -import { - BacktestClient, - BotClient, - BotType, -} from '../../../generated/ManagingApi' -import type { IBacktestCards } from '../../../global/type' -import MoneyManagementModal from '../../../pages/settingsPage/moneymanagement/moneyManagementModal' -import { CardPosition, CardText, Toast } from '../../mollecules' -import CardPositionItem from '../Trading/CardPositionItem' -import TradeChart from '../Trading/TradeChart/TradeChart' - -function baseBadgeClass(isOutlined = false) { - let classes = 'text-xs badge ' - - if (isOutlined) { - classes += 'badge-outline ' - } - return classes -} - -function botStatusResult( - growthPercentage: number | undefined, - hodlPercentage: number | undefined -) { - if (growthPercentage != undefined && hodlPercentage != undefined) { - const isWinning = growthPercentage > hodlPercentage - const classes = - baseBadgeClass() + (isWinning ? 'badge-success' : 'badge-content') - return
    {isWinning ? 'Winning' : 'Losing'}
    - } -} - -// function that return the number of day between a date and today -function daysBetween(date: Date) { - const oneDay = 24 * 60 * 60 * 1000 // hours*minutes*seconds*milliseconds - const firstDate = new Date(date) - const secondDate = new Date() - const diffDays = Math.round( - Math.abs((firstDate.getTime() - secondDate.getTime()) / oneDay) - ) - return diffDays -} - -const BacktestCards: React.FC = ({ list, setBacktests }) => { - const { apiUrl } = useApiUrlStore() - const [showMoneyManagementModal, setShowMoneyManagementModal] = - React.useState(false) - const [selectedMoneyManagement, setSelectedMoneyManagement] = - React.useState() - - async function runBot(backtest: Backtest, isForWatchOnly: boolean) { - const t = new Toast('Bot is starting') - const client = new BotClient({}, apiUrl) - - const request: StartBotRequest = { - accountName: backtest.accountName, - botName: backtest.ticker + '-' + backtest.timeframe.toString(), - botType: BotType.ScalpingBot, - isForWatchOnly: isForWatchOnly, - moneyManagementName: backtest.moneyManagement?.name, - scenario: backtest.scenario, - ticker: backtest.ticker as Ticker, - timeframe: backtest.timeframe, - } - - await client - .bot_Start(request) - .then((botStatus: string) => { - t.update('info', 'Bot status :' + botStatus) - }) - .catch((err) => { - t.update('error', 'Error :' + err) - }) - } - - async function runOptimizedBacktest(backtest: Backtest) { - const t = new Toast('Optimized backtest is running') - const client = new BacktestClient({}, apiUrl) - - await client - .backtest_Run( - backtest.accountName, - backtest.botType, - backtest.ticker as Ticker, - backtest.scenario, - backtest.timeframe, - false, - daysBetween(backtest.candles[0].date), - backtest.walletBalances[0].value, - '', - false, - backtest.optimizedMoneyManagement - ) - .then((backtest: Backtest) => { - t.update('success', `${backtest.ticker} Backtest Succeeded`) - setBacktests((arr) => [...arr, backtest]) - }) - .catch((err) => { - t.update('error', 'Error :' + err) - }) - } - - function saveMoneyManagement(moneyManagement: MoneyManagement) { - setSelectedMoneyManagement(moneyManagement) - setShowMoneyManagementModal(true) - } - - return ( -
    - {list.map((backtest: Backtest, index) => ( -
    -
    -
    - -
    - -
    -
    - { - - } -
    - -
    -

    -
    - -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    -
    - {backtest.ticker} - {botStatusResult( - backtest.growthPercentage, - backtest.hodlPercentage - )} -

    -
    -
    - - - - -
    -
    -
    - - {/* */} - { - const realized = p.profitAndLoss?.realized ?? 0 - return realized > 0 ? p : null - })} - > - { - const realized = p.profitAndLoss?.realized ?? 0 - return realized <= 0 ? p : null - })} - > - -
    - -
    -
    - - - - -
    -
    -
    -
    - WR {backtest.winRate?.toFixed(2).toString()} % -
    -
    - PNL {backtest.growthPercentage?.toFixed(2).toString()} % -
    -
    -
    -
    -
    -
    - ))} - - setShowMoneyManagementModal(false)} - /> -
    - ) -} - -export default BacktestCards diff --git a/src/Managing.WebApp/src/components/organism/Backtest/backtestModal.tsx b/src/Managing.WebApp/src/components/organism/Backtest/backtestModal.tsx deleted file mode 100644 index f8c2f75..0000000 --- a/src/Managing.WebApp/src/components/organism/Backtest/backtestModal.tsx +++ /dev/null @@ -1,361 +0,0 @@ -import { useQuery } from '@tanstack/react-query' -import React, { useEffect, useState } from 'react' -import { useForm, type SubmitHandler } from 'react-hook-form' - -import useApiUrlStore from '../../../app/store/apiStore' -import type { - Backtest, - MoneyManagement, - Ticker, -} from '../../../generated/ManagingApi' -import { - AccountClient, - BacktestClient, - BotType, - DataClient, - MoneyManagementClient, - ScenarioClient, - Timeframe, -} from '../../../generated/ManagingApi' -import type { - BacktestModalProps, - IBacktestsFormInput, -} from '../../../global/type' -import { Loader, Slider } from '../../atoms' -import { Modal, Toast } from '../../mollecules' -import FormInput from '../../mollecules/FormInput/FormInput' -import CustomMoneyManagement from '../CustomMoneyManagement/CustomMoneyManagement' - -const BacktestModal: React.FC = ({ - showModal, - closeModal, - setBacktests, - showLoopSlider = false, -}) => { - const [selectedAccount, setSelectedAccount] = React.useState() - const [selectedTimeframe, setSelectedTimeframe] = React.useState() - const [selectedLoopQuantity, setLoopQuantity] = React.useState( - showLoopSlider ? 3 : 1 - ) - const [balance, setBalance] = React.useState(10000) - const [days, setDays] = React.useState(-10) - - const [customMoneyManagement, setCustomMoneyManagement] = - React.useState() - const [selectedMoneyManagement, setSelectedMoneyManagement] = - useState() - const [showCustomMoneyManagement, setShowCustomMoneyManagement] = - useState(false) - - const { apiUrl } = useApiUrlStore() - - const scenarioClient = new ScenarioClient({}, apiUrl) - const accountClient = new AccountClient({}, apiUrl) - const dataClient = new DataClient({}, apiUrl) - const moneyManagementClient = new MoneyManagementClient({}, apiUrl) - const backtestClient = new BacktestClient({}, apiUrl) - - const { register, handleSubmit } = useForm() - const onSubmit: SubmitHandler = async (form) => { - const { scenarioName, tickers } = form - closeModal() - for (let sIndex = 0; sIndex < scenarioName.length; sIndex++) { - for (let tIndex = 0; tIndex < tickers.length; tIndex++) { - await runBacktest( - form, - form.tickers[tIndex], - form.scenarioName[sIndex], - customMoneyManagement, - 1 - ) - } - } - } - - async function runBacktest( - form: IBacktestsFormInput, - ticker: string, - scenarioName: string, - moneyManagement: MoneyManagement | undefined, - loopCount: number - ) { - const t = new Toast(ticker + ' is running') - await backtestClient - .backtest_Run( - form.accountName, - form.botType, - ticker as Ticker, - scenarioName, - form.timeframe, - false, - days, - balance, - selectedMoneyManagement, - form.save, - selectedMoneyManagement ? undefined : moneyManagement - ) - .then((backtest: Backtest) => { - t.update('success', `${backtest.ticker} Backtest Succeeded`) - setBacktests((arr) => [...arr, backtest]) - - if (showLoopSlider && selectedLoopQuantity > loopCount) { - const nextCount = loopCount + 1 - const mm: MoneyManagement = { - balanceAtRisk: backtest.optimizedMoneyManagement.balanceAtRisk, - leverage: backtest.optimizedMoneyManagement.leverage, - name: backtest.optimizedMoneyManagement.name + nextCount, - stopLoss: backtest.optimizedMoneyManagement.stopLoss, - takeProfit: backtest.optimizedMoneyManagement.takeProfit, - timeframe: backtest.optimizedMoneyManagement.timeframe, - } - runBacktest(form, ticker, scenarioName, mm, nextCount) - } - }) - .catch((err) => { - t.update('error', 'Error :' + err) - }) - } - - function setSelectedAccountEvent(e: React.ChangeEvent) { - setSelectedAccount(e.target.value) - } - - function setSelectedTimeframeEvent(e: any) { - setSelectedTimeframe(e.target.value) - } - - function onMoneyManagementChange(e: any) { - if (e.target.value == 'Custom') { - setShowCustomMoneyManagement(true) - setSelectedMoneyManagement(e.target.value) - } else { - setShowCustomMoneyManagement(false) - setCustomMoneyManagement(undefined) - setSelectedMoneyManagement(undefined) - } - } - - const { data: scenarios } = useQuery({ - queryFn: () => scenarioClient.scenario_GetScenarios(), - queryKey: ['scenarios'], - }) - - const { data: accounts } = useQuery({ - onSuccess: () => { - if (accounts) { - setSelectedAccount(accounts[0].name) - } - setSelectedTimeframe(Timeframe.FiveMinutes) - }, - queryFn: () => accountClient.account_GetAccounts(), - queryKey: ['accounts'], - }) - - const { data: tickers, refetch: refetchTickers } = useQuery({ - enabled: !!selectedAccount && !!selectedTimeframe, - queryFn: () => { - if (selectedAccount && selectedTimeframe) { - return dataClient.data_GetTickers(selectedAccount, selectedTimeframe) - } - }, - queryKey: ['tickers', selectedAccount, selectedTimeframe], - }) - - const { data: moneyManagements } = useQuery({ - enabled: !!selectedTimeframe, - onSuccess: (data) => { - if (data) { - setSelectedMoneyManagement(data[0].name) - } - }, - queryFn: async () => { - if (selectedTimeframe) { - const mm = - await moneyManagementClient.moneyManagement_GetMoneyManagements() - mm.push({ - balanceAtRisk: 1, - leverage: 1, - name: 'Custom', - stopLoss: 1, - takeProfit: 1, - timeframe: selectedTimeframe, - }) - return mm - } - }, - queryKey: ['moneyManagements', selectedTimeframe], - }) - - useEffect(() => { - if (selectedAccount && selectedTimeframe) { - refetchTickers() - } - }, [selectedAccount, selectedTimeframe]) - - if (!accounts || !scenarios || !moneyManagements) { - return - } - - return ( - - - - - - - - - - - - - - - - - - - - setDays(e.target.value)} - step="1" - min="-360" - max="-1" - > - - - - setBalance(e.target.value)} - step="1000" - min="1000" - max="100000" - > - - - - - - - - - - - {/* Loop Quantity */} - {showLoopSlider ? ( - - setLoopQuantity(e.target.value)} - step="1" - min="1" - max="20" - > - - ) : null} - -
    - -
    - -
    - -
    -
    - ) -} -export default BacktestModal diff --git a/src/Managing.WebApp/src/components/organism/Backtest/backtestRowDetails.tsx b/src/Managing.WebApp/src/components/organism/Backtest/backtestRowDetails.tsx deleted file mode 100644 index 1ce93dd..0000000 --- a/src/Managing.WebApp/src/components/organism/Backtest/backtestRowDetails.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { TradeChart, CardPositionItem } from '..' -import type { IBotRowDetails } from '../../../global/interface' -import { CardPosition } from '../../mollecules' - -const BacktestRowDetails: React.FC = ({ - candles, - positions, - walletBalances, -}) => { - return ( - <> -
    -
    - { - const realized = p.profitAndLoss?.realized ?? 0 - return realized > 0 ? p : null - })} - > - { - const realized = p.profitAndLoss?.realized ?? 0 - return realized <= 0 ? p : null - })} - > - -
    -
    -
    - -
    -
    -
    - - ) -} - -export default BacktestRowDetails diff --git a/src/Managing.WebApp/src/components/organism/Backtest/backtestTable.tsx b/src/Managing.WebApp/src/components/organism/Backtest/backtestTable.tsx deleted file mode 100644 index 4289a33..0000000 --- a/src/Managing.WebApp/src/components/organism/Backtest/backtestTable.tsx +++ /dev/null @@ -1,275 +0,0 @@ -import { - ChevronDownIcon, - ChevronRightIcon, - PlayIcon, - TrashIcon, -} from '@heroicons/react/solid' -import React, { useEffect, useState } from 'react' - -import useApiUrlStore from '../../../app/store/apiStore' -import type { - Backtest, - StartBotRequest, - Ticker, -} from '../../../generated/ManagingApi' -import { BacktestClient, BotClient } from '../../../generated/ManagingApi' -import type { IBacktestCards } from '../../../global/type' -import { Toast, SelectColumnFilter, Table } from '../../mollecules' - -import BacktestRowDetails from './backtestRowDetails' - -const BacktestTable: React.FC = ({ list, isFetching }) => { - const [rows, setRows] = useState([]) - const { apiUrl } = useApiUrlStore() - - async function runBot(backtest: Backtest, isForWatchOnly: boolean) { - const t = new Toast('Bot is starting') - const client = new BotClient({}, apiUrl) - - const request: StartBotRequest = { - accountName: backtest.accountName, - botName: backtest.ticker + '-' + backtest.timeframe.toString(), - botType: backtest.botType, - isForWatchOnly: isForWatchOnly, - moneyManagementName: '', - scenario: backtest.scenario, - ticker: backtest.ticker as Ticker, - timeframe: backtest.timeframe, - } - - await client - .bot_Start(request) - .then((botStatus: string) => { - t.update('info', 'Bot status :' + botStatus) - }) - .catch((err) => { - t.update('error', 'Error :' + err) - }) - } - - async function deleteBacktest(id: string) { - const t = new Toast('Deleting backtest') - const client = new BacktestClient({}, apiUrl) - - await client - .backtest_DeleteBacktest(id) - .then(() => { - t.update('success', 'Backtest deleted') - }) - .catch((err) => { - t.update('error', err) - }) - } - - const columns = React.useMemo( - () => [ - { - Header: 'Informations', - columns: [ - { - Cell: ({ row }: any) => ( - // Use Cell to render an expander for each row. - // We can use the getToggleRowExpandedProps prop-getter - // to build the expander. - - {row.isExpanded ? ( - - ) : ( - - )} - - ), - - // Make sure it has an ID - Header: ({ - getToggleAllRowsExpandedProps, - isAllRowsExpanded, - }: any) => ( - - {isAllRowsExpanded ? 'v' : '>'} - - ), - // Build our expander column - id: 'expander', - }, - { - Filter: SelectColumnFilter, - Header: 'Ticker', - accessor: 'ticker', - disableSortBy: true, - }, - { - Filter: SelectColumnFilter, - Header: 'Timeframe', - accessor: 'timeframe', - disableSortBy: true, - }, - { - Filter: SelectColumnFilter, - Header: 'Scenario', - accessor: 'scenario', - disableSortBy: true, - }, - { - Filter: SelectColumnFilter, - Header: 'BotType', - accessor: 'botType', - disableSortBy: true, - }, - { - Filter: SelectColumnFilter, - Header: 'Account', - accessor: 'accountName', - disableSortBy: true, - }, - ], - }, - { - Header: 'Results', - columns: [ - { - Cell: ({ cell }: any) => ( - <>{cell.row.values.finalPnl.toFixed(2)} $ - ), - Header: 'Pnl $', - accessor: 'finalPnl', - disableFilters: true, - sortType: 'basic', - }, - { - Cell: ({ cell }: any) => ( - <>{cell.row.values.hodlPercentage.toFixed(2)} % - ), - Header: 'Hodl %', - accessor: 'hodlPercentage', - disableFilters: true, - sortType: 'basic', - }, - { - Cell: ({ cell }: any) => <>{cell.row.values.winRate} %, - Header: 'Winrate', - accessor: 'winRate', - disableFilters: true, - }, - { - Cell: ({ cell }: any) => ( - <>{cell.row.values.growthPercentage.toFixed(2)} % - ), - Header: 'Pnl %', - accessor: 'growthPercentage', - disableFilters: true, - sortType: 'basic', - }, - { - Cell: ({ cell }: any) => ( - <> - {( - cell.row.values.growthPercentage - - cell.row.values.hodlPercentage - ).toFixed(2)} - - ), - Header: 'H/P', - accessor: 'diff', - disableFilters: true, - sortType: 'basic', - }, - ], - }, - { - Header: 'Action', - columns: [ - { - Cell: ({ cell }: any) => ( - <> -
    - -
    - - ), - Header: '', - accessor: 'id', - disableFilters: true, - }, - // { - // Cell: ({ cell }) => ( - // <> - //
    - // - //
    - // - // ), - // Header: '', - // accessor: 'watcher', - // disableFilters: true, - // }, - { - Cell: ({ cell }: any) => ( - <> -
    - -
    - - ), - Header: '', - accessor: 'bot', - disableFilters: true, - }, - ], - }, - ], - [] - ) - - useEffect(() => { - setRows(list) - }, [list]) - - const renderRowSubComponent = React.useCallback( - ({ row }: any) => ( - <> - - - ), - [] - ) - - return ( -
    - {isFetching ? ( - - ) : ( -
    - )} - - ) -} - -export default BacktestTable diff --git a/src/Managing.WebApp/src/components/organism/CustomMoneyManagement/CustomMoneyManagement.tsx b/src/Managing.WebApp/src/components/organism/CustomMoneyManagement/CustomMoneyManagement.tsx deleted file mode 100644 index 78f3573..0000000 --- a/src/Managing.WebApp/src/components/organism/CustomMoneyManagement/CustomMoneyManagement.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import React, { useEffect, useState } from 'react' - -import type { MoneyManagement, Timeframe } from '../../../generated/ManagingApi' -import { Slider } from '../../atoms' -import FormInput from '../../mollecules/FormInput/FormInput' - -type ICustomMoneyManagement = { - onCreateMoneyManagement: (moneyManagement: MoneyManagement) => void - timeframe: Timeframe - showCustomMoneyManagement: boolean -} - -const CustomMoneyManagement: React.FC = ({ - onCreateMoneyManagement, - timeframe, - showCustomMoneyManagement, -}) => { - const [balanceAtRisk, setBalanceAtRisk] = useState(1) - const [leverage, setLeverage] = useState(1) - const [takeProfit, setTakeProfit] = useState(1) - const [stopLoss, setStopLoss] = useState(1) - - const handleCreateMoneyManagement = () => { - const moneyManagement: MoneyManagement = { - balanceAtRisk, - leverage, - name: 'custom', - stopLoss, - takeProfit, - timeframe, - } - onCreateMoneyManagement(moneyManagement) - } - - useEffect(() => { - handleCreateMoneyManagement() - }, [balanceAtRisk, leverage, takeProfit, stopLoss]) - - return ( - <> - {showCustomMoneyManagement ? ( -
    - -
    - Custom MoneyManagement -
    -
    - - setBalanceAtRisk(parseInt(e.target.value))} - min="1" - max="100" - step="1" - suffixValue=" %" - > - - - - setLeverage(e.target.value)} - prefixValue="x " - > - - - - setTakeProfit(e.target.value)} - step="0.01" - max="20" - suffixValue=" %" - > - - - - setStopLoss(e.target.value)} - step="0.01" - max="20" - suffixValue=" %" - > - -
    -
    - ) : null} - - ) -} - -export default CustomMoneyManagement diff --git a/src/Managing.WebApp/src/components/organism/Positions/PositionList.tsx b/src/Managing.WebApp/src/components/organism/Positions/PositionList.tsx deleted file mode 100644 index af7231d..0000000 --- a/src/Managing.WebApp/src/components/organism/Positions/PositionList.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import { StopIcon } from '@heroicons/react/solid' -import moment from 'moment' -import React from 'react' - -import useApiUrlStore from '../../../app/store/apiStore' -import { - TradeDirection, - type Position, - Ticker, - PositionStatus, - TradingClient, -} from '../../../generated/ManagingApi' -import { Toast, Table } from '../../mollecules' - -import PositionStatusBadge from './PositionStatusBadge' - -type IPositionList = { - positions: Position[] - isFetching: boolean -} - -const PositionsList: React.FC = ({ positions, isFetching }) => { - const { apiUrl } = useApiUrlStore() - - async function closePosition(identifier: string) { - const t = new Toast('Closing position') - const client = new TradingClient({}, apiUrl) - await client - .trading_ClosePosition(identifier) - .then(() => { - t.update('success', 'Position closed') - }) - .catch((err) => { - t.update('error', 'Error :' + err) - }) - } - - const columns = React.useMemo( - () => [ - { - Cell: ({ cell }: any) => ( - <> -
    - -
    - - ), - Header: 'Status', - accessor: 'status', - disableFilters: true, - sortType: 'basic', - }, - - { - Cell: ({ cell }: any) =>
    {Object.values(Ticker)[cell.value]}
    , - Header: 'Ticker', - accessor: 'ticker', - disableFilters: true, - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => ( -
    {Object.values(TradeDirection)[cell.value]}
    - ), - Header: 'Direction', - accessor: 'originDirection', - disableFilters: true, - disableSortBy: true, - }, - { - Header: 'Account', - accessor: 'accountName', - disableFilters: true, - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => moment(cell.value).fromNow(), - Header: 'Date', - accessor: 'date', - disableFilters: true, - }, - { - Cell: ({ cell }: any) => ( -
    {(cell.value.realized as number).toFixed(4)} $
    - ), - Header: 'uPNL', - accessor: 'profitAndLoss', - disableFilters: true, - }, - { - Cell: ({ cell }) => ( - <> -
    - -
    - - ), - Header: 'Actions', - accessor: 'identifier', - disableFilters: true, - }, - ], - [] - ) - return ( -
    - {isFetching ? ( -
    - -
    - ) : ( -
    - )} - - ) -} - -export default PositionsList diff --git a/src/Managing.WebApp/src/components/organism/Positions/PositionStatusBadge.tsx b/src/Managing.WebApp/src/components/organism/Positions/PositionStatusBadge.tsx deleted file mode 100644 index 2ac4f64..0000000 --- a/src/Managing.WebApp/src/components/organism/Positions/PositionStatusBadge.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { PositionStatus } from '../../../generated/ManagingApi' - -type IPositionStatusBadge = { - status: PositionStatus -} -function statusClasses(status: PositionStatus) { - let commonClasses = 'badge badge-xs ' - switch (status) { - case PositionStatus.Canceled: - case PositionStatus.Rejected: - commonClasses += 'bg-red-100' - break - case PositionStatus.New: - commonClasses += 'bg-blue-100' - break - case PositionStatus.PartiallyFilled: - commonClasses += 'bg-orange-100' - break - case PositionStatus.Filled: - commonClasses += 'bg-green-100' - break - default: - break - } - return commonClasses -} - -export default function PositionStatusBadge({ status }: IPositionStatusBadge) { - return -} diff --git a/src/Managing.WebApp/src/components/organism/SpotLightBadge/SpotLightBadge.tsx b/src/Managing.WebApp/src/components/organism/SpotLightBadge/SpotLightBadge.tsx deleted file mode 100644 index c1e260a..0000000 --- a/src/Managing.WebApp/src/components/organism/SpotLightBadge/SpotLightBadge.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import moment from 'moment' - -import { TradeDirection } from '../../../generated/ManagingApi' -import type { ISpotlightBadge } from '../../../global/type' - -function GetBadgeColor(direction: TradeDirection | undefined) { - switch (direction) { - case TradeDirection.Long: - return 'badge bg-success' - case TradeDirection.Short: - return 'badge bg-error' - case TradeDirection.None: - return 'badge bg-warning' - default: - return 'badge' - } -} - -export default function SpotLightBadge({ - direction, - date, - price, -}: ISpotlightBadge) { - const tooltipText = - date == undefined ? 'No signal' : moment(date).fromNow() + ' @ ' + price - return ( -
    -
    -
    - ) -} diff --git a/src/Managing.WebApp/src/components/organism/StatusBadge/StatusBadge.tsx b/src/Managing.WebApp/src/components/organism/StatusBadge/StatusBadge.tsx deleted file mode 100644 index 4c44184..0000000 --- a/src/Managing.WebApp/src/components/organism/StatusBadge/StatusBadge.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import type { IStatusBadge } from '../../../global/type' - -function statusClasses(status: string, isForWatchOnly: boolean) { - const commonClasses = 'badge badge-xs' - if (isForWatchOnly) { - return `${commonClasses} 'bg-blue-500'` - } - - return `${commonClasses} ${status == 'Up' ? 'bg-green-500' : 'bg-red-500'}` -} - -export default function StatusBadge({ status, isForWatchOnly }: IStatusBadge) { - return -} diff --git a/src/Managing.WebApp/src/components/organism/Trading/CardPositionItem.tsx b/src/Managing.WebApp/src/components/organism/Trading/CardPositionItem.tsx deleted file mode 100644 index 8a8e192..0000000 --- a/src/Managing.WebApp/src/components/organism/Trading/CardPositionItem.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { PositionStatus } from '../../../generated/ManagingApi' -import type { ICardPositionFlipped } from '../../../global/type' -import { CardText } from '../../mollecules' - -const CardPositionFlipped: React.FC = ({ positions }) => { - return ( - <> - { - const realized = p.profitAndLoss?.realized ?? 0 - return realized > 0 && p.status == PositionStatus.Flipped - ? p - : null - }) - .length.toString() + - ' | ' + - positions - .filter((p) => { - const realized = p.profitAndLoss?.realized ?? 0 - return realized <= 0 && p.status == PositionStatus.Flipped - ? p - : null - }) - .length.toString() - } - > - - ) -} - -export default CardPositionFlipped diff --git a/src/Managing.WebApp/src/components/organism/Trading/Summary.tsx b/src/Managing.WebApp/src/components/organism/Trading/Summary.tsx deleted file mode 100644 index 021531d..0000000 --- a/src/Managing.WebApp/src/components/organism/Trading/Summary.tsx +++ /dev/null @@ -1,133 +0,0 @@ -import { ArrowDownIcon, ArrowUpIcon } from '@heroicons/react/solid' -import React, { useEffect, useState } from 'react' - -import type { TradingBot } from '../../../generated/ManagingApi' -import { PositionStatus, TradeDirection } from '../../../generated/ManagingApi' -import type { IAccountBalanceProps } from '../../../global/type' - -function GetGlobalWinrate(bots: TradingBot[]) { - if (bots == null || bots == undefined || bots.length == 0) { - return 0 - } - - let totalPositions = 0 - let winningPosition = 0 - - bots.forEach((bot) => { - totalPositions += bot.positions.filter( - (p) => p.status != PositionStatus.New - ).length - winningPosition += bot.positions.filter((p) => { - const realized = p.profitAndLoss?.realized ?? 0 - return realized > 0 && - (p.status == PositionStatus.Finished || - p.status == PositionStatus.Flipped) - ? p - : null - }).length - }) - - if (totalPositions == 0) return 0 - - return (winningPosition * 100) / totalPositions -} - -function GetPositionCount( - bots: TradingBot[], - direction: TradeDirection, - status: PositionStatus -) { - let totalPositions = 0 - - if (bots == null || bots == undefined) { - return 0 - } - - bots.forEach((bot) => { - totalPositions += bot.positions.filter( - (p) => p.status == status && p.originDirection == direction - ).length - }) - - return totalPositions -} - -const Summary: React.FC = ({ bots }) => { - const [globalPnl, setGlobalPnl] = useState(0) - const [globalWinrate, setGlobalWinrate] = useState(0) - - const [openLong, setLong] = useState(0) - const [openShort, setShort] = useState(0) - - const [closedLong, setClosedLong] = useState(0) - const [closedShort, setClosedShort] = useState(0) - - useEffect(() => { - if (bots) { - const pnl = bots.reduce((acc, bot) => { - return acc + bot.profitAndLoss - }, 0) - setGlobalPnl(pnl) - setGlobalWinrate(GetGlobalWinrate(bots)) - setLong( - GetPositionCount(bots, TradeDirection.Long, PositionStatus.Filled) - ) - setShort( - GetPositionCount(bots, TradeDirection.Short, PositionStatus.Filled) - ) - setClosedLong( - GetPositionCount(bots, TradeDirection.Long, PositionStatus.Finished) + - GetPositionCount(bots, TradeDirection.Long, PositionStatus.Flipped) - ) - setClosedShort( - GetPositionCount(bots, TradeDirection.Short, PositionStatus.Finished) + - GetPositionCount(bots, TradeDirection.Short, PositionStatus.Flipped) - ) - } - }, [bots]) - - return ( -
    -
    - -
    -
    -
    Bots running
    -
    {bots.length}
    -
    - -
    -
    Total Profit
    -
    {globalPnl.toFixed(4)} $
    -
    - -
    -
    Global Winrate
    -
    - {globalWinrate ? globalWinrate.toFixed(2) : 0} % -
    -
    - -
    -
    Positions Openend
    -
    - {openLong} {' '} - {openShort}{' '} - {' '} -
    -
    -
    -
    Positions Closed
    -
    - {closedLong}{' '} - {' '} - {closedShort}{' '} - {' '} -
    -
    -
    -
    - ) -} - -export default Summary diff --git a/src/Managing.WebApp/src/components/organism/Trading/TradeChart/TradeChart.tsx b/src/Managing.WebApp/src/components/organism/Trading/TradeChart/TradeChart.tsx deleted file mode 100644 index 60d4daa..0000000 --- a/src/Managing.WebApp/src/components/organism/Trading/TradeChart/TradeChart.tsx +++ /dev/null @@ -1,302 +0,0 @@ -import type { - CandlestickData, - IChartApi, - ISeriesApi, - PriceLineOptions, - SeriesMarker, - SeriesMarkerShape, - Time, - UTCTimestamp, -} from 'lightweight-charts' -import { LineStyle, createChart, CrosshairMode } from 'lightweight-charts' -import moment from 'moment' -import * as React from 'react' -import { useEffect, useRef, useState } from 'react' - -import type { - Candle, - KeyValuePairOfDateTimeAndDecimal, - Position, - Signal, -} from '../../../../generated/ManagingApi' -import { - PositionStatus, - TradeDirection, -} from '../../../../generated/ManagingApi' -import useTheme from '../../../../hooks/useTheme' - -type ITradeChartProps = { - candles: Candle[] - positions: Position[] - signals: Signal[] - walletBalances?: KeyValuePairOfDateTimeAndDecimal[] | null - stream?: Candle | null - width: number - height: number -} - -const TradeChart = ({ - candles, - positions, - signals, - walletBalances, - stream, - width, - height, -}: ITradeChartProps) => { - const chartRef = React.useRef(null) - const chart = useRef() - const { themeProperty } = useTheme() - const theme = themeProperty() - const series1 = useRef>() - const [timeDiff, setTimeDiff] = useState(0) - const [candleCount, setCandleCount] = useState(candles.length) - - function buildLine( - color: string, - price: number, - title: string - ): PriceLineOptions { - return { - axisLabelVisible: true, - color: color, - lineStyle: LineStyle.Dotted, - lineVisible: true, - lineWidth: 1, - price: price, - title: title, - } - } - - function buildMarker( - shape: SeriesMarkerShape, - color: string, - direction: TradeDirection, - date: Date, - text?: string - ): SeriesMarker
    - - ) -} - -export default ScenarioTable diff --git a/src/Managing.WebApp/src/pages/scenarioPage/strategyList.tsx b/src/Managing.WebApp/src/pages/scenarioPage/strategyList.tsx deleted file mode 100644 index e75e916..0000000 --- a/src/Managing.WebApp/src/pages/scenarioPage/strategyList.tsx +++ /dev/null @@ -1,401 +0,0 @@ -import React, { useEffect, useState } from 'react' -import type { SubmitHandler } from 'react-hook-form' -import { useForm } from 'react-hook-form' -import 'react-toastify/dist/ReactToastify.css' - -import useApiUrlStore from '../../app/store/apiStore' -import { Toast } from '../../components/mollecules' -import type { Strategy } from '../../generated/ManagingApi' -import { - StrategyType, - ScenarioClient, - Timeframe, -} from '../../generated/ManagingApi' - -import StrategyTable from './strategyTable' - -interface IStrategyFormInput { - type: StrategyType - timeframe: Timeframe - name: string - period: number - fastPeriods: number - slowPeriods: number - signalPeriods: number - multiplier: number - stochPeriods: number - smoothPeriods: number - cyclePeriods: number -} - -const StrategyList: React.FC = () => { - const [strategyType, setStrategyType] = useState( - StrategyType.RsiDivergence - ) - const [strategies, setStrategies] = useState([]) - const [showModal, setShowModal] = useState(false) - const { register, handleSubmit } = useForm() - const { apiUrl } = useApiUrlStore() - const scenarioClient = new ScenarioClient({}, apiUrl) - - async function createStrategy(form: IStrategyFormInput) { - const t = new Toast('Creating strategy') - await scenarioClient - .scenario_CreateStrategy( - form.type, - form.timeframe, - form.name, - form.period, - form.fastPeriods, - form.slowPeriods, - form.signalPeriods, - form.multiplier, - form.stochPeriods, - form.smoothPeriods, - form.cyclePeriods - ) - .then((strategy: Strategy) => { - t.update('success', 'Strategy created') - setStrategies((arr) => [...arr, strategy]) - }) - .catch((err) => { - t.update('error', err) - }) - } - - function setStrategyTypeEvent(e: any) { - setStrategyType(e.target.value) - } - - const onSubmit: SubmitHandler = async (form) => { - closeModal() - await createStrategy(form) - } - - useEffect(() => { - scenarioClient.scenario_GetStrategies().then((data) => { - setStrategies(data) - }) - }, []) - - function openModal() { - setShowModal(true) - } - - function closeModal() { - setShowModal(false) - } - - return ( -
    -
    - - - {showModal ? ( - <> -
    -
    -
    -
    - -
    - Strategy builder -
    -
    -
    - - -
    -
    -
    -
    - - -
    -
    -
    -
    - - -
    -
    - - {strategyType == StrategyType.EmaTrend || - strategyType == StrategyType.RsiDivergence || - strategyType == StrategyType.StDev || - strategyType == StrategyType.EmaCross || - strategyType == StrategyType.RsiDivergenceConfirm ? ( - <> -
    -
    - - -
    -
    - - ) : null} - - {strategyType == StrategyType.MacdCross ? ( - <> -
    -
    - - -
    -
    -
    -
    - - -
    -
    -
    -
    - - -
    -
    - - ) : null} - - {strategyType == StrategyType.Stc ? ( - <> -
    -
    - - -
    -
    -
    -
    - - -
    -
    -
    -
    - - -
    -
    - - ) : null} - - {strategyType == StrategyType.SuperTrend || - strategyType == StrategyType.ChandelierExit ? ( - <> -
    -
    - - -
    -
    -
    -
    - - -
    -
    - - ) : null} - - {strategyType == StrategyType.StochRsiTrend ? ( - <> -
    -
    - - -
    -
    -
    -
    - - -
    -
    -
    -
    - - -
    -
    -
    -
    - - -
    -
    - - ) : null} -
    - -
    -
    -
    - -
    - - ) : null} -
    -
    - ) -} - -export default StrategyList diff --git a/src/Managing.WebApp/src/pages/scenarioPage/strategyTable.tsx b/src/Managing.WebApp/src/pages/scenarioPage/strategyTable.tsx deleted file mode 100644 index 6743d86..0000000 --- a/src/Managing.WebApp/src/pages/scenarioPage/strategyTable.tsx +++ /dev/null @@ -1,94 +0,0 @@ -import { TrashIcon } from '@heroicons/react/solid' -import React, { useEffect, useState } from 'react' - -import useApiUrlStore from '../../app/store/apiStore' -import { SelectColumnFilter, Table, Toast } from '../../components/mollecules' -import type { Strategy } from '../../generated/ManagingApi' -import { ScenarioClient } from '../../generated/ManagingApi' - -interface IStrategyList { - list: Strategy[] -} - -const StrategyTable: React.FC = ({ list }) => { - const [rows, setRows] = useState([]) - const { apiUrl } = useApiUrlStore() - - async function deleteBacktest(id: string) { - const t = new Toast('Deleting strategy') - const client = new ScenarioClient({}, apiUrl) - - await client - .scenario_DeleteStrategy(id) - .then(() => { - t.update('info', 'Strategy deleted') - }) - .catch((err) => { - t.update('error', err) - }) - } - - const columns = React.useMemo( - () => [ - { - Header: 'Name', - accessor: 'name', - disableFilters: true, - }, - { - Filter: SelectColumnFilter, - Header: 'Type', - accessor: 'type', - disableSortBy: true, - }, - { - Filter: SelectColumnFilter, - Header: 'Timeframe', - accessor: 'timeframe', - disableSortBy: true, - }, - { - Filter: SelectColumnFilter, - Header: 'Signal', - accessor: 'signalType', - disableSortBy: true, - }, - { - Filter: SelectColumnFilter, - Header: 'Period', - accessor: 'period', - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => ( - <> -
    - -
    - - ), - Header: '', - accessor: 'id', - disableFilters: true, - }, - ], - [] - ) - - useEffect(() => { - setRows(list) - }, [list]) - - return ( -
    -
    - - ) -} - -export default StrategyTable diff --git a/src/Managing.WebApp/src/pages/settingsPage/account/accountModal.tsx b/src/Managing.WebApp/src/pages/settingsPage/account/accountModal.tsx deleted file mode 100644 index 84681f0..0000000 --- a/src/Managing.WebApp/src/pages/settingsPage/account/accountModal.tsx +++ /dev/null @@ -1,178 +0,0 @@ -import { useState } from 'react' -import type { SubmitHandler } from 'react-hook-form' -import { useForm } from 'react-hook-form' - -import useApiUrlStore from '../../../app/store/apiStore' -import { Modal, Toast } from '../../../components/mollecules' -import type { Account } from '../../../generated/ManagingApi' -import { - AccountType, - AccountClient, - TradingExchanges, -} from '../../../generated/ManagingApi' -import type { IAccountFormInput, IModalProps } from '../../../global/type' - -const AccountModal: React.FC = ({ showModal, toggleModal }) => { - const [selectedExchange, setSelectedExchange] = useState() - const [selectedType, setSelectedType] = useState() - const { register, handleSubmit } = useForm() - const { apiUrl } = useApiUrlStore() - - async function createMoneyManagement(form: IAccountFormInput) { - const t = new Toast('Creating account') - const client = new AccountClient({}, apiUrl) - const a: Account = { - exchange: form.exchange, - key: form.key, - name: form.name, - secret: form.secret, - type: form.type, - } - await client - .account_PostAccount(a) - .then(() => { - t.update('success', 'Account created') - }) - .catch((err) => { - t.update('error', 'Error :' + err) - }) - } - const onSubmit: SubmitHandler = async (form) => { - // @ts-ignore - toggleModal() - await createMoneyManagement(form) - } - - function setSelectedExchangeEvent(e: any) { - setSelectedExchange(e.target.value) - } - - function setSelectedTypeEvent(e: any) { - setSelectedType(e.target.value) - } - - return ( -
    - -
    -
    - - -
    -
    - -
    -
    - - -
    -
    - -
    -
    - - -
    -
    - - {selectedExchange != TradingExchanges.Evm && - selectedType != AccountType.Trader ? ( - <> -
    -
    - - -
    -
    - -
    -
    - - -
    -
    - - ) : null} - - {selectedExchange == TradingExchanges.Evm && - selectedType == AccountType.Watch ? ( - <> -
    -
    - - -
    -
    - - ) : null} - -
    - -
    -
    -
    - ) -} - -export default AccountModal diff --git a/src/Managing.WebApp/src/pages/settingsPage/account/accountRowDetails.tsx b/src/Managing.WebApp/src/pages/settingsPage/account/accountRowDetails.tsx deleted file mode 100644 index 47d8415..0000000 --- a/src/Managing.WebApp/src/pages/settingsPage/account/accountRowDetails.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import React from 'react' - -import { SelectColumnFilter, Table } from '../../../components/mollecules' -import { IAccountRowDetail } from '../../../global/type' - -const columns = [ - { - Header: 'Chain', - accessor: 'chain.name', - disableFilters: true, - disableSortBy: true, - }, - { - Filter: SelectColumnFilter, - Header: 'Assets', - accessor: 'tokenName', - disableFilters: true, - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => ( - <> -
    - {cell.row.values.amount.toFixed(4)} -
    - - ), - Header: 'Quantity', - accessor: 'amount', - disableFilters: true, - }, - { - Cell: ({ cell }: any) => <>{cell.row.values.value.toFixed(2)} $, - Header: 'USD', - accessor: 'value', - disableFilters: true, - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => <> {cell.row.values.price} $, - Header: 'Price', - accessor: 'price', - disableFilters: true, - }, -] - -const AccountRowDetails: React.FC = ({ - balances, - showTotal, -}) => { - return ( - <> -
    - - ) -} - -export default AccountRowDetails diff --git a/src/Managing.WebApp/src/pages/settingsPage/account/accountSettings.tsx b/src/Managing.WebApp/src/pages/settingsPage/account/accountSettings.tsx deleted file mode 100644 index 708dde6..0000000 --- a/src/Managing.WebApp/src/pages/settingsPage/account/accountSettings.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import React, { useEffect, useState } from 'react' - -import useApiUrlStore from '../../../app/store/apiStore' -import type { Account } from '../../../generated/ManagingApi' -import { AccountClient } from '../../../generated/ManagingApi' - -import AccountModal from './accountModal' -import AccountTable from './accountTable' - -const AccountSettings: React.FC = () => { - const [accounts, setAccounts] = useState([]) - const [showModal, setShowModal] = useState(false) - const { apiUrl } = useApiUrlStore() - const [isFetching, setIsFetching] = useState(false) - - useEffect(() => { - const client = new AccountClient({}, apiUrl) - setIsFetching(true) - client - .account_GetAccountsBalances() - .then((data) => { - setAccounts(data) - }) - .finally(() => setIsFetching(false)) - }, []) - - function toggleModal() { - setShowModal(!showModal) - } - - function openModal() { - setShowModal(true) - } - - return ( -
    -
    - - - -
    -
    - ) -} -export default AccountSettings diff --git a/src/Managing.WebApp/src/pages/settingsPage/account/accountTable.tsx b/src/Managing.WebApp/src/pages/settingsPage/account/accountTable.tsx deleted file mode 100644 index 5574e3c..0000000 --- a/src/Managing.WebApp/src/pages/settingsPage/account/accountTable.tsx +++ /dev/null @@ -1,163 +0,0 @@ -import { - ChevronDownIcon, - ChevronRightIcon, - ClipboardCopyIcon, - TrashIcon, -} from '@heroicons/react/solid' -import React, { useEffect, useState, useMemo } from 'react' - -import useApiUrlStore from '../../../app/store/apiStore' -import { - SelectColumnFilter, - Table, - Toast, -} from '../../../components/mollecules' -import type { Account } from '../../../generated/ManagingApi' -import { AccountClient } from '../../../generated/ManagingApi' - -import AccountRowDetails from './accountRowDetails' - -interface IAccountList { - list: Account[] - isFetching: boolean -} - -const AccountTable: React.FC = ({ list, isFetching }) => { - const [rows, setRows] = useState([]) - const { apiUrl } = useApiUrlStore() - - async function deleteAcount(accountName: string) { - const t = new Toast('Deleting money management') - const client = new AccountClient({}, apiUrl) - - await client - .account_DeleteAccount(accountName) - .then(() => { - t.update('success', 'Account deleted') - }) - .catch((err) => { - t.update('error', 'Error :' + err) - }) - } - - const columns = useMemo( - () => [ - { - Cell: ({ row }: any) => ( - - {row.isExpanded ? ( - - ) : ( - - )} - - ), - - // Make sure it has an ID - Header: ({ getToggleAllRowsExpandedProps, isAllRowsExpanded }: any) => ( - - {isAllRowsExpanded ? 'v' : '>'} - - ), - // Build our expander column - id: 'expander', - }, - { - Header: 'Name', - accessor: 'name', - disableFilters: true, - }, - { - Filter: SelectColumnFilter, - Header: 'Exchange', - accessor: 'exchange', - disableSortBy: true, - }, - { - Filter: SelectColumnFilter, - Header: 'Type', - accessor: 'type', - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => ( - <> -
    - {cell.row.values.key.substring(0, 6)}... - {cell.row.values.key.slice(-4)} -
    - - ), - Header: 'Key', - accessor: 'key', - disableFilters: true, - }, - { - Cell: ({ cell }: any) => ( - <> -
    - -
    -
    - -
    - - ), - Header: 'Actions', - accessor: 'id', - disableFilters: true, - }, - ], - [] - ) - - useEffect(() => { - setRows(list) - }, [list]) - - const renderRowSubComponent = React.useCallback( - ({ row }: any) => ( - <> - {row.original.balances != undefined ? ( - - ) : ( -
    No balances
    - )} - - ), - [] - ) - - return ( - <> - {isFetching ? ( -
    - -
    - ) : ( -
    - )} - - ) -} - -export default AccountTable diff --git a/src/Managing.WebApp/src/pages/settingsPage/moneymanagement/moneyManagement.tsx b/src/Managing.WebApp/src/pages/settingsPage/moneymanagement/moneyManagement.tsx deleted file mode 100644 index 7e5bbda..0000000 --- a/src/Managing.WebApp/src/pages/settingsPage/moneymanagement/moneyManagement.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import React, { useEffect, useState } from 'react' - -import useApiUrlStore from '../../../app/store/apiStore' -import type { MoneyManagement } from '../../../generated/ManagingApi' -import { MoneyManagementClient } from '../../../generated/ManagingApi' - -import MoneyManagementModal from './moneyManagementModal' -import MoneyManagementTable from './moneymanagementTable' - -const MoneyManagementSettings: React.FC = () => { - const [moneyManagements, setMoneyManagements] = useState( - [] - ) - const [showModal, setShowModal] = useState(false) - const { apiUrl } = useApiUrlStore() - - useEffect(() => { - const client = new MoneyManagementClient({}, apiUrl) - client.moneyManagement_GetMoneyManagements().then((data) => { - setMoneyManagements(data) - }) - }, []) - - function toggleModal() { - setShowModal(!showModal) - } - - function openModal() { - setShowModal(true) - } - - function closeModal() { - setShowModal(false) - } - - return ( -
    -
    - - - -
    -
    - ) -} -export default MoneyManagementSettings diff --git a/src/Managing.WebApp/src/pages/settingsPage/moneymanagement/moneyManagementModal.tsx b/src/Managing.WebApp/src/pages/settingsPage/moneymanagement/moneyManagementModal.tsx deleted file mode 100644 index 79043dd..0000000 --- a/src/Managing.WebApp/src/pages/settingsPage/moneymanagement/moneyManagementModal.tsx +++ /dev/null @@ -1,190 +0,0 @@ -import { useEffect, useState } from 'react' -import type { SubmitHandler } from 'react-hook-form' -import { useForm } from 'react-hook-form' - -import useApiUrlStore from '../../../app/store/apiStore' -import { Slider } from '../../../components/atoms' -import { FormInput, Modal, Toast } from '../../../components/mollecules' -import type { MoneyManagement } from '../../../generated/ManagingApi' -import { - MoneyManagementClient, - Timeframe, -} from '../../../generated/ManagingApi' -import type { - IMoneyManagementModalProps, - IMoneyManagementFormInput, -} from '../../../global/type' - -const MoneyManagementModal: React.FC = ({ - showModal, - onClose, - moneyManagement, - disableInputs = false, -}) => { - const [balanceAtRisk, setBalanceAtRisk] = useState(5) - const [takeProfit, setTakeProfit] = useState(20) - const [name, setName] = useState('') - const [stopLoss, setStopLoss] = useState(10) - const [leverage, setLeverage] = useState(1) - const [timeframe, setTimeframe] = useState( - Timeframe.FifteenMinutes - ) - const { reset, register, handleSubmit } = useForm() - const { apiUrl } = useApiUrlStore() - - async function createMoneyManagement(form: IMoneyManagementFormInput) { - const t = new Toast('Creating settings') - const client = new MoneyManagementClient({}, apiUrl) - const mm: MoneyManagement = { - balanceAtRisk: balanceAtRisk / 100, - leverage: leverage, - name: name, - stopLoss: stopLoss / 100, - takeProfit: takeProfit / 100, - timeframe: form.timeframe, - } - - await client - .moneyManagement_PostMoneyManagement(mm) - .then(() => { - t.update('success', 'Settings created') - }) - .catch((err) => { - t.update('error', 'Error :' + err) - }) - } - const onSubmit: SubmitHandler = async (form) => { - // @ts-ignore - await createMoneyManagement(form) - onClose() - } - - function onChangeName(e: any) { - setName(e.target.value) - } - - function onTakeProfitChange(e: any) { - setTakeProfit(e.target.value) - } - - function onStopLossChange(e: any) { - setStopLoss(e.target.value) - } - - function onLeverageChange(e: any) { - setLeverage(e.target.value) - } - - useEffect(() => { - if (moneyManagement) { - setBalanceAtRisk(moneyManagement.balanceAtRisk * 100) - setTakeProfit(moneyManagement.takeProfit * 100) - setStopLoss(moneyManagement.stopLoss * 100) - setLeverage(moneyManagement.leverage) - setTimeframe(moneyManagement.timeframe) - setName(moneyManagement.name) - - const defaultValues: MoneyManagement = { - balanceAtRisk: moneyManagement.balanceAtRisk, - leverage: moneyManagement.leverage, - name: moneyManagement.name || '', - stopLoss: moneyManagement.stopLoss, - takeProfit: moneyManagement.takeProfit, - timeframe: moneyManagement.timeframe, - } - reset({ ...defaultValues }) - } - }, [showModal, moneyManagement]) - - return ( - - - - - - - - - - - - - - - - - - - - - -
    -
    - -
    {(takeProfit / stopLoss).toFixed(2)}
    -
    -
    - {disableInputs ? null : ( -
    - -
    - )} -
    - ) -} - -export default MoneyManagementModal diff --git a/src/Managing.WebApp/src/pages/settingsPage/moneymanagement/moneymanagementTable.tsx b/src/Managing.WebApp/src/pages/settingsPage/moneymanagement/moneymanagementTable.tsx deleted file mode 100644 index 7cfea9e..0000000 --- a/src/Managing.WebApp/src/pages/settingsPage/moneymanagement/moneymanagementTable.tsx +++ /dev/null @@ -1,133 +0,0 @@ -import { PencilAltIcon, TrashIcon } from '@heroicons/react/solid' -import React, { useEffect, useState } from 'react' - -import useApiUrlStore from '../../../app/store/apiStore' -import { - Toast, - SelectColumnFilter, - Table, -} from '../../../components/mollecules' -import type { MoneyManagement } from '../../../generated/ManagingApi' -import { MoneyManagementClient } from '../../../generated/ManagingApi' -import type { IMoneyManagementList } from '../../../global/type' - -import MoneyManagementModal from './moneyManagementModal' - -const MoneyManagementTable: React.FC = ({ list }) => { - const [rows, setRows] = useState([]) - const [showModal, setShowModal] = useState(false) - const [selectedRow, setSelectedRow] = useState() - const { apiUrl } = useApiUrlStore() - - async function deleteMoneyManagement(name: string) { - const t = new Toast('Deleting money management') - const client = new MoneyManagementClient({}, apiUrl) - - await client - .moneyManagement_DeleteMoneyManagement(name) - .then(() => { - t.update('success', 'Configuration deleted') - }) - .catch((err) => { - t.update('error', 'Error :' + err) - }) - } - - function toggleModal() { - setShowModal(!showModal) - } - - function openModal(mm: MoneyManagement) { - setSelectedRow(mm) - setShowModal(true) - } - - const columns = React.useMemo( - () => [ - { - Filter: SelectColumnFilter, - Header: 'Timeframe', - accessor: 'timeframe', - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => <>x{cell.row.values.leverage}, - Header: 'Leverage', - accessor: 'leverage', - disableFilters: true, - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => <>{cell.row.values.balanceAtRisk * 100} %, - Header: 'Balance used', - accessor: 'balanceAtRisk', - disableFilters: true, - }, - { - Cell: ({ cell }) => <>{cell.row.values.stopLoss * 100} %, - Header: 'SL', - accessor: 'stopLoss', - disableFilters: true, - }, - { - Cell: ({ cell }) => <>{cell.row.values.takeProfit * 100} %, - Header: 'TP', - accessor: 'takeProfit', - disableFilters: true, - }, - { - Cell: ({ cell }) => ( - <> - {(cell.row.values.takeProfit / cell.row.values.stopLoss).toFixed(2)} - - ), - Header: 'R/R', - accessor: 'riskReward', - disableFilters: true, - }, - { - Cell: ({ cell }) => ( - <> -
    - -
    -
    - -
    - - ), - Header: 'Actions', - accessor: 'id', - disableFilters: true, - }, - ], - [] - ) - - useEffect(() => { - setRows(list) - }, [list]) - - return ( -
    -
    - - - ) -} - -export default MoneyManagementTable diff --git a/src/Managing.WebApp/src/pages/settingsPage/settings.tsx b/src/Managing.WebApp/src/pages/settingsPage/settings.tsx deleted file mode 100644 index 404d069..0000000 --- a/src/Managing.WebApp/src/pages/settingsPage/settings.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { useState } from 'react' - -import { Tabs } from '../../components/mollecules' - -import AccountSettings from './account/accountSettings' -import MoneyManagementSettings from './moneymanagement/moneyManagement' -import Theme from './theme' - -type TabsType = { - label: string - index: number - Component: React.FC<{}> -}[] - -// Tabs Array -const tabs: TabsType = [ - { - Component: MoneyManagementSettings, - index: 1, - label: 'Money Management', - }, - { - Component: AccountSettings, - index: 2, - label: 'Account Settings', - }, - { - Component: Theme, - index: 3, - label: 'Theme', - }, -] - -const Settings: React.FC = () => { - const [selectedTab, setSelectedTab] = useState(tabs[0].index) - - return ( -
    -
    - -
    -
    - ) -} - -export default Settings diff --git a/src/Managing.WebApp/src/pages/settingsPage/theme.tsx b/src/Managing.WebApp/src/pages/settingsPage/theme.tsx deleted file mode 100644 index a4b4515..0000000 --- a/src/Managing.WebApp/src/pages/settingsPage/theme.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { ThemeSelector } from '../../components/mollecules' - -const Theme: React.FC = () => { - return ( -
    -

    Settings

    -

    -

    Theme

    - -
    - ) -} - -export default Theme diff --git a/src/Managing.WebApp/src/pages/toolsPage/rektFees.tsx b/src/Managing.WebApp/src/pages/toolsPage/rektFees.tsx deleted file mode 100644 index 24f8f3c..0000000 --- a/src/Managing.WebApp/src/pages/toolsPage/rektFees.tsx +++ /dev/null @@ -1,158 +0,0 @@ -import { useEffect, useState } from 'react' -import type { SubmitHandler } from 'react-hook-form' -import { useForm } from 'react-hook-form' -import Plot from 'react-plotly.js' - -import useTheme from '../../hooks/useTheme' - -interface IRektToolInput { - fundingFeeRate: number - feePerTx: number - averageTradeTime: number -} - -const RektFees = () => { - const { register, handleSubmit } = useForm() - const [amountPerPosition, setAmountPerPosition] = useState([]) - const [z, setZ] = useState([]) - const [fundingFeesRate, setFundingFeesRate] = useState(0.0051) - const [feePerTx, setFeePerTx] = useState(0.13) - const [averageTradeTime, setAverageTradeTime] = useState(960) - const { themeProperty } = useTheme() - const theme = themeProperty() - const onSubmit: SubmitHandler = async (form) => { - setFundingFeesRate(form.fundingFeeRate) - setFeePerTx(form.feePerTx) - setAverageTradeTime(form.averageTradeTime) - } - - useEffect(() => { - updateAmountPerPosition() - updateAxis() - }, [fundingFeesRate, feePerTx, averageTradeTime]) - - function updateAmountPerPosition() { - const array: number[] = [] - for (let i = 300; i < 3500; i += 10) { - array.push(i) - } - setAmountPerPosition(array) - } - - function updateAxis() { - const tempZ: number[][] = [] - for (let i = 0; i < amountPerPosition.length; i++) { - const feePerPosition = getFeesForPosition(amountPerPosition[i]) - const zAxis: number[] = [] - - for (let t = 1; t < 1000; t++) { - const totalFees = feePerPosition * t - zAxis.push((totalFees * 100) / amountPerPosition[i]) - } - - tempZ.push(zAxis) - } - setZ(tempZ) - } - - function getFeesForPosition(amountPerPosition: number): number { - const tradeTime = averageTradeTime / 60 - const fundingFees = amountPerPosition * tradeTime * (fundingFeesRate / 100) - const positionFees = amountPerPosition * 0.0001 - const txFees = feePerTx * 2 // Open + SL or TP - - return fundingFees + txFees + positionFees - } - - return ( -
    -
    - - - - - - - -
    - ) -} -export default RektFees diff --git a/src/Managing.WebApp/src/pages/toolsPage/spotlight/spotlight.tsx b/src/Managing.WebApp/src/pages/toolsPage/spotlight/spotlight.tsx deleted file mode 100644 index 027928a..0000000 --- a/src/Managing.WebApp/src/pages/toolsPage/spotlight/spotlight.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import moment from 'moment' -import { useEffect, useState } from 'react' - -import useApiUrlStore from '../../../app/store/apiStore' -import type { - Spotlight, - SpotlightOverview, -} from '../../../generated/ManagingApi' -import { DataClient } from '../../../generated/ManagingApi' - -import SpotlightSummary from './spotlightSummary' -import SpotlightTable from './spotlightTable' - -interface ISpotlightOverview { - overview: SpotlightOverview | undefined -} -const Overview: React.FC = ({ overview }) => { - return ( - <> -
    Last update : {moment(overview?.dateTime).fromNow()}
    -
    - -
    -
    - {overview?.spotlights.map((s) => ( - - ))} -
    - - ) -} - -interface ISpotlight { - spotlight: Spotlight -} -const SpotlightDetail: React.FC = ({ spotlight }) => { - return ( - <> -
    - -
    - - ) -} - -const SpotlightView = () => { - const [overview, setOverview] = useState() - const [isFetching, setIsFetching] = useState(true) - - const { apiUrl } = useApiUrlStore() - const dataClient = new DataClient({}, apiUrl) - - useEffect(() => { - dataClient - .data_GetSpotlight() - .then((data) => { - setOverview(data) - }) - .finally(() => { - setIsFetching(false) - }) - }, []) - - return ( - <> -
    - {isFetching ? ( - - ) : ( - - )} -
    - - ) -} -export default SpotlightView diff --git a/src/Managing.WebApp/src/pages/toolsPage/spotlight/spotlightSummary.tsx b/src/Managing.WebApp/src/pages/toolsPage/spotlight/spotlightSummary.tsx deleted file mode 100644 index 68557e9..0000000 --- a/src/Managing.WebApp/src/pages/toolsPage/spotlight/spotlightSummary.tsx +++ /dev/null @@ -1,210 +0,0 @@ -import React from 'react' - -import { PieChart } from '../../../components/mollecules' -import type { Signal, Spotlight } from '../../../generated/ManagingApi' -import { TradeDirection } from '../../../generated/ManagingApi' -import useTheme from '../../../hooks/useTheme' - -interface ISpotlightSummary { - spotlights: Spotlight[] | undefined -} - -interface ISummaryChart { - fiveMinutes: ISummaryChartItem - fifteenMinutes: ISummaryChartItem - oneHour: ISummaryChartItem - fourHours: ISummaryChartItem - oneDay: ISummaryChartItem -} - -interface ISummaryChartItem { - long: number - short: number - none: number -} - -const SpotlightSummary: React.FC = ({ spotlights }) => { - const { themeProperty } = useTheme() - const theme = themeProperty() - const labels = ['Long', 'Short', 'None'] - const colors = [theme.success, theme.error, 'grey'] - - function GetSummaryChartItem(signal: Signal) { - const summary: ISummaryChartItem = { - long: 0, - none: 0, - short: 0, - } - if (signal) { - switch (signal.direction) { - case TradeDirection.Long: - summary.long++ - break - case TradeDirection.Short: - summary.short++ - break - case TradeDirection.None: - summary.none++ - break - default: - summary.none++ - break - } - } else { - summary.none++ - } - return summary - } - - function GetSignalChart(): React.ReactNode { - const summary: ISummaryChart = { - fifteenMinutes: { - long: 0, - none: 0, - short: 0, - }, - fiveMinutes: { - long: 0, - none: 0, - short: 0, - }, - fourHours: { - long: 0, - none: 0, - short: 0, - }, - oneDay: { - long: 0, - none: 0, - short: 0, - }, - oneHour: { - long: 0, - none: 0, - short: 0, - }, - } - - if (spotlights) { - spotlights?.forEach((s) => { - s.tickerSignals.forEach((t) => { - const fiveMinutesSummary = GetSummaryChartItem( - t.fiveMinutes[t.fiveMinutes.length - 1] - ) - summary.fiveMinutes.long += fiveMinutesSummary.long - summary.fiveMinutes.short += fiveMinutesSummary.short - summary.fiveMinutes.none += fiveMinutesSummary.none - const fifteenMinutesSummary = GetSummaryChartItem( - t.fifteenMinutes[t.fifteenMinutes.length - 1] - ) - summary.fifteenMinutes.long += fifteenMinutesSummary.long - summary.fifteenMinutes.short += fifteenMinutesSummary.short - summary.fifteenMinutes.none += fifteenMinutesSummary.none - - const oneHour = GetSummaryChartItem(t.oneHour[t.oneHour.length - 1]) - summary.oneHour.long += oneHour.long - summary.oneHour.short += oneHour.short - summary.oneHour.none += oneHour.none - - const fourHours = GetSummaryChartItem( - t.fourHour[t.fourHour.length - 1] - ) - summary.fourHours.long += fourHours.long - summary.fourHours.short += fourHours.short - summary.fourHours.none += fourHours.none - - const oneDay = GetSummaryChartItem(t.oneDay[t.oneDay.length - 1]) - summary.oneDay.long += oneDay.long - summary.oneDay.short += oneDay.short - summary.oneDay.none += oneDay.none - }) - }) - } - - return ( - <> -
    -
    -
    5min
    -
    - -
    -
    -
    -
    15min
    -
    - -
    -
    -
    -
    1h
    -
    - -
    -
    -
    -
    4h
    -
    - -
    -
    -
    -
    1d
    -
    - -
    -
    -
    - - ) - } - - return ( -
    -
    - {GetSignalChart()} -
    - ) -} - -export default SpotlightSummary diff --git a/src/Managing.WebApp/src/pages/toolsPage/spotlight/spotlightTable.tsx b/src/Managing.WebApp/src/pages/toolsPage/spotlight/spotlightTable.tsx deleted file mode 100644 index cfd3f5c..0000000 --- a/src/Managing.WebApp/src/pages/toolsPage/spotlight/spotlightTable.tsx +++ /dev/null @@ -1,94 +0,0 @@ -import React from 'react' - -import { Table } from '../../../components/mollecules' -import { SpotLightBadge } from '../../../components/organism' -import type { Signal, Spotlight } from '../../../generated/ManagingApi' -import { TradeDirection } from '../../../generated/ManagingApi' - -interface ISpotlightTable { - spotlight: Spotlight -} -const GetBadgeForTimeframe = (signals: Signal[]) => { - const lastSignal = signals[signals.length > 1 ? signals.length - 1 : 0] - return lastSignal ? ( - - ) : ( - - ) -} - -const SpotlightTable: React.FC = ({ spotlight }) => { - const columns = React.useMemo( - () => [ - { - Header: spotlight.scenario.name, - columns: [ - { - Header: 'Ticker', - accessor: 'ticker', - disableFilters: true, - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => ( - <>{GetBadgeForTimeframe(cell.row.values.fiveMinutes)} - ), - Header: '5m', - accessor: 'fiveMinutes', - disableFilters: true, - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => ( - <>{GetBadgeForTimeframe(cell.row.values.fifteenMinutes)} - ), - Header: '15m', - accessor: 'fifteenMinutes', - disableFilters: true, - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => ( - <>{GetBadgeForTimeframe(cell.row.values.oneHour)} - ), - Header: '1h', - accessor: 'oneHour', - disableFilters: true, - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => ( - <>{GetBadgeForTimeframe(cell.row.values.fourHour)} - ), - Header: '4h', - accessor: 'fourHour', - disableFilters: true, - disableSortBy: true, - }, - { - Cell: ({ cell }: any) => ( - <>{GetBadgeForTimeframe(cell.row.values.oneDay)} - ), - Header: '1D', - accessor: 'oneDay', - disableFilters: true, - disableSortBy: true, - }, - ], - }, - ], - [] - ) - - return ( -
    -
    - - ) -} - -export default SpotlightTable diff --git a/src/Managing.WebApp/src/pages/toolsPage/tools.tsx b/src/Managing.WebApp/src/pages/toolsPage/tools.tsx deleted file mode 100644 index 94c9839..0000000 --- a/src/Managing.WebApp/src/pages/toolsPage/tools.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { useState, useEffect } from 'react' - -import { Tabs } from '../../components/mollecules' -import type { ITabsType } from '../../global/type' - -import RektFees from './rektFees' -import SpotlightView from './spotlight/spotlight' - -const tabs: ITabsType = [ - { - Component: SpotlightView, - index: 1, - label: 'Spotlight', - }, - { - Component: RektFees, - index: 2, - label: 'RektFees', - }, -] - -const Tools: React.FC = () => { - const [selectedTab, setSelectedTab] = useState(tabs[0].index) - - useEffect(() => {}, []) - - return ( -
    -
    - -
    -
    - ) -} - -export default Tools diff --git a/src/Managing.WebApp/src/pages/web3Page/web3.tsx b/src/Managing.WebApp/src/pages/web3Page/web3.tsx deleted file mode 100644 index fb60113..0000000 --- a/src/Managing.WebApp/src/pages/web3Page/web3.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import type { Contract } from 'ethers' -import { ethers } from 'ethers' -import { useRef, useState } from 'react' - -const Web3 = () => { - const moodInputRef = useRef() - const [mood, setMood] = useState() - //@ts-ignore - const provider = new ethers.providers.Web3Provider(window.ethereum, 'ropsten') - const contractAddress = '0x0335e801159Af04b3067bED0aeeaCC86Ece51e19' - const moodAbi = [ - { - constant: true, - inputs: [], - name: 'getMood', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string', - }, - ], - signature: '0x9d0c1397', - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - internalType: 'string', - name: '_mood', - type: 'string', - }, - ], - name: 'setMood', - outputs: [], - signature: '0x5f3cbff5', - stateMutability: 'nonpayable', - type: 'function', - }, - ] - - let contract: Contract - let signer - - provider.send('eth_requestAccounts', []).then(() => { - provider.listAccounts().then(function (accounts) { - signer = provider.getSigner(accounts[0]) - contract = new ethers.Contract(contractAddress, moodAbi, signer) - }) - }) - - async function getMoodAbi() { - const getMoodPromise = contract.getMood() - const currentMood = await getMoodPromise - setMood(currentMood) - } - - async function setMoodAbi() { - //@ts-ignore - const setMoodPromise = contract.setMood(moodInputRef.current.value) - await setMoodPromise - } - - return ( -
    -
    -

    Web3 Playground

    -
    -
    -

    dApp

    - - - - -
    -
    -

    {mood}

    -
    - -
    -
    -
    -
    -
    -

    NFT

    -
    -
    -
    -
    - ) -} - -export default Web3 diff --git a/src/Managing.WebApp/src/pages/workflow/workflows.tsx b/src/Managing.WebApp/src/pages/workflow/workflows.tsx deleted file mode 100644 index 205b728..0000000 --- a/src/Managing.WebApp/src/pages/workflow/workflows.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import { useQuery } from '@tanstack/react-query' -import { useEffect, useState } from 'react' -import type { Edge, Node } from 'reactflow' - -import useApiUrlStore from '../../app/store/apiStore' -import { Loader } from '../../components/atoms' -import { Tabs } from '../../components/mollecules' -import { WorkflowCanvas } from '../../components/organism' -import type { - IFlow, - SyntheticFlow, - SyntheticWorkflow, -} from '../../generated/ManagingApi' -import { WorkflowClient } from '../../generated/ManagingApi' -import type { ITabsType, IWorkflow } from '../../global/type' - -const mapWorkflowToTabs = (workflows: SyntheticWorkflow[]): ITabsType => { - return workflows.map((workflow: SyntheticWorkflow, index: number) => { - return { - Component: WorkflowCanvas, - index: index, - label: workflow.name, - props: mapFlowsToNodes(workflow.flows, workflow.name), - } - }) -} - -const mapFlowsToNodes = (flows: SyntheticFlow[], name: string): IWorkflow => { - const nodes: Node[] = [] - const edges: Edge[] = [] - - flows.forEach((flow: SyntheticFlow) => { - nodes.push(mapFlowToNode(flow)) - }) - - for (const node of nodes) { - const childrenNodes = nodes.filter((n) => n.data.parentId == node.data.id) - - if (childrenNodes.length > 0) { - childrenNodes.forEach((childNode) => { - edges.push({ - id: `${node.id}-${childNode.id}`, - source: node.id, - target: childNode.id, - }) - }) - } - } - - return { edges, name: name, nodes } as IWorkflow -} - -const mapFlowToNode = (flow: SyntheticFlow): Node => { - return { - data: flow, - id: flow.id, - position: { x: 0, y: 0 }, - type: flow.type, - } -} - -const Workflows: React.FC = () => { - const [selectedTab, setSelectedTab] = useState(1) - const { apiUrl } = useApiUrlStore() - const client = new WorkflowClient({}, apiUrl) - - const { data, isLoading } = useQuery({ - onSuccess: () => { - setSelectedTab(0) - }, - queryFn: () => client.workflow_GetWorkflows(), - queryKey: ['workflows'], - }) - - useEffect(() => {}, [isLoading]) - - if (isLoading || data == null) { - return - } - - return ( -
    -
    - { - console.log('add button clicked') - }} - /> -
    -
    - ) -} - -export default Workflows diff --git a/src/Managing.WebApp/src/polyfills.ts b/src/Managing.WebApp/src/polyfills.ts deleted file mode 100644 index dc3665c..0000000 --- a/src/Managing.WebApp/src/polyfills.ts +++ /dev/null @@ -1,4 +0,0 @@ -window.global = window.global ?? window -window.process = window.process ?? { env: {} } - -export {} diff --git a/src/Managing.WebApp/src/smartcontracts/courses/mood.sol b/src/Managing.WebApp/src/smartcontracts/courses/mood.sol deleted file mode 100644 index 68f90b7..0000000 --- a/src/Managing.WebApp/src/smartcontracts/courses/mood.sol +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.1; - -contract MoodDiary{ - string mood; - - //create a function that writes a mood to the smart contract - function setMood(string memory _mood) public{ - mood = _mood; - } - - //create a function the reads the mood from the smart contract - function getMood() public view returns(string memory){ - return mood; - } - } \ No newline at end of file diff --git a/src/Managing.WebApp/src/smartcontracts/courses/odaNFT.sol b/src/Managing.WebApp/src/smartcontracts/courses/odaNFT.sol deleted file mode 100644 index 378a154..0000000 --- a/src/Managing.WebApp/src/smartcontracts/courses/odaNFT.sol +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -// Import the openzepplin contracts -import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; - -// GameItem is ERC721 signifies that the contract we are creating imports ERC721 and follows ERC721 contract from openzeppelin -contract GameItem is ERC721 { - - constructor() ERC721("GameItem", "ITM") { - // mint an NFT to yourself - _mint(msg.sender, 1); - } -} \ No newline at end of file diff --git a/src/Managing.WebApp/src/smartcontracts/courses/odaToken.sol b/src/Managing.WebApp/src/smartcontracts/courses/odaToken.sol deleted file mode 100644 index 64743a8..0000000 --- a/src/Managing.WebApp/src/smartcontracts/courses/odaToken.sol +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; - -contract OdaToken is ERC20 { - constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) { - _mint(msg.sender, 10 * 10 ** 18); - } -} \ No newline at end of file diff --git a/src/Managing.WebApp/src/stores/store.tsx b/src/Managing.WebApp/src/stores/store.tsx deleted file mode 100644 index 81c5d23..0000000 --- a/src/Managing.WebApp/src/stores/store.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import { atomWithStorage } from 'jotai/utils' - -export const themeAtom = atomWithStorage('theme', 'black') diff --git a/src/Managing.WebApp/src/styles/app.css b/src/Managing.WebApp/src/styles/app.css deleted file mode 100644 index 89065d8..0000000 --- a/src/Managing.WebApp/src/styles/app.css +++ /dev/null @@ -1,46 +0,0 @@ -.App-logo { - width: 1.5em; -} - -@media (prefers-reduced-motion: no-preference) { - /* .App-logo { - animation: App-logo-spin infinite 20s linear; - } */ -} - -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -button { - font-size: calc(10px + 2vmin); -} - -.notificationWrapper { - @apply w-96 hover:shadow-none transform-gpu hover:translate-y-1 rounded-xl relative flex flex-row items-center justify-between px-4 py-6 text-white transition-all duration-500 ease-in-out translate-y-0 bg-gray-900 shadow-2xl; -} - -.iconWrapper { - @apply text-xl; -} - -.contentWrapper { - @apply flex flex-col items-start justify-center ml-4 cursor-default; -} - -.contentWrapper h1 { - @apply text-base font-semibold leading-none tracking-wider text-gray-200; -} - -.contentWrapper p { - @apply mt-2 text-sm leading-relaxed tracking-wider text-gray-400; -} - -.closeIcon { - @apply top-2 right-2 absolute text-lg cursor-pointer; -} diff --git a/src/Managing.WebApp/src/styles/globals.css b/src/Managing.WebApp/src/styles/globals.css deleted file mode 100644 index da51981..0000000 --- a/src/Managing.WebApp/src/styles/globals.css +++ /dev/null @@ -1,23 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -@layer base { - body { - margin: 0; - - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - } - - code { - font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', - monospace; - } -} - -@layer utilities { - .layout { - @apply sm:w-11/12 w-10/12 mx-auto; - } -} diff --git a/src/Managing.WebApp/src/vite-env.d.ts b/src/Managing.WebApp/src/vite-env.d.ts deleted file mode 100644 index 96204cc..0000000 --- a/src/Managing.WebApp/src/vite-env.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// - -declare type AnyFunction = (...args: any[]) => any diff --git a/src/Managing.WebApp/tailwind.config.js b/src/Managing.WebApp/tailwind.config.js deleted file mode 100644 index c57aa29..0000000 --- a/src/Managing.WebApp/tailwind.config.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], - daisyui: { - themes: true, - }, - plugins: [require('@tailwindcss/typography'), require('daisyui')], - theme: { - container: { - center: true, - }, - }, -} diff --git a/src/Managing.WebApp/tsconfig.json b/src/Managing.WebApp/tsconfig.json deleted file mode 100644 index 9f749f4..0000000 --- a/src/Managing.WebApp/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "lib": ["DOM", "DOM.Iterable", "ESNext"], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "module": "ESNext", - "moduleResolution": "Node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx" - }, - "include": ["./src", "hardhat.config.js"], - "exclude": ["node_modules"] -} diff --git a/src/Managing.WebApp/vite.config.ts b/src/Managing.WebApp/vite.config.ts deleted file mode 100644 index 449a7b8..0000000 --- a/src/Managing.WebApp/vite.config.ts +++ /dev/null @@ -1,20 +0,0 @@ -import react from '@vitejs/plugin-react' -import { defineConfig } from 'vite' - -export default defineConfig({ - build: { - sourcemap: true, - target: 'es2020', - }, - optimizeDeps: { - esbuildOptions: { - target: 'es2020', - }, - }, - plugins: [react()], - publicDir: 'assets', - server: { - host: true, - open: true, - }, -})