From e745a283cfb7cd544acd46cee91146f18bfd5957 Mon Sep 17 00:00:00 2001 From: Marcus Date: Wed, 21 Jun 2023 19:16:25 -0300 Subject: [PATCH] proxy: show appropriate actions --- .../L2/Dropdowns/AccountsDropdown.tsx | 2 +- src/lib/types/Point.ts | 8 +++--- src/views/Ops/Ops.scss | 9 ++++++- src/views/Ops/Ops.tsx | 25 +++++++++++++------ src/views/Point/Point.tsx | 11 ++++---- src/views/UrbitID/Home.tsx | 19 +++++++------- 6 files changed, 45 insertions(+), 29 deletions(-) diff --git a/src/components/L2/Dropdowns/AccountsDropdown.tsx b/src/components/L2/Dropdowns/AccountsDropdown.tsx index 48ea4572d..f4234b2bb 100644 --- a/src/components/L2/Dropdowns/AccountsDropdown.tsx +++ b/src/components/L2/Dropdowns/AccountsDropdown.tsx @@ -77,7 +77,7 @@ const AccountsDropdown = ({ showMigrate = false }: AccountsDropdownProps) => { point.value >= 0 ? point.patp : currentAddress.slice(0, 6); const displayedPoints = useMemo( - () => pointList.filter(({ ownManageSpawn }) => ownManageSpawn), + () => pointList.filter(({ ownManageSpawnVote }) => ownManageSpawnVote), [pointList] ); diff --git a/src/lib/types/Point.ts b/src/lib/types/Point.ts index c73e02ba5..0d3755177 100644 --- a/src/lib/types/Point.ts +++ b/src/lib/types/Point.ts @@ -123,7 +123,7 @@ export default class Point { showInvites: boolean; isDefault: boolean; isPlaceholder: boolean; - ownManageSpawn: boolean; + ownManageSpawnVote: boolean; shouldDisplay: boolean; isOutgoing: boolean; permissionLevel: PermissionLevel; @@ -206,11 +206,11 @@ export default class Point { this.showInvites = this.canManage || this.canSpawn; this.isDefault = value === -1; this.isPlaceholder = isPlaceholder; - this.ownManageSpawn = + this.ownManageSpawnVote = !this.isPlaceholder && !this.isDefault && - (this.isOwner || this.isSpawnProxy || this.isManagementProxy); - this.shouldDisplay = this.ownManageSpawn || this.isTransferProxy; + (this.isOwner || this.isSpawnProxy || this.isManagementProxy || this.isVotingProxy); + this.shouldDisplay = this.ownManageSpawnVote || this.isTransferProxy; this.isOutgoing = this.isTransferProxySet && !this.isTransferProxy && diff --git a/src/views/Ops/Ops.scss b/src/views/Ops/Ops.scss index 469937bb8..e788b904d 100644 --- a/src/views/Ops/Ops.scss +++ b/src/views/Ops/Ops.scss @@ -1,7 +1,14 @@ .id-ops { .between-row { - .section-title, .subtitle { + + .section-title, + .subtitle { font-size: 14px; } } + + .disabled { + opacity: 0.5; + pointer-events: none; + } } \ No newline at end of file diff --git a/src/views/Ops/Ops.tsx b/src/views/Ops/Ops.tsx index 61363936d..48da5bc70 100644 --- a/src/views/Ops/Ops.tsx +++ b/src/views/Ops/Ops.tsx @@ -67,7 +67,9 @@ export const Ops = () => { - + Residents @@ -75,11 +77,15 @@ export const Ops = () => { for - - + Requests @@ -87,19 +93,24 @@ export const Ops = () => { sponsorship - {point.isGalaxy && ( - - + + Proposals View or vote on proposals in the Senate - diff --git a/src/views/Point/Point.tsx b/src/views/Point/Point.tsx index fc0211d9d..e512066cb 100644 --- a/src/views/Point/Point.tsx +++ b/src/views/Point/Point.tsx @@ -82,7 +82,7 @@ export default function Point() { loadL2Info(); }, [point]); // eslint-disable-line react-hooks/exhaustive-deps - const { isParent, canManage, isSpawnProxy } = point; + const { isParent, canManage, canVote, canSpawn } = point; const goUrbitOS = useCallback(() => { if (hideMessage) setSeenMissingKeys(hideMessage); @@ -114,9 +114,8 @@ export default function Point() { 1 ? 's' : '' - } Spawned`} + title={`${spawnedPending} Planet${spawnedPending > 1 ? 's' : '' + } Spawned`} /> )} {!!otherPending.length && @@ -163,14 +162,14 @@ export default function Point() { /> )} - {(canManage || isSpawnProxy) && ( + {(canManage || canSpawn || canVote) && ( ) as any} onClick={goUrbitID} - disabled={!(canManage || isSpawnProxy)} + disabled={!(canManage || canSpawn || canVote)} /> )} diff --git a/src/views/UrbitID/Home.tsx b/src/views/UrbitID/Home.tsx index 0bd3f7825..788787a0c 100644 --- a/src/views/UrbitID/Home.tsx +++ b/src/views/UrbitID/Home.tsx @@ -56,7 +56,6 @@ export default function UrbitIDHome() { const goResetKeys = useCallback(() => push(names.RESET_KEYS), [push, names]); const isMasterTicket = Just.hasInstance(urbitWallet); - const { isOwner, canManage } = point; const networkRevision = convertToInt(point.keyRevisionNumber, 10); const goSetProxy = useCallback( @@ -75,20 +74,20 @@ export default function UrbitIDHome() {
ID
- {isMasterTicket && ( + {isMasterTicket && point.isOwner && ( )}
- {isOwner && ( + {point.isOwner && ( Ownership Address @@ -105,7 +104,7 @@ export default function UrbitIDHome() { )} - {canManage && ( + {point.canManage && ( Management Address @@ -131,7 +130,7 @@ export default function UrbitIDHome() { )} - {point.isParent && ( + {point.canSpawn && ( Spawn Proxy Address @@ -156,7 +155,7 @@ export default function UrbitIDHome() { )} - {isOwner && ( + {point.isOwner && ( @@ -193,7 +192,7 @@ export default function UrbitIDHome() { - {point.isGalaxy && ( + {point.canVote && ( Edit Voting Key