Skip to content

Commit

Permalink
Fixed Council page refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
ndkazu committed Mar 28, 2024
1 parent dd8655e commit 5097051
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
21 changes: 6 additions & 15 deletions fs-dapp_2.0/src/components/pages/Council.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function Council() {
let acc_list = proposals;
if (acc && !acc_list.includes(acc1 as InjectedAccountWithMeta) && acc1){
acc_list.push(acc1);
dispatch1({type:`SET_PROPOSALS`,payload:[]});

dispatch1({type:`SET_PROPOSALS`,payload:acc_list});


Expand Down Expand Up @@ -77,19 +77,10 @@ export default function Council() {
if (hash.length > 0) {

setHash0(hash);
dispatch1({type:`SET_PROPOSALS`,payload:[]});
dispatch1({type:`SET_DATAS`,payload:[]});

update()
let tdata0:DataType[]=[];
datas.forEach(elemnt=>{
if (hash0.includes(elemnt.hash) && !tdata0.includes(elemnt) && elemnt.status!==`AWAITING`){
tdata0.push(elemnt);
console.log(`Number of active proposals: ${tdata0.length}`)
}
if (hash0.includes(elemnt.hash) && !tdata0.includes(elemnt)){
tdata0.push(elemnt);
console.log(`Number of active proposals: ${tdata0.length}`)
}else{tdata0=datas}
})
dispatch1({type:`SET_DATAS`,payload:tdata0});


}
Expand All @@ -114,11 +105,11 @@ export default function Council() {
renderItem={item => (
<Card
hoverable
style={{ width: 300, height:120}}>
style={{ width: 300, height:150}}>
<List.Item key={item.address}>
<List.Item.Meta
title={<p>{item.name}</p>}
description={<div><p>Requested Role: {item.role}</p><p>Request Status: {item.status}</p></div>}
description={<div><p>Requested Role: {item.role}</p><p>Request Status: {item.status}</p><p>Session is closed: {item.referendum}</p></div>}
/>
<div>Content</div>
</List.Item>
Expand Down
14 changes: 7 additions & 7 deletions fs-dapp_2.0/src/components/pages/Roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ export default function Roles() {
});
}
});
}, [selectedAccount, api, dispatch0, dispatch1, dispatch, web3Name, blocks]);
}, [blocks,selectedAccount, api, dispatch0, dispatch1, dispatch]);

return (
<div className="p-10">
<Space direction="horizontal" size={100} style={{ display: 'flex' }} align="center">
<Col span={70}>
<Card title="Your wallet" size="default">
<Space direction="horizontal" style={{ display: 'flex' }} align="center">
<Col >
<Card title="Your wallet" style={{ width: 320, height:200}}>
{selectedAccount ? (
<div>
<p className="text-xl">
Expand Down Expand Up @@ -116,8 +116,8 @@ export default function Roles() {
</Card>
</Col>

<Col span={50}>
<Card title="Status" size="default">
<Col >
<Card title="Status" style={{ width: 220, height:200}}>
<h1>
Your Roles:{' '}
{!(role.length > 0)
Expand All @@ -131,7 +131,7 @@ export default function Roles() {
</Card>
</Col>

<Col span={70}>
<Col >
<Card title="Requests status" size="default">
<h1 className="flex flex-col px-4 ">
Last Requested Role:{' '}
Expand Down
2 changes: 1 addition & 1 deletion fs-dapp_2.0/src/components/shared/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const RolesApp: React.FC = () => {
<Toast>
<div
className={
'shadow-md rounded-md flex text-white text-xl items-center justify-center ' +
'shadow-md rounded-md flex text-white text-base items-center justify-normal ' +
(warning === true ? ' bg-red-500 animate-bounce ' : ' bg-green-600 animate-pulse')
}
>
Expand Down
1 change: 1 addition & 0 deletions fs-dapp_2.0/src/components/shared/referendum.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function Referendum() {
const { role } = useAccountContext();

const yes = Number(((ayes / council_members.length) * 100).toFixed(1));
console.log(`Number of yes:${ayes}`)

return (
<div>
Expand Down

0 comments on commit 5097051

Please sign in to comment.