Browse Source

修改样式

master
mac 6 months ago
parent
commit
103b909ab8
  1. 29
      src/pages/home/index.tsx
  2. 4
      src/pages/pledge/index.tsx
  3. 2
      src/router/layout/index.tsx

29
src/pages/home/index.tsx

@ -11,7 +11,7 @@ import { toString } from '~/utils/wei'
const Home = () => { const Home = () => {
const { push } = useRouter() const { push } = useRouter()
const { t } = useTranslation()
const { t, i18n } = useTranslation()
const [pledgeList, setPledgeList] = useState([ const [pledgeList, setPledgeList] = useState([
{ day: 180, rate: 1408 }, { day: 180, rate: 1408 },
@ -37,9 +37,24 @@ const Home = () => {
res.data && setPledgeList(res.data) res.data && setPledgeList(res.data)
} }
const renderTitle = () => {
if (i18n.language === 'en') {
return (
<div className='tac mt-1 fz-17'>Up To <span className='fz-24 fz-wb-550'>7%</span> of Referees Staking Rewards</div>
)
}
if (i18n.language === 'hk') {
return (
<div className='tac mt-1 fz-17'> <span className='fz-24 fz-wb-550'>7%</span> </div>
)
}
return <div className='tac mt-1 fz-17'> <span className='fz-24 fz-wb-550'>7%</span> </div>
}
useEffect(() => { useEffect(() => {
getData() getData()
}, []) }, [])
return ( return (
<div className="home"> <div className="home">
<div className="liner-box"> <div className="liner-box">
@ -71,7 +86,7 @@ const Home = () => {
</div> </div>
<div className='mt-2 row-between'> <div className='mt-2 row-between'>
<div>{t('Annualized Percentage Rate (APR)')}</div> <div>{t('Annualized Percentage Rate (APR)')}</div>
<div className='fz-26 fz-wb-550'>{toString(pledgeList[pledgeIndex].rate,2)}%</div>
<div className='fz-26 fz-wb-550'>{toString(pledgeList[pledgeIndex].rate, 2)}%</div>
</div> </div>
</div> </div>
</div> </div>
@ -107,13 +122,13 @@ const Home = () => {
<div className='tac fz-18px fz-wb-550 mt-3'>{t('Refer To Earn')}</div> <div className='tac fz-18px fz-wb-550 mt-3'>{t('Refer To Earn')}</div>
<div className='plr-1'> <div className='plr-1'>
<div className='refer row-center'>
<img src={require('~/assets/group.png')} className='img' alt="" />
<div className='box p-2'>
<div className='fz-wb-550 tac'>{t('Up To 7% of Referees Staking Rewards')}</div>
<div className='row-center mt-1 plr-1' onClick={() => {
<div className='refer row-center' onClick={() => {
push('/myPledge') push('/myPledge')
}}> }}>
<img src={require('~/assets/group.png')} className='img' alt="" />
<div className='box plr-1'>
<div className='fz-wb-550 tac pt-1'>{renderTitle()}</div>
<div className='row-center mt-1 plr-1'>
<div className='tac fz-14'>{t('By sharing your referral code and introducing your friends to SOFIL and stake, you can earn referral rewards and withdraw everyday.')}</div> <div className='tac fz-14'>{t('By sharing your referral code and introducing your friends to SOFIL and stake, you can earn referral rewards and withdraw everyday.')}</div>
<div className='iconfont icon-arrow fz-26'></div> <div className='iconfont icon-arrow fz-26'></div>
</div> </div>

4
src/pages/pledge/index.tsx

@ -42,8 +42,8 @@ const Pledge = () => {
const navbarRefs = useRef<HTMLDivElement>(document.querySelector('.layout .header')) const navbarRefs = useRef<HTMLDivElement>(document.querySelector('.layout .header'))
const handleInput = (e: React.ChangeEvent<HTMLInputElement>) => { const handleInput = (e: React.ChangeEvent<HTMLInputElement>) => {
let value = e.target.value.replace(/[^\d]/g, '')
setAmount(value)
let value = e.target.value
setAmount(toFixed2(value, 0))
} }
const getData = async () => { const getData = async () => {

2
src/router/layout/index.tsx

@ -7,6 +7,7 @@ import { useEffect } from 'react';
import store from '~/store'; import store from '~/store';
import { initContract } from '~/contract'; import { initContract } from '~/contract';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { SOFIL_LANGUAGE } from '~/language';
const LayoutRouter = () => { const LayoutRouter = () => {
@ -46,6 +47,7 @@ const LayoutRouter = () => {
if (pathname === 'zh' || pathname === 'hk' || pathname === 'en') { if (pathname === 'zh' || pathname === 'hk' || pathname === 'en') {
i18n.changeLanguage(pathname) i18n.changeLanguage(pathname)
push('/', null, true) push('/', null, true)
window.sessionStorage.setItem(SOFIL_LANGUAGE, pathname)
} }
} }

Loading…
Cancel
Save