Skip to content

Commit ec20bef

Browse files
committed
feat: add governance warning
1 parent 18223e1 commit ec20bef

File tree

6 files changed

+23
-5
lines changed

6 files changed

+23
-5
lines changed

src/language/en-US.json

+1
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@
592592
"staking.modal6.note.part5": "in order to broadcast this transaction successfully",
593593
"governance.title": "Governance",
594594
"governance.description": "You may see all proposals and cast your votes here.",
595+
"governance.warning": "This proposal contains external links that may lead to suspicious websites. Please open with caution.",
595596
"governance.votingHistoryBtn": "View Voting History",
596597
"governance.tab1": "All",
597598
"governance.tab2": "Voting",

src/language/ko-KR.json

+1
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@
589589
"staking.modal6.note.part5": "이 거래를 성공적으로 발송하기 위해서",
590590
"governance.title": "거버넌스",
591591
"governance.description": "여기에서 모든 제안을 보고 투표할 수 있습니다.",
592+
"governance.warning": "이 제안서에는 의심스러운 웹사이트로 이동할 수 있는 외부 링크가 포함되어 있습니다. 주의해서 열어주세요.",
592593
"governance.votingHistoryBtn": "투표 기록 보기",
593594
"governance.tab1": "모두",
594595
"governance.tab2": "투표",

src/language/zh-CN.json

+1
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@
592592
"staking.modal6.note.part5": "以完成此交易",
593593
"governance.title": "治理",
594594
"governance.description": "你可以在这里看到所有提案并行使你的投票权。",
595+
"governance.warning": "此提案包含可能导向可疑网站的外部连结。请谨慎开启。",
595596
"governance.votingHistoryBtn": "查看投票历史",
596597
"governance.tab1": "所有",
597598
"governance.tab2": "投票中",

src/language/zh-HK.json

+1
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@
592592
"staking.modal6.note.part5": "以完成此交易",
593593
"governance.title": "治理",
594594
"governance.description": "你可以在這裡看到所有提案並行使你的投票權。",
595+
"governance.warning": "此提案包含可能導向可疑網站的外部連結。請謹慎開啟。",
595596
"governance.votingHistoryBtn": "查看投票歷史",
596597
"governance.tab1": "所有",
597598
"governance.tab2": "投票中",

src/pages/governance/components/ProposalView.tsx

+16-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Big from 'big.js';
44
import '../governance.less';
55
import 'antd/dist/antd.css';
66
// eslint-disable-next-line @typescript-eslint/no-unused-vars
7-
import { Layout, Radio, Button, Card, Progress, Form, InputNumber, Spin } from 'antd';
7+
import { Layout, Radio, Button, Card, Progress, Form, InputNumber, Spin, Alert } from 'antd';
88
import { LoadingOutlined } from '@ant-design/icons';
99
import { useRecoilValue, useRecoilState } from 'recoil';
1010
import { useTranslation } from 'react-i18next';
@@ -307,11 +307,22 @@ export const ProposalView = (props: any) => {
307307
{allProps?.proposal?.proposal_id}
308308
</div>
309309
</div>
310-
310+
{allProps.proposal?.content?.description.includes('http') ?
311+
<div className="warning">
312+
<Alert
313+
type="warning"
314+
message={t('governance.warning')}
315+
showIcon
316+
/>
317+
</div>
318+
: <></>}
311319
<div className="description">
312-
{allProps.proposal?.content?.description ? allProps.proposal?.content.description.split('\\n').map((p, i) => (
313-
<p key={i}>{p}</p>
314-
)) : <p key={0}>(No description)</p>}
320+
{allProps.proposal?.content?.description ?
321+
allProps.proposal?.content.description.split(/\n|\\n/).map((p, i) => (
322+
<p key={i}>{p}</p>
323+
))
324+
: <p key={0}>(No description)</p>
325+
}
315326
</div>
316327
<div className="item">
317328
{allProps.proposal?.status === ProposalStatuses.PROPOSAL_STATUS_VOTING_PERIOD ? (

src/pages/governance/governance.less

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
margin-bottom: 20px;
88
color: @font-color;
99
}
10+
.warning{
11+
margin-bottom: 20px;
12+
}
1013
.amount {
1114
.ant-form-item {
1215
margin: 0;

0 commit comments

Comments
 (0)