cleaning code
This commit is contained in:
parent
193ed837b4
commit
929e02f0df
|
@ -1,7 +1,7 @@
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack')
|
||||||
|
|
||||||
module.exports = function override(config) {
|
module.exports = function override(config) {
|
||||||
const fallback = config.resolve.fallback || {};
|
const fallback = config.resolve.fallback || {}
|
||||||
Object.assign(fallback, {
|
Object.assign(fallback, {
|
||||||
"crypto": require.resolve("crypto-browserify"),
|
"crypto": require.resolve("crypto-browserify"),
|
||||||
"stream": require.resolve("stream-browserify"),
|
"stream": require.resolve("stream-browserify"),
|
||||||
|
@ -11,13 +11,13 @@ module.exports = function override(config) {
|
||||||
"os": require.resolve("os-browserify"),
|
"os": require.resolve("os-browserify"),
|
||||||
"url": require.resolve("url")
|
"url": require.resolve("url")
|
||||||
})
|
})
|
||||||
config.resolve.fallback = fallback;
|
config.resolve.fallback = fallback
|
||||||
config.plugins = (config.plugins || []).concat([
|
config.plugins = (config.plugins || []).concat([
|
||||||
new webpack.ProvidePlugin({
|
new webpack.ProvidePlugin({
|
||||||
process: 'process/browser',
|
process: 'process/browser',
|
||||||
Buffer: ['buffer', 'Buffer']
|
Buffer: ['buffer', 'Buffer']
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
config.ignoreWarnings = [/Failed to parse source map/];
|
config.ignoreWarnings = [/Failed to parse source map/]
|
||||||
return config;
|
return config
|
||||||
}
|
}
|
12
src/App.js
12
src/App.js
|
@ -1,11 +1,11 @@
|
||||||
import React from 'react';
|
import React from 'react'
|
||||||
import {
|
import {
|
||||||
ChakraProvider, ColorModeScript,
|
ChakraProvider, ColorModeScript,
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react'
|
||||||
import { theme } from './theme'
|
import { theme } from './theme'
|
||||||
import { Layout } from './components';
|
import { Layout } from './components'
|
||||||
import { Outlet } from 'react-router-dom'
|
import { Outlet } from 'react-router-dom'
|
||||||
import { AppContextProvider } from './AppContext';
|
import { AppContextProvider } from './AppContext'
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ function App() {
|
||||||
</Layout>
|
</Layout>
|
||||||
</AppContextProvider>
|
</AppContextProvider>
|
||||||
</ChakraProvider >
|
</ChakraProvider >
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default App;
|
export default App
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import { config } from "./config"
|
import { config } from "./config"
|
||||||
import { get_settings } from './api'
|
import { get_settings } from './api'
|
||||||
import { ImTwitter, ImTelegram, ImFacebook, ImWhatsapp } from "react-icons/im";
|
import { ImTwitter, ImTelegram, ImFacebook, ImWhatsapp } from "react-icons/im"
|
||||||
|
|
||||||
const AppContext = React.createContext(null)
|
const AppContext = React.createContext(null)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ import {
|
||||||
Button, Flex, VStack, HStack, IconButton,
|
Button, Flex, VStack, HStack, IconButton,
|
||||||
useColorModeValue, useDisclosure, Icon, Text,
|
useColorModeValue, useDisclosure, Icon, Text,
|
||||||
useToast, Stack,
|
useToast, Stack,
|
||||||
Select,
|
|
||||||
} from '@chakra-ui/react'
|
} from '@chakra-ui/react'
|
||||||
import { FiMenu, FiCircle } from 'react-icons/fi'
|
import { FiMenu, FiCircle } from 'react-icons/fi'
|
||||||
import { Logo } from './Logo'
|
import { Logo } from './Logo'
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import React from "react"
|
||||||
|
import { Stack } from "@chakra-ui/react"
|
||||||
|
|
||||||
|
export const BottomNav = () => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack>
|
||||||
|
|
||||||
|
</Stack>
|
||||||
|
)
|
||||||
|
}
|
|
@ -5,12 +5,12 @@ import {
|
||||||
Stack,
|
Stack,
|
||||||
Container,
|
Container,
|
||||||
AspectRatio,
|
AspectRatio,
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react'
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import Slider from 'react-slick'
|
import Slider from 'react-slick'
|
||||||
// import { BiLeftArrowAlt, BiRightArrowAlt } from 'react-icons/bi';
|
// import { BiLeftArrowAlt, BiRightArrowAlt } from 'react-icons/bi'
|
||||||
import "slick-carousel/slick/slick.css";
|
import "slick-carousel/slick/slick.css"
|
||||||
import "slick-carousel/slick/slick-theme.css";
|
import "slick-carousel/slick/slick-theme.css"
|
||||||
|
|
||||||
const settings = {
|
const settings = {
|
||||||
dots: true,
|
dots: true,
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import React from 'react';
|
import React from 'react'
|
||||||
import { useColorMode, useColorModeValue, IconButton } from '@chakra-ui/react';
|
import { useColorMode, useColorModeValue, IconButton } from '@chakra-ui/react'
|
||||||
import { FaMoon, FaSun } from 'react-icons/fa';
|
import { FaMoon, FaSun } from 'react-icons/fa'
|
||||||
|
|
||||||
export const ColorModeSwitcher = props => {
|
export const ColorModeSwitcher = props => {
|
||||||
const { toggleColorMode } = useColorMode();
|
|
||||||
const text = useColorModeValue('dark', 'light');
|
const { toggleColorMode } = useColorMode()
|
||||||
const SwitchIcon = useColorModeValue(FaMoon, FaSun);
|
const text = useColorModeValue('dark', 'light')
|
||||||
|
const SwitchIcon = useColorModeValue(FaMoon, FaSun)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton
|
||||||
|
@ -19,5 +20,5 @@ export const ColorModeSwitcher = props => {
|
||||||
icon={<SwitchIcon />}
|
icon={<SwitchIcon />}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
)
|
||||||
};
|
}
|
||||||
|
|
|
@ -3,41 +3,41 @@ import {
|
||||||
useColorModeValue, useDisclosure, DrawerOverlay,
|
useColorModeValue, useDisclosure, DrawerOverlay,
|
||||||
} from '@chakra-ui/react'
|
} from '@chakra-ui/react'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { SideBar } from './SideBar';
|
import { SideBar } from './SideBar'
|
||||||
import { AppBar } from './AppBar';
|
import { AppBar } from './AppBar'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component was not composed for more widely using but just for this project.
|
* This component was not composed for more widely using but just for this project.
|
||||||
*/
|
*/
|
||||||
export const Layout = ({ children }) => {
|
export const Layout = ({ children }) => {
|
||||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
const { isOpen: isDrawerOpening, onOpen: onOpenDrawer, onClose: onCloseDrawer } = useDisclosure()
|
||||||
const bg = useColorModeValue('gray.100', 'gray.900')
|
const bg = useColorModeValue('gray.100', 'gray.900')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box minH="100vh" bg={bg}>
|
<Box minH="100vh" bg={bg}>
|
||||||
<SideBar
|
<SideBar
|
||||||
onClose={onClose}
|
onCloseDrawer={onCloseDrawer}
|
||||||
display={{ base: 'none', md: 'block' }}
|
display={{ base: 'none', md: 'block' }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Drawer
|
<Drawer
|
||||||
autoFocus={false}
|
autoFocus={false}
|
||||||
isOpen={isOpen}
|
isOpen={isDrawerOpening}
|
||||||
placement="right"
|
placement="right"
|
||||||
onClose={onClose}
|
onClose={onCloseDrawer}
|
||||||
returnFocusOnClose={false}
|
returnFocusOnClose={false}
|
||||||
onOverlayClick={onClose}
|
onOverlayClick={onCloseDrawer}
|
||||||
size="md">
|
size="md">
|
||||||
|
|
||||||
<DrawerOverlay />
|
<DrawerOverlay />
|
||||||
|
|
||||||
<DrawerContent>
|
<DrawerContent>
|
||||||
<SideBar onClose={onClose} />
|
<SideBar onCloseDrawer={onCloseDrawer} />
|
||||||
</DrawerContent>
|
</DrawerContent>
|
||||||
|
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
|
||||||
<AppBar onOpenDrawer={onOpen} />
|
<AppBar onOpenDrawer={onOpenDrawer} />
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
ml={{ base: 0, md: 60 }}
|
ml={{ base: 0, md: 60 }}
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
import {
|
import {
|
||||||
Text, Box, CloseButton, Flex, Icon, useColorModeValue,
|
Box, CloseButton, Flex, Icon, useColorModeValue,
|
||||||
Stack, Select,
|
Stack,
|
||||||
} from '@chakra-ui/react'
|
} from '@chakra-ui/react'
|
||||||
import { FiArrowRight, FiHome, FiTrendingUp } from 'react-icons/fi'
|
import { FiArrowRight, FiHome, FiTrendingUp } from 'react-icons/fi'
|
||||||
import { useApp } from '../AppContext'
|
import { useApp } from '../AppContext'
|
||||||
import { Logo } from './Logo'
|
import { Logo } from './Logo'
|
||||||
import { ColorModeSwitcher } from './ColorModeSwitcher'
|
import { ColorModeSwitcher } from './ColorModeSwitcher'
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useLocalStorage } from '../hooks'
|
|
||||||
import { Lang } from './Lang'
|
import { Lang } from './Lang'
|
||||||
import { supportedLangs } from '../i18'
|
import { supportedLangs } from '../i18'
|
||||||
|
|
||||||
|
@ -68,7 +67,7 @@ const SocialItem = ({ icon, path, ...rest }) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SideBar = ({ onClose, ...rest }) => {
|
export const SideBar = ({ onCloseDrawer, ...rest }) => {
|
||||||
const app = useApp()
|
const app = useApp()
|
||||||
|
|
||||||
const bg = useColorModeValue('white', 'gray.900')
|
const bg = useColorModeValue('white', 'gray.900')
|
||||||
|
@ -108,7 +107,7 @@ export const SideBar = ({ onClose, ...rest }) => {
|
||||||
display={{ base: 'flex', md: 'none' }}
|
display={{ base: 'flex', md: 'none' }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CloseButton display={{ base: 'flex', md: 'none' }} onClick={onClose} />
|
<CloseButton display={{ base: 'flex', md: 'none' }} onClick={onCloseDrawer} />
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex h="90%" direction="column" justifyContent="space-between">
|
<Flex h="90%" direction="column" justifyContent="space-between">
|
||||||
|
@ -125,7 +124,7 @@ export const SideBar = ({ onClose, ...rest }) => {
|
||||||
{/* nav links */}
|
{/* nav links */}
|
||||||
{
|
{
|
||||||
menuItems.map((item) => (
|
menuItems.map((item) => (
|
||||||
item.enabled && <NavItem key={item.name} icon={item.icon} onClick={onClose} path={item.path}>
|
item.enabled && <NavItem key={item.name} icon={item.icon} onClick={onCloseDrawer} path={item.path}>
|
||||||
{item.name}
|
{item.name}
|
||||||
</NavItem>
|
</NavItem>
|
||||||
))
|
))
|
||||||
|
|
|
@ -266,4 +266,4 @@ export const ABI = [
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
}
|
}
|
||||||
];
|
]
|
||||||
|
|
|
@ -41,4 +41,4 @@ const parseResources = () => {
|
||||||
|
|
||||||
export const supportedLangs = parseResources()
|
export const supportedLangs = parseResources()
|
||||||
|
|
||||||
export default i18n;
|
export default i18n
|
18
src/index.js
18
src/index.js
|
@ -1,12 +1,12 @@
|
||||||
import { ColorModeScript } from '@chakra-ui/react';
|
import { ColorModeScript } from '@chakra-ui/react'
|
||||||
import React, { StrictMode } from 'react';
|
import React, { StrictMode } from 'react'
|
||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client'
|
||||||
import i18n from './i18'
|
import i18n from './i18'
|
||||||
import App from './App';
|
import App from './App'
|
||||||
import { Home, Farm } from './pages'
|
import { Home, Farm } from './pages'
|
||||||
import reportWebVitals from './reportWebVitals';
|
import reportWebVitals from './reportWebVitals'
|
||||||
import * as serviceWorker from './serviceWorker';
|
import * as serviceWorker from './serviceWorker'
|
||||||
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
import { BrowserRouter, Routes, Route } from 'react-router-dom'
|
||||||
|
|
||||||
const element = document.getElementById('root')
|
const element = document.getElementById('root')
|
||||||
const root = createRoot(element)
|
const root = createRoot(element)
|
||||||
|
@ -30,9 +30,9 @@ root.render(
|
||||||
// If you want your app to work offline and load faster, you can change
|
// If you want your app to work offline and load faster, you can change
|
||||||
// unregister() to register() below. Note this comes with some pitfalls.
|
// unregister() to register() below. Note this comes with some pitfalls.
|
||||||
// Learn more about service workers: https://cra.link/PWA
|
// Learn more about service workers: https://cra.link/PWA
|
||||||
serviceWorker.unregister();
|
serviceWorker.unregister()
|
||||||
|
|
||||||
// If you want to start measuring performance in your app, pass a function
|
// If you want to start measuring performance in your app, pass a function
|
||||||
// to log results (for example: reportWebVitals(console.log))
|
// to log results (for example: reportWebVitals(console.log))
|
||||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||||
reportWebVitals();
|
reportWebVitals()
|
||||||
|
|
|
@ -107,7 +107,7 @@ export const transfer = async (ABI, contract_address, to, amount, from, callback
|
||||||
export const approve = (ABI, auth_address, appAddress, fromAddress, callback) => {
|
export const approve = (ABI, auth_address, appAddress, fromAddress, callback) => {
|
||||||
web3.eth.getGasPrice().then(gasPrice => {
|
web3.eth.getGasPrice().then(gasPrice => {
|
||||||
if (!gasPrice) {
|
if (!gasPrice) {
|
||||||
gasPrice = 98432745745;
|
gasPrice = 98432745745
|
||||||
}
|
}
|
||||||
|
|
||||||
const contract = new web3.eth.Contract(ABI, auth_address)
|
const contract = new web3.eth.Contract(ABI, auth_address)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React from "react";
|
import React from "react"
|
||||||
|
|
||||||
|
|
||||||
export const Announcement = () => {
|
export const Announcement = () => {
|
||||||
|
|
|
@ -164,7 +164,7 @@ export const Farm = () => {
|
||||||
if (r.input.search(app.appAddress.substring(4, 35).toLowerCase()) != -1) {
|
if (r.input.search(app.appAddress.substring(4, 35).toLowerCase()) != -1) {
|
||||||
for (let i = 0; i < _coins.length; i++) {
|
for (let i = 0; i < _coins.length; i++) {
|
||||||
if (_coins[i].address == r.to) {
|
if (_coins[i].address == r.to) {
|
||||||
list += _coins[i].name + "|";
|
list += _coins[i].name + "|"
|
||||||
_coins[i].authorized = true
|
_coins[i].authorized = true
|
||||||
changed = true
|
changed = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import React from "react";
|
import React from "react"
|
||||||
import {
|
import {
|
||||||
Box, Stack, VStack, Image, Text,
|
Box, Stack, VStack, Image, Text,
|
||||||
Flex, HStack, useColorModeValue
|
Flex, HStack, useColorModeValue
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react"
|
||||||
import { Auditors, Partners, Carousel, MultiChainCard, StateCard, MiningListCard } from "../components";
|
import { Auditors, Partners, Carousel, MultiChainCard, StateCard, MiningListCard } from "../components"
|
||||||
import { useApp } from '../AppContext'
|
import { useApp } from '../AppContext'
|
||||||
import { get_coins_platform } from '../api'
|
import { get_coins_platform } from '../api'
|
||||||
import { ImPieChart, ImFire } from 'react-icons/im'
|
import { ImPieChart, ImFire } from 'react-icons/im'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React from "react";
|
import React from "react"
|
||||||
|
|
||||||
|
|
||||||
export const Staking = () => {
|
export const Staking = () => {
|
||||||
|
|
Loading…
Reference in New Issue