Skip to content

Commit

Permalink
Merge branch 'feat/ledger-revoke' into tmp/20240816
Browse files Browse the repository at this point in the history
  • Loading branch information
heisenberg-2077 committed Aug 16, 2024
2 parents a37caf3 + c682281 commit 787aeef
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 40 deletions.
3 changes: 2 additions & 1 deletion _raw/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,8 @@
"tooltipPermit2": "This approval is approved via Permit2 contract:\n{{ permit2Id }}"
},
"revokeModal": {
"confirmRevoke": "Using a seed phrase or private key address, you can batch revoke {{count}} approvals with 1 click.",
"confirmRevokePrivateKey": "Using a seed phrase or private key address, you can batch revoke {{count}} approvals with 1 click.",
"confirmRevokeLedger": "Using a Ledger address, you can batch revoke {{count}} approvals with 1 click.",
"batchRevoke": "Batch Revoke",
"revokeOneByOne": "Revoke One by One",
"revoked": "Revoked:",
Expand Down
5 changes: 3 additions & 2 deletions _raw/locales/zh-CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,6 @@
"cancelBody": "如果关闭此页面,剩余的撤销将不会执行。",
"cancelTitle": "取消剩余撤销",
"confirm": "确认",
"confirmRevoke": "使用种子短语或私钥地址,您可以通过一个签名批量撤销 {{count}} 个批准。",
"confirmTitle": "1签名批量撤销",
"defaultFailed": "交易失败",
"done": "完毕",
Expand All @@ -906,7 +905,9 @@
"revokeWithLedger": "使用 Ledger 开始撤销",
"ledgerSended": "请在 Ledger 上签署请求({{current}}/{{total}})",
"ledgerSigned": "签署。创建交易({{current}}/{{total}})",
"ledgerSending": "正在发送签名请求({{current}}/{{total}})"
"ledgerSending": "正在发送签名请求({{current}}/{{total}})",
"confirmRevokeLedger": "使用账本地址,您可以一键批量撤销 {{count}} 个批准。",
"confirmRevokePrivateKey": "使用助记词或私钥地址,您可以一键批量撤销 {{count}} 个批准。"
}
},
"connect": {
Expand Down
47 changes: 14 additions & 33 deletions src/ui/assets/ledger/press.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ export const RevokeActionLedgerButton: React.FC<{
if (isLedgerLockError(msg) || msg === 'DISCONNECTED') {
setVisibleLedgerConnectModal(true);
task.pause();
task.addRevokeTask(task.currentApprovalRef.current!, 1);

if (msg !== 'DISCONNECTED') {
task.addRevokeTask(task.currentApprovalRef.current!, 1);
}
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import './style.less';
import clsx from 'clsx';
import { Modal } from '@/ui/component';
import { useTranslation } from 'react-i18next';
import { KEYRING_CLASS } from '@/constant';

export const useConfirmRevokeModal = (props: {
revokeListCount: number;
onBatchRevoke: () => void;
onRevokeOneByOne: () => void;
accountType?: string;
}) => {
const { t } = useTranslation();

Expand All @@ -23,9 +25,13 @@ export const useConfirmRevokeModal = (props: {
content: (
<div>
<div className="text-r-neutral-body text-15 leading-[22px]">
{t('page.approvals.revokeModal.confirmRevoke', {
count: props.revokeListCount,
})}
{props.accountType === KEYRING_CLASS.HARDWARE.LEDGER
? t('page.approvals.revokeModal.confirmRevokeLedger', {
count: props.revokeListCount,
})
: t('page.approvals.revokeModal.confirmRevokePrivateKey', {
count: props.revokeListCount,
})}
</div>
<footer className="flex flex-col gap-16 mx-auto mt-24 items-center">
<Button
Expand Down
1 change: 1 addition & 0 deletions src/ui/views/ApprovalManagePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ const ApprovalManagePage = () => {
revokeListCount: revokeSummary.currentRevokeList.length,
onBatchRevoke: () => batchRevokeModal.show(),
onRevokeOneByOne: () => handleRevoke(),
accountType: account?.type,
});
const enableBatchRevoke = React.useMemo(() => {
return (
Expand Down

0 comments on commit 787aeef

Please sign in to comment.