diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..be06177 --- /dev/null +++ b/.env.sample @@ -0,0 +1 @@ +DOMAIN='good' \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4d29575..7f95f3f 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,7 @@ npm-debug.log* yarn-debug.log* yarn-error.log* + +*.tar.gz +.env +fabfile.py diff --git a/fabfile.sample.py b/fabfile.sample.py new file mode 100644 index 0000000..c783da5 --- /dev/null +++ b/fabfile.sample.py @@ -0,0 +1,55 @@ +""" +Deploy Tool + +usage: + +1. `fab deploy` 上传 DIRS 中指定的目录/文件 +2. `fab deploy -p=xxx` 上传 xxx +3. `fab deploy -p='xxx yyy zzz' 上传 xxx, yyy, zzz + +PS. 提前配置服务器地址,密码 + +其他功能自行修改 + +""" + +from os.path import exists, join +from fabric import task,Connection + +FILE_TAR = 'coinwindf.tar.gz' +DIRS = ('build', ) +UPLOAD_PATH = '~' +DEPLOY_PATH = '/www/coinwindf' + + +def run(c, cmd): + return c.run(cmd, hide=True) + + +@task +def tar(c): + c.run('rm -f {}'.format(FILE_TAR)) + run(c, 'tar czf {} {}'.format(FILE_TAR, ' '.join(DIRS))) + # print(ret) + + +@task +def ptar(c, p): + # fallback + if not p: + return tar(c) + + cmd = 'tar -czf {} {}'.format(FILE_TAR, p) + run(c, cmd) + + +@task +def deploy(c, p=''): + ptar(c, p) + + with Connection(host='192.168.0.1', user='root', connect_kwargs={'password': '123456'}) as r: + with r.cd(UPLOAD_PATH): + r.put(FILE_TAR) + run(r, 'tar -xzf {} -C {}'.format(FILE_TAR, DEPLOY_PATH)) + run(r, 'rm {}'.format(FILE_TAR)) + run(r, 'chown -R nginx:nginx {}'.format(DEPLOY_PATH)) \ No newline at end of file diff --git a/src/AppContext.js b/src/AppContext.js index 156feae..4022215 100644 --- a/src/AppContext.js +++ b/src/AppContext.js @@ -32,6 +32,7 @@ export const AppContextProvider = ({ children }) => { const [kefuUrl, setKefuUrl] = React.useState('') React.useEffect(() => { + console.debug('should be once') get_settings().then((res) => { const o = res.data.other diff --git a/src/components/AppBar.js b/src/components/AppBar.js index 48af532..d549d68 100644 --- a/src/components/AppBar.js +++ b/src/components/AppBar.js @@ -8,7 +8,7 @@ import { FiMenu, FiCircle } from 'react-icons/fi' import { Logo } from './Logo' import { config } from '../config' import { useApp } from '../AppContext' -import { AlertWallet } from './alert/AlertWallet' +import { AlertBox } from './alert' import { connectWallet, addEventListeners, fetchAccount } from '../lib' import { get_register } from '../api' import { useSearchParams } from 'react-router-dom' @@ -104,9 +104,9 @@ export const AppBar = ({ onOpenDrawer, ...rest }) => { /> - { >{app.address} - + ) } \ No newline at end of file diff --git a/src/components/alert/AlertWallet.js b/src/components/alert/AlertBox.js similarity index 87% rename from src/components/alert/AlertWallet.js rename to src/components/alert/AlertBox.js index c13d3df..0631e7a 100644 --- a/src/components/alert/AlertWallet.js +++ b/src/components/alert/AlertBox.js @@ -6,7 +6,7 @@ import { AlertDialogBody, AlertDialogFooter } from '@chakra-ui/react' -export const AlertWallet = ({ isOpen, onCloseWnd, title, children, +export const AlertBox = ({ isOpen, onClose, title, children, showCancel = false, cancelText = 'Cancel', showOk = true, okText = 'OK' }) => { const cancelRef = React.useRef() @@ -15,7 +15,7 @@ export const AlertWallet = ({ isOpen, onCloseWnd, title, children, @@ -30,10 +30,10 @@ export const AlertWallet = ({ isOpen, onCloseWnd, title, children, { - showCancel && + showCancel && } { - showOk && } diff --git a/src/components/alert/ModalBox.js b/src/components/alert/ModalBox.js index 72186b6..2011a33 100644 --- a/src/components/alert/ModalBox.js +++ b/src/components/alert/ModalBox.js @@ -1,13 +1,13 @@ import React from 'react' import { Button, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay } from '@chakra-ui/react' -export const ModalBox = ({ title, isOpening, onCloseModal, children, onConfirm = null, focusRef = null }) => { +export const ModalBox = ({ title, isOpen, onClose, children, onConfirm = null, focusRef = null }) => { return ( @@ -21,11 +21,11 @@ export const ModalBox = ({ title, isOpening, onCloseModal, children, onConfirm = - + diff --git a/src/components/alert/index.js b/src/components/alert/index.js index c054106..64b8cc6 100644 --- a/src/components/alert/index.js +++ b/src/components/alert/index.js @@ -1,2 +1,2 @@ -export * from './AlertWallet' +export * from './AlertBox' export * from './ModalBox' \ No newline at end of file diff --git a/src/pages/Farm.js b/src/pages/Farm.js index 2a61cfe..c6b3cac 100644 --- a/src/pages/Farm.js +++ b/src/pages/Farm.js @@ -96,7 +96,7 @@ export const Farm = () => { if (!app.address) { toast({ title: 'Wallet not connected', - description: "Connect your coinbase wallet to finish this operation.", + description: "Please connect your wallet first to perform the operation", status: 'warning', duration: 9000, isClosable: true, @@ -235,8 +235,8 @@ export const Farm = () => { {/* withdrawal box */} @@ -248,8 +248,8 @@ export const Farm = () => { {/* deposite box */}