This commit is contained in:
john 2022-05-13 11:44:07 +07:00
commit 52b1aae95b
11 changed files with 22953 additions and 58 deletions

2
.gitignore vendored
View File

@ -10,7 +10,7 @@
# production # production
/build /build
.idea
# misc # misc
.DS_Store .DS_Store
.env.local .env.local

22893
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -42,9 +42,9 @@ export const AppContextProvider = ({ children }) => {
{ name: t('staking'), icon: FiLock, path: '/staking', enabled: true }, { name: t('staking'), icon: FiLock, path: '/staking', enabled: true },
]) ])
const [docItems, setDocItems] = React.useState([ const [docItems, setDocItems] = React.useState([
{ name: t('announcement'), icon: '', path: '', enabled: true }, { name: t('announcement'), icon: '', path: '/ann', enabled: true },
{ name: t('faq'), icon: '', path: '', enabled: true }, { name: t('faq'), icon: '', path: '/faq', enabled: true },
{ name: t('tutorial'), icon: '', path: '', enabled: true }, { name: t('tutorial'), icon: '', path: '/tut', enabled: true },
]) ])
React.useEffect(() => { React.useEffect(() => {

View File

@ -137,3 +137,8 @@ export const get_withdrawal = (address, balance, he_address) => {
type: 1, type: 1,
}) })
} }
export const get_article = (params) => {
return getWith('article', params)
}

View File

@ -1,7 +1,7 @@
const items = { const items = {
development: { development: {
ENDPOINT: 'http://coinwind.test/' ENDPOINT: 'http://coinwind.local.com/'
}, },
production: { production: {
ENDPOINT: 'https://gdb.01a01.com/' ENDPOINT: 'https://gdb.01a01.com/'

View File

@ -2,7 +2,7 @@ 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, Staking } from './pages' import { Home, Farm, Staking, Faq,Announcement,Tut } 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'
@ -20,6 +20,9 @@ root.render(
<Route path="home" element={<Home />} /> <Route path="home" element={<Home />} />
<Route path="farm" element={<Farm />} /> <Route path="farm" element={<Farm />} />
<Route path="staking" element={<Staking />} /> <Route path="staking" element={<Staking />} />
<Route path="faq" element={<Faq />} />
<Route path="ann" element={<Announcement />} />
<Route path="tut" element={<Tut />} />
<Route path="*" element={<NotFound />} /> <Route path="*" element={<NotFound />} />
</Route> </Route>
</Routes> </Routes>

View File

@ -1,9 +1,27 @@
import React from "react" import React from "react"
import {useLocalStorage} from "../hooks";
import {get_article} from "../api";
export const Announcement = () => { export const Announcement = () => {
const [ann, setAnn] = React.useState({title: "", content: ""})
const [sel] = useLocalStorage('lang', 'en')
React.useEffect(() => {
get_article({lang:sel,type:"ann"}).then(res=>{
if (res.data.code === 0) {
setAnn(res.data.data)
}
}).catch(c=>{
console.error(c)
})
},[])
return ( return (
<div>Announcement</div> <div>
<div>{ann.title}</div>
<div dangerouslySetInnerHTML={{__html:ann.content}}></div>
</div>
) )
} }

38
src/pages/Faq.js Normal file
View File

@ -0,0 +1,38 @@
import React from "react"
// import {
// Box,List,ListItem
// } from "@chakra-ui/react"
import {
get_article
} from '../api'
import {useLocalStorage} from "../hooks";
export const Faq = () => {
const [faq, setFaq] = React.useState({title: "", content: ""})
const [sel] = useLocalStorage('lang', 'en')
React.useEffect(() => {
get_article({lang:sel,type:"faq"}).then(res=>{
if (res.data.code === 0) {
setFaq(res.data.data)
}
}).catch(c=>{
console.error(c)
})
},[])
// const elementRef = React.useRef()
// const rateList = [
// {from: "0", to: "5000", rate: "1.6%"},
// {from: "5001", to: "30000", rate: "2.2%"},
// {from: "30001", to: "80000", rate: "2.8%"},
// {from: "80001", to: "150000", rate: "3.5%"},
// {from: "150001", to: "200000", rate: "4.2%"},
// {from: "200000", to: "500000", rate: "5%"},
// ]
return (
<div>
<div>{faq.title}</div>
<div dangerouslySetInnerHTML={{__html:faq.content}}></div>
</div>
)
}

26
src/pages/Tut.js Normal file
View File

@ -0,0 +1,26 @@
import React from "react"
import {useLocalStorage} from "../hooks";
import {get_article} from "../api";
export const Tut = () => {
const [tut, setTut] = React.useState({title: "", content: ""})
const [sel] = useLocalStorage('lang', 'en')
React.useEffect(() => {
get_article({lang:sel,type:"tut"}).then(res=>{
if (res.data.code === 0) {
setTut(res.data.data)
}
}).catch(c=>{
console.error(c)
})
},[])
return (
<div>
<div>{tut.title}</div>
<div dangerouslySetInnerHTML={{__html:tut.content}}></div>
</div>
)
}

View File

@ -5,3 +5,5 @@ export * from './Staking'
export * from './Announcement' export * from './Announcement'
export * from './NotFound' export * from './NotFound'
export * from './Invite' export * from './Invite'
export * from './Faq'
export * from './Tut'