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