diff --git a/frontend/.env.dev b/frontend/.env.dev index 88be1b0f..aa4cfad9 100644 --- a/frontend/.env.dev +++ b/frontend/.env.dev @@ -1,3 +1,3 @@ -REACT_APP_STARKNET_NODE_URL=http://178.32.172.148:6060 -REACT_APP_BACKEND_URL=http://localhost:8000 -REACT_APP_IS_DEV=true \ No newline at end of file +VITE_APP_STARKNET_NODE_URL=http://178.32.172.148:6060 +VITE_APP_BACKEND_URL=http://localhost:8000 +VITE_APP_IS_DEV=true \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 47e7c76e..0a9d9ca1 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -12,11 +12,10 @@ RUN yarn build # Stage 2: Set up Nginx to serve the built app FROM nginx:alpine -COPY --from=build /app/build /usr/share/nginx/html +COPY --from=build /app/dist /usr/share/nginx/html RUN rm /etc/nginx/conf.d/default.conf COPY spotnet.conf /etc/nginx/conf.d EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] - +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/frontend/Dockerfile.dev b/frontend/Dockerfile.dev index 5a7c452f..0c02b15c 100644 --- a/frontend/Dockerfile.dev +++ b/frontend/Dockerfile.dev @@ -15,10 +15,10 @@ RUN yarn build # Stage 2: Set up Nginx to serve the built app FROM nginx:alpine -COPY --from=build /app/build /usr/share/nginx/html +COPY --from=build /app/dist /usr/share/nginx/html RUN rm /etc/nginx/conf.d/default.conf COPY spotnet_dev.conf /etc/nginx/conf.d EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/frontend/README.md b/frontend/README.md index 185efa16..b27f3552 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,69 +1,54 @@ -# Getting Started with Create React App +# Getting Started with Vite -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +This project was migrated from [Create React App](https://github.com/facebook/create-react-app) to [Vite](https://vitejs.dev/), a fast and modern frontend build tool. ## Available Scripts In the project directory, you can run: -### `npm start` +### `yarn start` -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in your browser. +Runs the app in development mode. +Open [http://localhost:5173](http://localhost:5173) (default) to view it in your browser. -The page will reload when you make changes.\ -You may also see any lint errors in the console. +The page will reload when you make changes. +You may also see any errors or warnings in the console. -### `npm test` +### `yarn test` -This launches the tests using the node environment provisioned by jest. After running the initial setup and the app is runnign , open another terminal shell, cd into the frontend directory and then run npm test. +Runs the tests using the environment provisioned by Jest. After running the initial setup and starting the app, open another terminal shell, navigate to the frontend directory, and run `yarn test`. -### `npm run build` +### `yarn build` -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. +Builds the app for production to the `dist` folder. +It optimizes the build for the best performance using Vite's efficient bundling and minification process. -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! +The production build is ready to be deployed! -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `npm run eject` - -**Note: this is a one-way operation. Once you `eject`, you can't go back!** - -If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. - -You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. +For more information on deployment, check out [Vite's deployment guide](https://vitejs.dev/guide/static-deploy.html). ## Learn More -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). - -### Code Splitting - -This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) - -### Analyzing the Bundle Size +To learn more about Vite, visit the [Vite documentation](https://vitejs.dev/guide/). -This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) +To learn React, check out the [React documentation](https://react.dev/). -### Making a Progressive Web App +## Code Splitting and Performance -This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) +Vite supports efficient code splitting and performance optimization out of the box. Learn more in [Vite's guide to optimization](https://vitejs.dev/guide/features.html#code-splitting). -### Advanced Configuration +## Troubleshooting -This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) +If you encounter any issues during development or deployment, refer to the [Vite Troubleshooting Guide](https://vitejs.dev/guide/troubleshooting.html). -### Deployment +## Migration Notes -This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) +### Key Changes from Create React App: -### `npm run build` fails to minify +- The development server now runs on [Vite](https://vitejs.dev/), offering faster startup and rebuild times. +- `yarn dev` replaces `yarn start` for running the development server. +- Production builds are now output to the `dist` folder instead of the `build` folder. +- Vite uses [ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) by default, ensuring modern, fast builds. +- Configuration has been simplified with a `vite.config.js` or `vite.config.ts` file. -This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) +For help with the migration process, check out [Vite's guide for migrating from CRA](https://vitejs.dev/guide/migration-from-cra.html). diff --git a/frontend/babel.config.js b/frontend/babel.config.js index 25a8e240..3361ba35 100644 --- a/frontend/babel.config.js +++ b/frontend/babel.config.js @@ -1,3 +1,4 @@ module.exports = { - presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-react'], + presets: ['@babel/preset-env', ['@babel/preset-react', { runtime: 'automatic' }]], + plugins: ['babel-plugin-transform-import-meta'], }; diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js index 19970316..a902aa7a 100644 --- a/frontend/eslint.config.js +++ b/frontend/eslint.config.js @@ -1,8 +1,35 @@ +import js from '@eslint/js'; +import globals from 'globals'; +import react from 'eslint-plugin-react'; +import reactHooks from 'eslint-plugin-react-hooks'; +import reactRefresh from 'eslint-plugin-react-refresh'; + export default [ - { - languageOptions: { - ecmaVersion: 2015, - sourceType: "script" - } - } -]; \ No newline at end of file + { ignores: ['dist'] }, + { + files: ['**/*.{js,jsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + parserOptions: { + ecmaVersion: 'latest', + ecmaFeatures: { jsx: true }, + sourceType: 'module', + }, + }, + settings: { react: { version: '18.3' } }, + plugins: { + react, + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...js.configs.recommended.rules, + ...react.configs.recommended.rules, + ...react.configs['jsx-runtime'].rules, + ...reactHooks.configs.recommended.rules, + 'react/jsx-no-target-blank': 'off', + 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], + }, + }, +]; diff --git a/frontend/public/index.html b/frontend/index.html similarity index 89% rename from frontend/public/index.html rename to frontend/index.html index 51f66820..11d8ed5c 100644 --- a/frontend/public/index.html +++ b/frontend/index.html @@ -8,7 +8,7 @@ - + @@ -20,5 +20,7 @@ + + diff --git a/frontend/jest.config.js b/frontend/jest.config.js index cac8328d..27818d64 100644 --- a/frontend/jest.config.js +++ b/frontend/jest.config.js @@ -1,16 +1,14 @@ module.exports = { setupFiles: ['./jest.setup.js'], transform: { - '^.+\\.[tj]sx?$': 'babel-jest', // Using Babel for transforming JS, JSX, TS, and TSX + '^.+\\.[tj]sx?$': 'babel-jest', }, moduleNameMapper: { + '\\.svg\\?react$': '/test/__mocks__/svgMock.js', // Add this line '\\.svg$': '/test/__mocks__/svgMock.js', '\\.css$': '/test/__mocks__/styleMock.js', '^src/(.*)$': ['/src/$1'], }, - transformIgnorePatterns: [ - 'node_modules/(?!(axios|starknetkit)/)', // Ignore transforming node_modules - ], - - testEnvironment: 'jsdom', // Use node as the test environment + transformIgnorePatterns: ['node_modules/(?!(axios|starknetkit)/)'], + testEnvironment: 'jsdom', }; diff --git a/frontend/jest.setup.js b/frontend/jest.setup.js index d3d5221a..26d5003d 100644 --- a/frontend/jest.setup.js +++ b/frontend/jest.setup.js @@ -1,4 +1,3 @@ import { TextEncoder, TextDecoder } from 'util'; - global.TextEncoder = TextEncoder; global.TextDecoder = TextDecoder; diff --git a/frontend/package.json b/frontend/package.json index 572037e8..2e9fbf86 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -3,34 +3,45 @@ "version": "0.1.0", "private": true, "dependencies": { + "@babel/core": "^7.26.7", + "@babel/preset-env": "^7.26.7", + "@babel/preset-react": "^7.26.3", "@popperjs/core": "^2.11.8", - "@tanstack/react-query": "^5.59.16", - "@tanstack/react-query-devtools": "^5.60.5", + "@tanstack/react-query": "^5.64.2", + "@tanstack/react-query-devtools": "^5.64.2", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", + "@vitejs/plugin-react": "^4.3.4", "axios": "^1.7.7", + "babel-jest": "^29.7.0", + "babel-plugin-transform-import-meta": "^2.3.2", "dotenv": "^16.4.5", "lucide-react": "^0.454.0", - "react": "^18.3.1", + "react": "^19.0.0", "react-bootstrap": "^2.10.5", - "react-dom": "^18.3.1", - "react-router-dom": "^6.27.0", - "react-scripts": "^5.0.1", + "react-dom": "^19.0.0", + "react-router-dom": "^7.1.3", "react-toastify": "^10.0.6", "starknetkit": "2.6.1", + "vite": "^6.0.11", + "vite-plugin-environment": "^1.1.3", + "vite-tsconfig-paths": "^5.1.4", "web-vitals": "^2.1.4", "zustand": "^5.0.1" }, "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", - "test": "jest", + "start": "vite", + "build": "vite build", "lint": "eslint .", - "format": "prettier --check . --write", - "eject": "react-scripts eject" + "preview": "vite preview", + "test": "jest", + "format": "prettier --check . --write" }, "options": { - "allowedHosts": ["localhost", ".localhost"], + "allowedHosts": [ + "localhost", + ".localhost" + ], "proxy": "http://localhost:8000" }, "browserslist": { @@ -46,12 +57,9 @@ ] }, "devDependencies": { - "@babel/preset-env": "^7.26.0", - "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@tanstack/eslint-plugin-query": "^5.60.1", "@testing-library/jest-dom": "^6.6.2", "@types/jest": "^29.5.14", - "babel-jest": "^29.7.0", "eslint": "^8.57.1", "eslint-config-prettier": "^9.1.0", "eslint-config-react-app": "^7.0.1", @@ -60,6 +68,7 @@ "globals": "^15.11.0", "jest": "^27.5.1", "prettier": "^3.3.3", - "starknet": "^6.11.0" + "starknet": "^6.11.0", + "vite-plugin-svgr": "^4.3.0" } } diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 7812c4d2..e4068068 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1,30 +1,30 @@ import React, { useState, useEffect } from 'react'; import { Routes, Route, useNavigate, useLocation } from 'react-router-dom'; import './globals.css'; -import Header from './components/layout/header/Header'; -import Dashboard from './pages/dashboard/Dashboard'; -import Footer from './components/layout/footer/Footer'; -import SpotnetApp from './pages/spotnet-app/SpotnetApp'; -import Form from './pages/form/Form'; +import Header from '@/components/layout/header/Header'; +import Dashboard from '@/pages/dashboard/Dashboard'; +import Footer from '@/components/layout/footer/Footer'; +import SpotnetApp from '@/pages/spotnet-app/SpotnetApp'; +import Form from '@/pages/form/Form'; import { createPortal } from 'react-dom'; -import { logout } from './services/wallet'; -import { getTelegramUserWalletId } from './services/telegram'; -import Documentation from './pages/documentation/Documentation'; -import TermsAndConditionsPage from './pages/terms-and-conditions/TermsAndConditions'; +import { logout } from '@/services/wallet'; +import { getTelegramUserWalletId } from '@/services/telegram'; +import Documentation from '@/pages/documentation/Documentation'; +import TermsAndConditionsPage from '@/pages/terms-and-conditions/TermsAndConditions'; -import Withdraw from './pages/withdraw/Withdraw'; -import { useWalletStore } from './stores/useWalletStore'; -import { Notifier, notify } from './components/layout/notifier/Notifier'; -import { useConnectWallet } from './hooks/useConnectWallet'; -import OverviewPage from './pages/overview/Overview'; -import { ActionModal } from './components/ui/action-modal'; -import Stake from './pages/stake/Stake'; -import { TELEGRAM_BOT_LINK } from './utils/constants'; -import { useCheckMobile } from './hooks/useCheckMobile'; -import PositionHistory from './pages/position-history/PositionHistory'; -import WithdrawAll from 'pages/spotnet/dashboard/withdraw-all/WithdrawAll'; -import { DefiSpringPage } from 'pages/spotnet/defi-spring/DefiSpring'; -import { AddDeposit } from 'pages/add-deposit/AddDeposit'; +import Withdraw from '@/pages/withdraw/Withdraw'; +import { useWalletStore } from '@/stores/useWalletStore'; +import { Notifier, notify } from '@/components/layout/notifier/Notifier'; +import { useConnectWallet } from '@/hooks/useConnectWallet'; +import OverviewPage from '@/pages/overview/Overview'; +import { ActionModal } from '@/components/ui/action-modal'; +import Stake from '@/pages/stake/Stake'; +import { TELEGRAM_BOT_LINK } from '@/utils/constants'; +import { useCheckMobile } from '@/hooks/useCheckMobile'; +import PositionHistory from '@/pages/position-history/PositionHistory'; +import WithdrawAll from '@/pages/spotnet/dashboard/withdraw-all/WithdrawAll'; +import { DefiSpringPage } from '@/pages/spotnet/defi-spring/DefiSpring'; +import { AddDeposit } from '@/pages/add-deposit/AddDeposit'; function App() { const { setWalletId, removeWalletId } = useWalletStore(); @@ -34,7 +34,7 @@ function App() { const [isMobileRestrictionModalOpen, setisMobileRestrictionModalOpen] = useState(true); const isMobile = useCheckMobile(); - const disableDesktopOnMobile = process.env.REACT_APP_DISABLE_DESKTOP_ON_MOBILE !== 'false'; + const disableDesktopOnMobile = process.env.VITE_APP_DISABLE_DESKTOP_ON_MOBILE !== 'false'; const connectWalletMutation = useConnectWallet(setWalletId); diff --git a/frontend/src/components/dashboard/borrow/Borrow.jsx b/frontend/src/components/dashboard/borrow/Borrow.jsx index 3201ebd6..73e36790 100644 --- a/frontend/src/components/dashboard/borrow/Borrow.jsx +++ b/frontend/src/components/dashboard/borrow/Borrow.jsx @@ -1,6 +1,6 @@ import React from 'react'; import './borrow.css'; -import { ReactComponent as BorrowIcon } from 'assets/icons/borrow_dynamic.svg'; +import BorrowIcon from '@/assets/icons/borrow_dynamic.svg?react'; function Borrow({ data }) { return ( diff --git a/frontend/src/components/dashboard/collateral/Collateral.jsx b/frontend/src/components/dashboard/collateral/Collateral.jsx index 3cb215ec..3ff083cd 100644 --- a/frontend/src/components/dashboard/collateral/Collateral.jsx +++ b/frontend/src/components/dashboard/collateral/Collateral.jsx @@ -1,6 +1,6 @@ import React from 'react'; import './collateral.css'; -import { ReactComponent as CollateralIcon } from 'assets/icons/collateral_dynamic.svg'; +import CollateralIcon from '@/assets/icons/collateral_dynamic.svg?react'; import { TrendingDown, TrendingUp } from 'lucide-react'; function Collateral({ data, startSum, currentSum, getCurrentSumColor }) { diff --git a/frontend/src/components/dashboard/dashboard-tab/DashboardTabs.jsx b/frontend/src/components/dashboard/dashboard-tab/DashboardTabs.jsx index ad019cd1..a2058409 100644 --- a/frontend/src/components/dashboard/dashboard-tab/DashboardTabs.jsx +++ b/frontend/src/components/dashboard/dashboard-tab/DashboardTabs.jsx @@ -1,9 +1,9 @@ import React from 'react'; import './dashboardTabs.css'; -import { ReactComponent as DepositIcon } from '../../../assets/icons/deposited_dynamic.svg'; -import { ReactComponent as CollateralIcon } from '../../../assets/icons/collateral_dynamic.svg'; -import { ReactComponent as BorrowIcon } from '../../../assets/icons/borrow_dynamic.svg'; -import { DASHBOARD_TABS } from 'utils/constants'; +import DepositIcon from '@/assets/icons/deposited_dynamic.svg?react'; +import CollateralIcon from '@/assets/icons/collateral_dynamic.svg?react'; +import BorrowIcon from '@/assets/icons/borrow_dynamic.svg?react'; +import { DASHBOARD_TABS } from '@/utils/constants'; function DashboardTabs({ activeTab, switchTab }) { const { COLLATERAL, BORROW, DEPOSITED } = DASHBOARD_TABS; diff --git a/frontend/src/components/dashboard/deposited/Deposited.jsx b/frontend/src/components/dashboard/deposited/Deposited.jsx index 208092ee..57852c00 100644 --- a/frontend/src/components/dashboard/deposited/Deposited.jsx +++ b/frontend/src/components/dashboard/deposited/Deposited.jsx @@ -1,7 +1,7 @@ import './deposited.css'; -import { ReactComponent as EthIcon } from '../../../assets/icons/ethereum.svg'; -import { ReactComponent as StrkIcon } from '../../../assets/icons/strk.svg'; -import { ReactComponent as UsdIcon } from '../../../assets/icons/usdc-icon.svg'; +import EthIcon from '@/assets/icons/ethereum.svg?react'; +import StrkIcon from '@/assets/icons/strk.svg?react'; +import UsdIcon from '@/assets/icons/usdc-icon.svg?react'; function Deposited({ data }) { return ( diff --git a/frontend/src/components/home/about/About.jsx b/frontend/src/components/home/about/About.jsx index 68175180..ceb63642 100644 --- a/frontend/src/components/home/about/About.jsx +++ b/frontend/src/components/home/about/About.jsx @@ -1,9 +1,10 @@ import React from 'react'; -import { ReactComponent as ZkLend } from '../../../assets/icons/zklend_eth_collateral.svg'; -import { ReactComponent as BorrowUSDC } from '../../../assets/icons/borrow_usdc.svg'; -import { ReactComponent as EkuboSwap } from '../../../assets/icons/ekubo_swap.svg'; -import { ReactComponent as Repeat } from '../../../assets/icons/repeats.svg'; -import StarMaker from '../../layout/star-maker/StarMaker'; +import ZkLend from '@/assets/icons/zklend_eth_collateral.svg?react'; +import BorrowUSDC from '@/assets/icons/borrow_usdc.svg?react'; +import EkuboSwap from '@/assets/icons/ekubo_swap.svg?react'; +import Repeat from '@/assets/icons/repeats.svg?react'; +import StarMaker from '@/components/layout/star-maker/StarMaker'; + import './about.css'; const CardData = [ diff --git a/frontend/src/components/home/dont-miss/DontMiss.jsx b/frontend/src/components/home/dont-miss/DontMiss.jsx index 432d0c04..7e46e6f6 100644 --- a/frontend/src/components/home/dont-miss/DontMiss.jsx +++ b/frontend/src/components/home/dont-miss/DontMiss.jsx @@ -1,11 +1,11 @@ import './dontMiss.css'; import React from 'react'; -import { ReactComponent as Rocket } from '../../../assets/icons/rocket.svg'; -import { ReactComponent as Hand } from '../../../assets/images/hand.svg'; -import { ReactComponent as Star } from '../../../assets/particles/star.svg'; +import Rocket from '@/assets/icons/rocket.svg?react'; +import Hand from '@/assets/images/hand.svg?react'; +import Star from '@/assets/particles/star.svg?react'; import { useNavigate } from 'react-router-dom'; -import { notify } from '../../../components/layout/notifier/Notifier'; -import { useWalletStore } from '../../../stores/useWalletStore'; +import { notify } from '@/components/layout/notifier/Notifier'; +import { useWalletStore } from '@/stores/useWalletStore'; const DontMiss = () => { const { walletId } = useWalletStore(); diff --git a/frontend/src/components/home/home/Home.jsx b/frontend/src/components/home/home/Home.jsx index 507d9523..6b136acf 100644 --- a/frontend/src/components/home/home/Home.jsx +++ b/frontend/src/components/home/home/Home.jsx @@ -1,13 +1,13 @@ import React from 'react'; import { useNavigate } from 'react-router-dom'; -import { ReactComponent as SmallStar } from '../../../assets/particles/small_star.svg'; -import StarMaker from '../../layout/star-maker/StarMaker'; -import { ReactComponent as Decoration } from '../../../assets/particles/deco.svg'; -import { ReactComponent as Starknet } from '../../../assets/particles/starknet.svg'; -import { ReactComponent as Rocket } from '../../../assets/icons/rocket.svg'; +import SmallStar from '@/assets/particles/small_star.svg?react'; +import StarMaker from '@/components/layout/star-maker/StarMaker'; +import Decoration from '@/assets/particles/deco.svg?react'; +import Starknet from '@/assets/particles/starknet.svg?react'; +import Rocket from '@/assets/icons/rocket.svg?react'; import './home.css'; -import { useWalletStore } from '../../../stores/useWalletStore'; -import { notify } from '../../layout/notifier/Notifier'; +import { useWalletStore } from '@/stores/useWalletStore'; +import { notify } from '@/components/layout/notifier/Notifier'; function Home() { const { walletId } = useWalletStore(); diff --git a/frontend/src/components/home/information/Information.jsx b/frontend/src/components/home/information/Information.jsx index 0f237c4e..0244d0fb 100644 --- a/frontend/src/components/home/information/Information.jsx +++ b/frontend/src/components/home/information/Information.jsx @@ -1,7 +1,7 @@ import './information.css'; import React, { useEffect, useState } from 'react'; -import StarMaker from '../../layout/star-maker/StarMaker'; -import { axiosInstance } from 'utils/axios'; +import StarMaker from '@/components/layout/star-maker/StarMaker'; +import { axiosInstance } from '@/utils/axios'; const Information = () => { const [data, setData] = useState({ total_opened_amount: 0, unique_users: 0 }); diff --git a/frontend/src/components/home/partnership/Partnership.jsx b/frontend/src/components/home/partnership/Partnership.jsx index f3b8a065..7e88d32a 100644 --- a/frontend/src/components/home/partnership/Partnership.jsx +++ b/frontend/src/components/home/partnership/Partnership.jsx @@ -1,8 +1,8 @@ import React from 'react'; import './partnership.css'; -import { ReactComponent as ZklendLogo } from '../../../assets/images/zklend_logo.svg'; -import { ReactComponent as EkuboLogo } from '../../../assets/images/ekubo_logo.svg'; -import { ReactComponent as Star } from '../../../assets/particles/star.svg'; +import ZklendLogo from '@/assets/images/zklend_logo.svg?react'; +import EkuboLogo from '@/assets/images/ekubo_logo.svg?react'; +import Star from '@/assets/particles/star.svg?react'; const Partnership = () => { const logos = []; diff --git a/frontend/src/components/layout/footer/Footer.jsx b/frontend/src/components/layout/footer/Footer.jsx index 67aadc1f..3b06170e 100644 --- a/frontend/src/components/layout/footer/Footer.jsx +++ b/frontend/src/components/layout/footer/Footer.jsx @@ -1,10 +1,10 @@ import React from 'react'; import { NavLink } from 'react-router-dom'; -import { ReactComponent as TwitterIcon } from '../../../assets/icons/new-twitter.svg'; -import { ReactComponent as TelegramIcon } from '../../../assets/icons/telegram.svg'; -import { ReactComponent as GithubIcon } from '../../../assets/icons/github.svg'; -import { ReactComponent as DashboardIcon } from '../../../assets/icons/dashboard-icon.svg'; -import { ReactComponent as FormIcon } from '../../../assets/icons/form-icon.svg'; +import TwitterIcon from '@/assets/icons/new-twitter.svg?react'; +import TelegramIcon from '@/assets/icons/telegram.svg?react'; +import GithubIcon from '@/assets/icons/github.svg?react'; +import DashboardIcon from '@/assets/icons/dashboard-icon.svg?react'; +import FormIcon from '@/assets/icons/form-icon.svg?react'; import './footer.css'; diff --git a/frontend/src/components/layout/header/Header.jsx b/frontend/src/components/layout/header/Header.jsx index 89835e89..ccbecdf7 100644 --- a/frontend/src/components/layout/header/Header.jsx +++ b/frontend/src/components/layout/header/Header.jsx @@ -1,22 +1,21 @@ import React, { useState, useEffect } from 'react'; import { useLocation } from 'react-router-dom'; import { NavLink } from 'react-router-dom'; -import { ReactComponent as Logo } from '../../../assets/icons/spotnet-logo.svg'; -import WalletSection from '../wallet-section/WalletSection'; -import NavigationLinks from '../navigation-links/NavigationLinks'; -import useLockBodyScroll from '../../../hooks/useLockBodyScroll'; -import MobDropdownMenu from '../mob-dropdown-menu/MobDropdownMenu'; +import Logo from '@/assets/icons/spotnet-logo.svg?react'; +import WalletSection from '@/components/layout/wallet-section/WalletSection'; +import NavigationLinks from '@/components/layout/navigation-links/NavigationLinks'; +import useLockBodyScroll from '@/hooks/useLockBodyScroll'; +import MobDropdownMenu from '@/components/layout/mob-dropdown-menu/MobDropdownMenu'; import './header.css'; -import '../../../globals.css'; -import { ReportBugButton } from 'components/report-button/ReportBugButton'; -import { ReportBugModal } from 'components/report-modal/ReportBugModal'; +import '@/globals.css'; +import { ReportBugButton } from '@/components/report-button/ReportBugButton'; +import { ReportBugModal } from '@/components/report-modal/ReportBugModal'; function Header({ onConnectWallet, onLogout }) { const [isModalOpen, setIsModalOpen] = useState(false); const [isMenuOpen, setIsMenuOpen] = useState(false); const location = useLocation(); - const makeNavStick = [ '/overview', '/documentation', @@ -59,12 +58,10 @@ function Header({ onConnectWallet, onLogout }) { setIsMenuOpen(false); }; - const openModal = () => { setIsModalOpen(true); }; - const closeModal = () => { setIsModalOpen(false); }; @@ -89,13 +86,9 @@ function Header({ onConnectWallet, onLogout }) { - {!isModalOpen && } - - {isModalOpen && ( - - )} + {isModalOpen && } ); } diff --git a/frontend/src/components/layout/mob-dropdown-menu/MobDropdownMenu.jsx b/frontend/src/components/layout/mob-dropdown-menu/MobDropdownMenu.jsx index 40771367..854cb1c9 100644 --- a/frontend/src/components/layout/mob-dropdown-menu/MobDropdownMenu.jsx +++ b/frontend/src/components/layout/mob-dropdown-menu/MobDropdownMenu.jsx @@ -1,8 +1,8 @@ import React from 'react'; -import { ReactComponent as ArrowDownIcon } from '../../../assets/icons/dropdown-arrow.svg'; -import { ReactComponent as ReloadIcon } from '../../../assets/icons/reload.svg'; -import { ReactComponent as OpenBotIcon } from '../../../assets/icons/bot.svg'; -import { ReactComponent as TermsIcon } from '../../../assets/icons/terms.svg'; +import ArrowDownIcon from '@/assets/icons/dropdown-arrow.svg?react'; +import ReloadIcon from '@/assets/icons/reload.svg?react'; +import OpenBotIcon from '@/assets/icons/bot.svg?react'; +import TermsIcon from '@/assets/icons/terms.svg?react'; import './mobDropdownMenu.css'; const menuItems = [ diff --git a/frontend/src/components/layout/sidebar/SidebarItem.jsx b/frontend/src/components/layout/sidebar/SidebarItem.jsx index b88a9f10..dc5ec63d 100644 --- a/frontend/src/components/layout/sidebar/SidebarItem.jsx +++ b/frontend/src/components/layout/sidebar/SidebarItem.jsx @@ -1,4 +1,4 @@ -import addSquare from 'assets/icons/add-square.svg'; +import addSquare from '@/assets/icons/add-square.svg'; import { ChevronDown, ChevronUp } from 'lucide-react'; export const SidebarItem = ({ item: { icon, name }, isExpanded, hasChildren, isNested }) => { diff --git a/frontend/src/components/layout/star-maker/StarMaker.jsx b/frontend/src/components/layout/star-maker/StarMaker.jsx index 3afc808f..a59852ff 100644 --- a/frontend/src/components/layout/star-maker/StarMaker.jsx +++ b/frontend/src/components/layout/star-maker/StarMaker.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ReactComponent as Star } from '../../../assets/particles/star.svg'; +import Star from '@/assets/particles/star.svg?react'; const StarMaker = ({ starData }) => starData.map((star, index) => ( diff --git a/frontend/src/components/layout/wallet-section/WalletSection.jsx b/frontend/src/components/layout/wallet-section/WalletSection.jsx index 6869d1cc..0a703ac1 100644 --- a/frontend/src/components/layout/wallet-section/WalletSection.jsx +++ b/frontend/src/components/layout/wallet-section/WalletSection.jsx @@ -1,6 +1,6 @@ import React, { useState, useEffect, useRef } from 'react'; -import { Button } from 'components/ui/custom-button/Button'; -import { useWalletStore } from '../../../stores/useWalletStore'; +import { Button } from '@/components/ui/custom-button/Button'; +import { useWalletStore } from '@/stores/useWalletStore'; const WalletSection = ({ onConnectWallet, onLogout }) => { const { walletId } = useWalletStore(); diff --git a/frontend/src/components/report-modal/ReportBugModal.jsx b/frontend/src/components/report-modal/ReportBugModal.jsx index 52016c29..4d9e9334 100644 --- a/frontend/src/components/report-modal/ReportBugModal.jsx +++ b/frontend/src/components/report-modal/ReportBugModal.jsx @@ -1,75 +1,52 @@ -import React, { useState } from "react"; -import "./ReportBugModal.css"; -import telegramIcon from "../../assets/icons/telegram.svg"; -import { Button } from "components/ui/custom-button/Button"; -import { useWalletStore } from "stores/useWalletStore"; -import { useBugReport } from "hooks/useBugReport"; +import React, { useState } from 'react'; +import './ReportBugModal.css'; +import telegramIcon from '@/assets/icons/telegram.svg'; +import { Button } from '@/components/ui/custom-button/Button'; +import { useWalletStore } from '@/stores/useWalletStore'; +import { useBugReport } from '@/hooks/useBugReport'; export function ReportBugModal({ onClose }) { - const { walletId } = useWalletStore(); - const [bugDescription, setBugDescription] = useState(""); - const { mutation, handleSubmit } = useBugReport(walletId, bugDescription, onClose); + const { walletId } = useWalletStore(); + const [bugDescription, setBugDescription] = useState(''); + const { mutation, handleSubmit } = useBugReport(walletId, bugDescription, onClose); - return ( -
-
e.stopPropagation()} - onSubmit={handleSubmit} - > -
-
-

Report Bug

-

- Please describe the bug you've encountered -

-