From 1734b40af3afca01ab5e9c3eb295da7dff74f16a Mon Sep 17 00:00:00 2001 From: Aaron Cox Date: Mon, 24 Feb 2025 20:14:07 -0800 Subject: [PATCH] WIP --- messages/en.json | 5 +- messages/ko.json | 1 + messages/zh.json | 1 + .../permissions/[permission]/+page.svelte | 468 ++++++++++++++++++ .../[name]/permissions/[permission]/+page.ts | 26 + 5 files changed, 500 insertions(+), 1 deletion(-) create mode 100644 src/routes/[network]/(explorer)/account/[name]/permissions/[permission]/+page.svelte create mode 100644 src/routes/[network]/(explorer)/account/[name]/permissions/[permission]/+page.ts diff --git a/messages/en.json b/messages/en.json index 9f3543bf..046b2a6b 100644 --- a/messages/en.json +++ b/messages/en.json @@ -18,9 +18,10 @@ "change_network": "Change network", "coinbase_service_unavailable": "Coinbase service is currently unavailable.", "common_about_something": "About {thing}", - "common_account": "Account", + "common_account": "Actor", "common_account_balance": "Account Balance", "common_account_multisig_using_account": "multisig using {account}", + "common_account_name": "Account Name", "common_action": "Action", "common_actions": "Actions", "common_actor": "Actor", @@ -102,6 +103,7 @@ "common_producer_name": "Producer Name", "common_producer_standby": "Standby", "common_producer_top21": "Top 21", + "common_public_key": "Public Key", "common_ram_market": "RAM Market", "common_recent_activity": "Recent Activity", "common_recipient": "Recipient", @@ -109,6 +111,7 @@ "common_refund": "Refund", "common_refund_tokens": "Claim previously delegated {token} tokens", "common_refunding": "Refunding", + "common_remove": "Remove", "common_required": "Required", "common_resouce_amount": "Amount of {resource}", "common_resources": "Resources", diff --git a/messages/ko.json b/messages/ko.json index 09b5fccd..4cdc36d3 100644 --- a/messages/ko.json +++ b/messages/ko.json @@ -17,6 +17,7 @@ "change_network": "네트워크 변경", "coinbase_service_unavailable": "현재 Coinbase 서비스를 이용할 수 없습니다.", "common_about_something": "{thing} 에 대한 정보", + "common_account": "배우", "common_account_balance": "계정 잔액", "common_action": "행동", "common_actions": "행위", diff --git a/messages/zh.json b/messages/zh.json index fe44109a..99c68504 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -17,6 +17,7 @@ "change_network": "切换网络", "coinbase_service_unavailable": "Coinbase 服务目前不可用。", "common_about_something": "关于{thing}", + "common_account": "行为人", "common_account_balance": "账户余额", "common_action": "操作", "common_actions": "操作", diff --git a/src/routes/[network]/(explorer)/account/[name]/permissions/[permission]/+page.svelte b/src/routes/[network]/(explorer)/account/[name]/permissions/[permission]/+page.svelte new file mode 100644 index 00000000..07ff7baf --- /dev/null +++ b/src/routes/[network]/(explorer)/account/[name]/permissions/[permission]/+page.svelte @@ -0,0 +1,468 @@ + + +{#if data.permission} +
  • +
    +
    +
    {m.common_permission_name()}
    +
    {data.permission.perm_name}
    +
    +
    +
    + {m.common_permission_threshold()} + {m.common_required()} +
    +
    {data.permission.required_auth.threshold}
    +
    + {#if data.permission.linked_actions} +
    +
    {m.common_actions()}
    + {#each data.permission.linked_actions as { action, account }} +
    + + + {#if action} + ::{action} + {/if} + +
    + {/each} +
    + {/if} +
    + +
    + + + +
    + + +
    + {#if keys.length} + + + + + + + + + {#each keys as key, index (key)} + + + + + + {/each} + +
    {m.common_permission_weight()}{m.common_public_key()}
    +
    + +
    +
    +
    + +
    +
    + +
    + {/if} + {#if accounts.length} + + + + + + + + + + + {#each accounts as account, index (account)} + + + + + + + {/each} + +
    {m.common_permission_weight()}{m.common_account_name()}{m.common_permission_name()}thing
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    + {/if} + {#if waits.length} + + + + + + + + + {#each waits as wait, index (wait)} + + + + + + {/each} + +
    {m.common_permission_weight()}Wait (Seconds)
    +
    + +
    +
    +
    + +
    +
    + +
    + {/if} +
    +
  • +{/if} + +{#if modified} + +{/if} + + + +{#if context.settings.data.debugMode} + {JSON.stringify( + { + allValid, + accounts, + keys, + waits + }, + undefined, + 2 + )} +{/if} diff --git a/src/routes/[network]/(explorer)/account/[name]/permissions/[permission]/+page.ts b/src/routes/[network]/(explorer)/account/[name]/permissions/[permission]/+page.ts new file mode 100644 index 00000000..2a367987 --- /dev/null +++ b/src/routes/[network]/(explorer)/account/[name]/permissions/[permission]/+page.ts @@ -0,0 +1,26 @@ +import type { PageLoad } from './$types'; +import * as m from '$lib/paraglide/messages'; + +export const load: PageLoad = async ({ params, parent }) => { + const { network, account } = await parent(); + + const permission = account.permissions.find((p) => p.perm_name.equals(params.permission)); + + return { + permission, + permissionName: params.permission, + subtitle: m.explorer_account_permissions_subtitle({ + network: network.chain.name + }), + pageMetaTags: { + title: m.explorer_account_permissions_meta_title({ + account: params.name, + network: network.chain.name + }), + description: m.explorer_account_permissions_meta_description({ + account: params.name, + network: network.chain.name + }) + } + }; +};