Skip to content

feat: gov adapt to Mobile #380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions dapps/governance/src/modules/Dashboard/Statistics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,46 +80,42 @@ const Statistics: React.FC = () => {

return (
<div>
<div className='mt-[16px] flex gap-[24px]'>
<div className='mt-[16px] flex flex-col sm:flex-row gap-[16px] sm:gap-[24px]'>
<div className='w-full p-[16px] rounded-[8px] bg-white shadow-md'>
<div className='text-[12px] text-[#898D9A]'>Total Balance</div>
<BalanceText className='text-[16px] text-[#1B1B1C]' id="Dashboard Total Balance" balance={isSameChain ? totalBalance : false} symbol="CFX" decimals={18} />
<BalanceText className='text-[14px] sm:text-[16px] text-[#1B1B1C]' id="Dashboard Total Balance" balance={isSameChain ? totalBalance : false} symbol="CFX" decimals={18} />
</div>
<div className='w-full p-[16px] rounded-[8px] bg-white shadow-md'>
<div className='text-[13px] text-[#898D9A]'>Available Balance</div>
<div className='text-[12px] text-[#898D9A]'>Available Balance</div>
<BalanceText
className="text-[16px] text-[#3D3F4C]"
className="text-[14px] sm:text-[16px] text-[#3D3F4C]"
id="Dashboard Available Balance"
balance={isSameChain ? balance : false}
symbol={'CFX'}
decimals={18}
/>
<div className='flex mt-[16px]'>

<div className='flex mt-[16px] flex-wrap gap-[16px]'>
<Link to="https://www.conflux-pos-validators.com/" target='_block'>
<Button
className='w-[100px] relative'>
<Button className='w-[100px] relative'>
<ToolTip des="APY: ~10%+" />
<span>PoS Stake</span>
</Button>
</Link>
{
!isESpace && <Link to="/governance/pow-stake">
<Button className='w-[100px] ml-[16px]' variant='outlined'>PoW Stake</Button>
<Button className='w-[100px]' variant='outlined'>PoW Stake</Button>
</Link>
}

</div>

</div>
<div className='w-full p-[16px] rounded-[8px] bg-white shadow-md'>
<div className='text-[12px] text-[#898D9A]'>Total Staked</div>
<BalanceText className='text-[16px] text-[#1B1B1C]' id="Dashboard Total Staked" balance={isSameChain ? totalStaked : false} symbol="CFX" decimals={18} />
<BalanceText className='text-[14px] sm:text-[16px] text-[#1B1B1C]' id="Dashboard Total Staked" balance={isSameChain ? totalStaked : false} symbol="CFX" decimals={18} />
</div>
<div className='w-full p-[16px] rounded-[8px] bg-white shadow-md'>
<div className='text-[12px] text-[#898D9A]'>Total Locked</div>
<BalanceText className='text-[16px] text-[#1B1B1C]' id="Dashboard Total Locked" balance={isSameChain ? totalLocked : false} symbol="CFX" decimals={18} />
<div className='mt-[16px] text-[14px]'>
<BalanceText className='text-[14px] sm:text-[16px] text-[#1B1B1C]' id="Dashboard Total Locked" balance={isSameChain ? totalLocked : false} symbol="CFX" decimals={18} />
<div className='mt-[16px] text-[12px] sm:text-[14px]'>
<span className='text-[#898D9A]'>Voting Power:</span>
<BalanceText className='text-[#3D3F4C]' id="Dashboard Voting Power" balance={isSameChain ? totalPower : false} symbol="" />
</div>
Expand Down
20 changes: 15 additions & 5 deletions dapps/governance/src/modules/Dashboard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
import React, { useEffect } from 'react';
import { Link, useLocation, type To } from 'react-router-dom';

import { startTrack } from 'governance/src/store';

import Statistics from './Statistics'
import StakePos from './Pos'
import StakePow from './Pow'
import Statistics from './Statistics';
import StakePos from './Pos';
import StakePow from './Pow';

const Dashboard: React.FC = () => {
useEffect(startTrack, []);

return (
<div className="mx-auto w-[1140px] h-[718px] pt-[16px]">
<div className='text-[24px] text-[#3D3F4C]'>My Dashboard</div>
<div className="mx-auto w-full max-w-[1140px] px-4 sm:px-6 h-auto sm:h-[718px] pt-[16px]">
<div className="flex items-center">
<div className="text-[20px] sm:text-[24px] text-[#3D3F4C]">My Dashboard</div>
<Link
className="ml-[12px] px-3 py-1.5 text-[14px] text-[#808BE7] bg-[#F0F3FF] rounded-[4px] no-underline sm:hidden"
to="/governance/vote/onchain-dao-voting"
>
Vote Now
</Link>
</div>

<Statistics />
<StakePow />
<StakePos />
Expand Down
2 changes: 1 addition & 1 deletion dapps/governance/src/modules/PowStake/Lock/LockModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const LockModalContent: React.FC<{ type: Type }> = memo(({ type }) => {
);

return (
<div className="relative w-[444px] min-h-[400px] p-[24px] bg-white rounded-[4px]">
<div className="relative w-[calc(100vw-32px)] max-w-[444px] md:w-[444px] min-h-[400px] p-[24px] mx-auto bg-white rounded-[4px]">
<img
className="absolute right-[12px] top-[13px] w-[16px] h-[16px] cursor-pointer hover:scale-110 transition-transform select-none z-20"
onClick={hideLockModal}
Expand Down
7 changes: 3 additions & 4 deletions dapps/governance/src/modules/PowStake/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { startTrack } from 'governance/src/store';
const Dashboard: React.FC = () => {
useEffect(startTrack, []);
return (
<div className='mx-auto w-[1140px] h-[718px] pt-[16px] '>
<div className='mx-auto w-full max-w-[1140px] h-auto md:h-[718px] px-4 md:px-0 pt-[16px]'>
<Link
className='flex items-center mb-[16px] text-[#3D3F4C] hover:text-[#3D3F4C]'
to="/governance/dashboard">
Expand All @@ -18,15 +18,14 @@ const Dashboard: React.FC = () => {
alt="back button"
src={Expand}
/>
<div className='ml-[8px] text-[24px]'>Back</div>
<div className='ml-[8px] text-[20px] md:text-[24px]'>Back</div>
</Link>

<div className="w-full it grid grid-rows-2 grid-cols-2 gap-[24px]">
<div className="w-full grid grid-cols-1 md:grid-cols-2 md:grid-rows-2 gap-[16px] md:gap-[24px]">
<Stake />
<Lock />
<Unstake />
</div>

</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Proposal } from "governance/src/store/proposalList"
import { spaceSeat } from 'common/conf/Networks';

const CastVotesModal = new PopupClass();
CastVotesModal.setListClassName('cast-votes-modal-wrapper');

CastVotesModal.setItemWrapperClassName('toast-item-wrapper');
CastVotesModal.setAnimatedSize(false);

Expand Down Expand Up @@ -255,7 +255,7 @@ const CastVotesModalContent = memo(({ type, proposal }: { type: VoteTypes, propo


return (
<div className="cast-votes-modal relative w-[444px] p-[24px] bg-white rounded-[4px]">
<div className="relative w-[calc(100vw-32px)] md:w-[444px] p-4 md:p-[24px] mx-auto bg-white rounded-[4px]">
<img
className="absolute right-[12px] top-[13px] w-[16px] h-[16px] cursor-pointer hover:scale-110 transition-transform select-none z-20"
onClick={hideCastVotesModal}
Expand Down
26 changes: 14 additions & 12 deletions dapps/governance/src/modules/Vote/RewardInterestRate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,42 @@ const RewardInterestRate: React.FC = () => {


return (
<div className="governance-shadow p-[24px] bg-white">
<div className="governance-shadow p-4 md:p-[24px] bg-white">
<div className="flex items-center gap-[12px]">
<span className="px-[10px] min-w-[40px] h-[28px] leading-[28px] rounded-[4px] text-[14px] text-[#808BE7] font-medium bg-[#F0F3FF] text-center">
Round {currentVotingRound}
</span>
</div>

<div className="mt-[16px] flex justify-between">
<div className="mt-[16px] flex flex-col md:flex-row md:justify-between gap-4 md:gap-0">
<div className="">
<div className='flex text-[16px]'>
<div className="w-[120px] text-[#898D9A]">Voting Period:</div>
<div className='flex flex-col md:flex-row text-[16px]'>
<div className="w-[100px] md:w-[120px] text-[#898D9A]">Voting Period:</div>
<div className='text-[#3D3F4C]'>
{currentVotingRoundStartTimestamp ? dayjs(currentVotingRoundStartTimestamp).format('YYYY-MM-DD HH:mm:ss') : '--'} - {currentVotingRoundEndTimestamp ? dayjs(currentVotingRoundEndTimestamp).format('YYYY-MM-DD HH:mm:ss') : '--'}
</div>
</div>
<div className='flex text-[16px]'>
<div className="w-[120px] text-[#898D9A]">Effective time:</div>
<div className='flex flex-col md:flex-row text-[16px]'>
<div className="w-[100px] md:w-[120px] text-[#898D9A]">Effective time:</div>
<div className='text-[#3D3F4C]'>{currentVotingRoundEffectiveTimestamp ? dayjs(currentVotingRoundEffectiveTimestamp).format('YYYY-MM-DD HH:mm:ss') : '--'}</div>
</div>
<div className='flex text-[16px]'>
<div className="w-[120px] text-[#898D9A]">Requirements:</div>
<div className="text-[#808BE7] ">At least {posStakeForVotes ? <NumFormatWithEllipsis value={posStakeForVotes.mul(Unit.fromMinUnit(0.05)).toDecimalStandardUnit()} /> : '--'}</div>
<div className='ml-[5px] text-[#3D3F4C] text-[14px]'> voting power</div>
<div className='flex flex-col md:flex-row text-[16px]'>
<div className="w-[100px] md:w-[120px] text-[#898D9A]">Requirements:</div>
<div className="flex">
<div className="text-[#808BE7]">At least {posStakeForVotes ? <NumFormatWithEllipsis value={posStakeForVotes.mul(Unit.fromMinUnit(0.05)).toDecimalStandardUnit()} /> : '--'}</div>
<div className='ml-[5px] text-[#3D3F4C] text-[14px]'>voting power</div>
</div>
</div>
</div>
<div className="">
<div className="flex justify-end mb-[12px] text-[16px] ">
<div className="flex flex-col md:flex-row md:justify-end mb-[12px] text-[16px]">
<div className="text-[#898D9A]">Voting End: &nbsp;</div>
<div className='text-[#3D3F4C]'>{currentVotingRoundEndTimestamp ? dayjs(currentVotingRoundEndTimestamp).format('YYYY-MM-DD HH:mm:ss') : '--'}</div>
</div>
<Countdown />
</div>
</div>
<div className="mt-[24px] flex gap-[25px] flex-wrap">
<div className="mt-[24px] flex gap-[25px] flex-wrap justify-center sm:justify-start">
<VotingResult />
</div>

Expand Down
2 changes: 1 addition & 1 deletion dapps/governance/src/modules/Vote/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Main: React.FC = () => {
useEffect(startTrackRewardInterestRate, []);

return (
<div className="mx-auto w-[1140px] pt-[16px] pb-[24px]">
<div className="mx-auto w-full max-w-[1140px] pt-[16px] pb-[24px]">
{/* <Header /> */}
<Tabs />
<Outlet />
Expand Down
2 changes: 1 addition & 1 deletion packages/common/components/Popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ const PopupContainer = forwardRef<PopupMethods>((_, ref) => {
<div>
<Mask open={openMask} className={maskClassName} style={maskStyle} onClick={maskClickHandler} />
<List
className={classNames('dapp-modal fixed flex flex-col items-center justify-center w-fit left-[50%] top-0 translate-x-[-50%] z-[201] h-[100%]', listClassName)}
className={classNames('fixed flex flex-col items-center justify-center w-fit left-[50%] top-0 translate-x-[-50%] z-[201] h-[100%]', listClassName)}
list={popupList}
animatedSize={animatedSize}
style={listStyle}
Expand Down