diff --git a/frontend/.env.example b/frontend/.env.example deleted file mode 100644 index f4d5119..0000000 --- a/frontend/.env.example +++ /dev/null @@ -1,4 +0,0 @@ -REACT_APP_NODE_ADDRESS=wss://node-workshop.gear.rs:443 -REACT_APP_CONTRACT_ADDRESS=0xc661c85f1efc224cd6412d06083b72a18439c3303ed972768925ec0132d55d57 -REACT_APP_IPFS_ADDRESS=http://127.0.0.1:5001 -REACT_APP_IPFS_GATEWAY_ADDRESS=https://ipfs.io/ipfs/ diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js deleted file mode 100644 index 3a9fec5..0000000 --- a/frontend/.eslintrc.js +++ /dev/null @@ -1,34 +0,0 @@ -module.exports = { - root: true, - env: { - browser: true, - es2021: true, - }, - extends: [ - 'plugin:react/recommended', - 'airbnb', - 'airbnb/hooks', - 'airbnb-typescript', - - // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md#when-not-to-use-it - // https://github.com/yannickcr/eslint-plugin-react/issues/3052#issuecomment-1017555974 - 'plugin:react/jsx-runtime', - - 'prettier', - ], - parser: '@typescript-eslint/parser', - parserOptions: { - project: './tsconfig.json', - }, - plugins: ['react', '@typescript-eslint'], - rules: { - 'react/require-default-props': 'off', // we don't use prop-types - '@typescript-eslint/no-unused-expressions': 'off', - 'import/prefer-default-export': 'off', // force named exports - 'import/no-default-export': 'error', - 'react/jsx-no-useless-fragment': 'off', - '@typescript-eslint/no-unused-vars': 'warn', // 'error' is not convinient in development - 'react/jsx-props-no-spreading': 'off', - 'consistent-return': 'off', // we want functions to have different return behavior - }, -}; diff --git a/frontend/.gitignore b/frontend/.gitignore index a93aac6..4d29575 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -1,5 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc .DS_Store -.idea -*.log -tmp/ -node_modules +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/frontend/README.md b/frontend/README.md index 8a2da90..b87cb00 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,35 +1,46 @@ -

- - GEAR - -

-

- -

-
+# Getting Started with Create React App -## Description +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). -React application of [_wiki link_](#) based on [Rust smart-contract](#). +## Available Scripts -## Getting started +In the project directory, you can run: -### Install packages: +### `npm start` -```sh -yarn install -``` +Runs the app in the development mode.\ +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. -### Declare environment variables: +The page will reload if you make edits.\ +You will also see any lint errors in the console. -Create `.env` file, `.env.example` will let you know what variables are expected. +### `npm test` -In order for all features to work as expected, the node and it's runtime version should be chosen based on the current `@gear-js/api` version. +Launches the test runner in the interactive watch mode.\ +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. -In case of issues with the application, try to switch to another network or run your own local node and specify its address in the .env file. When applicable, make sure the smart contract(s) wasm files are uploaded and running in this network accordingly. +### `npm run build` -### Run the app: +Builds the app for production to the `build` folder.\ +It correctly bundles React in production mode and optimizes the build for the best performance. -```sh -yarn start -``` +The build is minified and the filenames include the hashes.\ +Your app 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. + +## 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/). diff --git a/frontend/config-overrides.js b/frontend/config-overrides.js index 602cf1d..acfed40 100644 --- a/frontend/config-overrides.js +++ b/frontend/config-overrides.js @@ -1,6 +1,16 @@ const webpack = require('webpack'); +const path = require(`path`); +const SRC = 'src' module.exports = (config) => { config.plugins.push(new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] })); + config.resolve = { + ...config.resolve, + alias: { + ...config.resolve.alias, + '@': path.resolve(__dirname, `${SRC}`), + }, + }; + return config; }; diff --git a/frontend/index.d.ts b/frontend/index.d.ts deleted file mode 100644 index 6efbd32..0000000 --- a/frontend/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export {}; - -declare global { - interface Window { - walletExtension: { isNovaWallet: boolean }; - } -} diff --git a/frontend/package.json b/frontend/package.json index 208f87b..9e38271 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,59 +1,53 @@ { - "name": "gear-app", + "name": "vara-go", "version": "0.1.0", "private": true, "dependencies": { - "@gear-js/api": "0.35.2", - "@gear-js/react-hooks": "0.9.4", - "@gear-js/ui": "0.5.21", - "@headlessui/react": "^1.7.17", - "@mantine/form": "^5.10.5", - "@polkadot/api": "10.10.1", + "@gear-js/api": "^0.36.6", + "@gear-js/react-hooks": "^0.10.3", + "@gear-js/vara-ui": "^0.0.6", + "@headlessui/react": "^1.7.18", + "@polkadot/api": "10.11.2", "@polkadot/extension-dapp": "0.46.5", - "@polkadot/extension-inject": "0.46.5", - "@polkadot/react-identicon": "3.5.1", - "@polkadot/types": "10.10.1", - "@polkadot/util": "12.3.2", - "@polkadot/util-crypto": "12.3.2", - "@polkadot/wasm-crypto": "7.2.2", - "@radix-ui/react-dialog": "^1.0.5", + "@polkadot/react-identicon": "3.1.4", "@radix-ui/react-scroll-area": "^1.0.5", - "@testing-library/jest-dom": "^5.16.5", + "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", - "assert": "2.1.0", - "buffer": "^6.0.3", - "class-variance-authority": "0.7.0", - "clsx": "^1.2.1", - "framer-motion": "^10.16.5", - "ipfs-http-client": "^57.0.3", - "jotai": "2.6.0", - "prettier": "^2.8.4", + "@types/jest": "^27.5.2", + "@types/node": "^16.18.82", + "@types/react": "^18.2.57", + "@types/react-dom": "^18.2.19", + "assert": "2.0.0", + "buffer": "6.0.3", + "clsx": "1.2.1", + "framer-motion": "^11.0.5", + "jotai": "^2.6.5", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-router-dom": "^6.8.2", - "react-scripts": "^5.0.1", - "react-transition-group": "^4.4.5", - "sass": "^1.58.3", - "typescript": "4.9.5", + "react-router-dom": "^6.22.1", + "react-scripts": "5.0.1", + "sass": "1.62.0", + "typescript": "^4.9.5", "web-vitals": "^2.1.4" }, "scripts": { "start": "react-app-rewired start", "build": "react-app-rewired build", - "test": "react-app-rewired test", + "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { - "extends": "react-app" + "extends": [ + "react-app", + "react-app/jest" + ] }, "browserslist": { "production": [ - "chrome >= 67", - "edge >= 79", - "firefox >= 68", - "opera >= 54", - "safari >= 14" + ">0.2%", + "not dead", + "not op_mini all" ], "development": [ "last 1 chrome version", @@ -62,22 +56,6 @@ ] }, "devDependencies": { - "@types/jest": "^27.5.2", - "@types/node": "18.16.19", - "@types/react": "18.2.33", - "@types/react-dom": "18.2.14", - "@typescript-eslint/eslint-plugin": "6.7.3", - "@typescript-eslint/parser": "6.7.3", - "eslint": "8.48.0", - "eslint-config-airbnb": "19.0.4", - "eslint-config-airbnb-typescript": "17.0.0", - "eslint-config-prettier": "8.8.0", - "eslint-plugin-import": "2.27.5", - "eslint-plugin-jsx-a11y": "6.7.1", - "eslint-plugin-react": "7.33.2", - "eslint-plugin-react-hooks": "4.6.0", "react-app-rewired": "^2.2.1" - }, - "main": "index.js", - "license": "MIT" + } } diff --git a/frontend/public/favicon.ico b/frontend/public/favicon.ico new file mode 100644 index 0000000..a11777c Binary files /dev/null and b/frontend/public/favicon.ico differ diff --git a/frontend/public/favicon.png b/frontend/public/favicon.png deleted file mode 100644 index d8449f9..0000000 Binary files a/frontend/public/favicon.png and /dev/null differ diff --git a/frontend/public/index.html b/frontend/public/index.html index 6862294..2f93cd3 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -2,12 +2,45 @@ - + - Gear *app* dApp Example + + + + + + + + + + React App
+ diff --git a/frontend/public/logo192.png b/frontend/public/logo192.png new file mode 100644 index 0000000..fc44b0a Binary files /dev/null and b/frontend/public/logo192.png differ diff --git a/frontend/public/logo512.png b/frontend/public/logo512.png new file mode 100644 index 0000000..a4e47a6 Binary files /dev/null and b/frontend/public/logo512.png differ diff --git a/frontend/public/manifest.json b/frontend/public/manifest.json new file mode 100644 index 0000000..080d6c7 --- /dev/null +++ b/frontend/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/frontend/public/robots.txt b/frontend/public/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/frontend/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/frontend/public/sprites/icons.svg b/frontend/public/sprites/icons.svg deleted file mode 100644 index 52935f3..0000000 --- a/frontend/public/sprites/icons.svg +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/frontend/src/App.css b/frontend/src/App.css new file mode 100644 index 0000000..74b5e05 --- /dev/null +++ b/frontend/src/App.css @@ -0,0 +1,38 @@ +.App { + text-align: center; +} + +.App-logo { + height: 40vmin; + pointer-events: none; +} + +@media (prefers-reduced-motion: no-preference) { + .App-logo { + animation: App-logo-spin infinite 20s linear; + } +} + +.App-header { + background-color: #282c34; + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: calc(10px + 2vmin); + color: white; +} + +.App-link { + color: #61dafb; +} + +@keyframes App-logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} diff --git a/frontend/src/App.module.scss b/frontend/src/App.module.scss new file mode 100644 index 0000000..aed9ed0 --- /dev/null +++ b/frontend/src/App.module.scss @@ -0,0 +1,13 @@ + + +.app { + display: flex; + flex-direction: column; + height: 100%; + box-sizing: border-box; +} + +.searchBox { + overflow-y: auto; + flex: 1; +} \ No newline at end of file diff --git a/frontend/src/App.scss b/frontend/src/App.scss deleted file mode 100644 index 595b35a..0000000 --- a/frontend/src/App.scss +++ /dev/null @@ -1,22 +0,0 @@ -@use 'assets/styles'; -@use '@gear-js/ui/variables' as *; - -#root { - max-width: 1200px; - min-height: 100vh; - margin: 0 auto; - padding: 0 16px; - display: flex; - flex-direction: column; - box-sizing: content-box; -} - -main { - flex: 1; - padding: 30px 0 60px; - position: relative; // for loaders -} - -body { - background: $bgColor url(assets/images/bg.svg); -} diff --git a/frontend/src/App.test.tsx b/frontend/src/App.test.tsx new file mode 100644 index 0000000..d76787e --- /dev/null +++ b/frontend/src/App.test.tsx @@ -0,0 +1,9 @@ +import React from "react"; +import { render, screen } from "@testing-library/react"; +import App from "./App"; + +test("renders learn react link", () => { + render(); + const linkElement = screen.getByText(/learn react/i); + expect(linkElement).toBeInTheDocument(); +}); diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index c1bbf94..98c55d9 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,25 +1,34 @@ -import { useApi, useAccount } from '@gear-js/react-hooks'; -import { Routing } from 'pages'; -import { Header, Footer, ApiLoader } from 'components'; -import { useWalletSync } from 'features/wallet/hooks'; -import { withProviders } from 'hocs'; -import 'App.scss'; - -function Component() { - const { isApiReady } = useApi(); - const { isAccountReady } = useAccount(); - - useWalletSync(); - - const isAppReady = isApiReady && isAccountReady; +import { Routes, Route } from "react-router-dom"; +import styles from "./App.module.scss"; +import { withProviders } from "./hocs"; +import "@gear-js/vara-ui/dist/style.css"; +import { Main } from "./features/main/components/Main"; +import { SearchResults } from "./features/search/components/SearchResults"; +import { Header } from "./components/Header"; +import { SearchedMurkup } from "./features/search/components/SearchedMurkup"; +const Component = () => { return ( - <> -
-
{isAppReady ? : }
-