Skip to content

Commit 2548a06

Browse files
author
CsB-Polymesh
committed
updated code based on latest suggestions
1 parent 6beb532 commit 2548a06

16 files changed

Lines changed: 83 additions & 202 deletions

File tree

src/constants/routes/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const PATHS = {
4848
TRANSFERS: '/transfers',
4949
MULTISIG: '/multisig',
5050
AUTHORIZATIONS: '/authorizations',
51-
SECONDARY_KEYS: '/secondary-key-permissions',
51+
SECONDARY_KEYS: '/secondary-keys',
5252
CLAIMS: '/claims',
5353
DISTRIBUTIONS: '/distributions',
5454
SETTINGS: '/settings',
@@ -81,7 +81,7 @@ export const ROUTES = [
8181
},
8282
{
8383
path: PATHS.SECONDARY_KEYS,
84-
label: 'Secondary Key Permissions',
84+
label: 'Secondary Keys',
8585
component: SecondaryKeys,
8686
},
8787
{ path: PATHS.SETTINGS, label: 'Settings', component: Settings },
@@ -165,7 +165,7 @@ export const NAV_LINKS = [
165165
},
166166
{
167167
path: PATHS.SECONDARY_KEYS,
168-
label: 'Secondary Key Permissions',
168+
label: 'Secondary Keys',
169169
icon: 'KeyIcon',
170170
},
171171
{ path: PATHS.CLAIMS, label: 'Claims', icon: 'ClaimsIcon' },

src/layouts/SecondaryKeys/components/AddPermission/components/AssetsPermissions.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ const ASSET_RADIO_OPTIONS = [
3131
title: 'Access to all except specific assets',
3232
description: 'The key can access all assets except the ones you specify',
3333
},
34+
{
35+
type: 'None' as PermissionType,
36+
title: 'No access to any assets',
37+
description: 'The key cannot interact with any assets',
38+
},
3439
] as const;
3540

3641
const AssetSelectorWrapper = ({

src/layouts/SecondaryKeys/components/AddPermission/components/PortfoliosPermissions.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ const PORTFOLIO_RADIO_OPTIONS = [
3333
description:
3434
'The key can access all portfolios except the ones you specify',
3535
},
36+
{
37+
type: 'None' as PermissionType,
38+
title: 'No access to any portfolios',
39+
description: 'The key cannot access any portfolios',
40+
},
3641
] as const;
3742

3843
const PortfolioSelectorWrapper = ({

src/layouts/SecondaryKeys/components/AddPermission/hooks.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
import { useState, useCallback, useMemo } from 'react';
22
import { EPermissionStep, EPermissionTab } from '../../constants';
33
import { IPermissionFormData, initialPermissionState } from './constants';
4-
import { VALIDATION_MESSAGES } from '../../uiConstants';
4+
5+
const VALIDATION_MESSAGES = {
6+
ASSET_EXCLUDE_REQUIRED:
7+
'At least one asset must be selected when using "Exclude" permission type',
8+
EXTRINSIC_THESE_REQUIRED:
9+
'At least one extrinsic must be selected when using "Specific modules and/or methods" permission type',
10+
PORTFOLIO_EXCLUDE_REQUIRED:
11+
'At least one portfolio must be selected when using "Exclude" permission type',
12+
PORTFOLIO_THESE_REQUIRED:
13+
'At least one portfolio must be selected when using "Specific portfolios only" permission type',
14+
} as const;
515

616
export const useAddPermissionModal = (
717
initialData?: IPermissionFormData,

src/layouts/SecondaryKeys/components/AddPermission/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { ExtrinsicsPermissions } from './components/ExtrinsicsPermissions';
2020
import { PortfoliosPermissions } from './components/PortfoliosPermissions';
2121
import { PermissionSummary } from './components/PermissionSummary';
2222

23-
interface IAddPermissionModalProps {
23+
interface IEditPermissionsModalProps {
2424
onClose: () => void;
2525
onConfirm?: (key: string, permissions: IPermissionFormData) => Promise<void>;
2626
initialData?: IPermissionFormData;
@@ -29,14 +29,14 @@ interface IAddPermissionModalProps {
2929
isSubmitting?: boolean;
3030
}
3131

32-
export const AddPermissionModal = ({
32+
export const EditPermissionsModal = ({
3333
onClose,
3434
onConfirm,
3535
initialData,
3636
selectedKeyAddress,
3737
isEdit = false,
3838
isSubmitting = false,
39-
}: IAddPermissionModalProps) => {
39+
}: IEditPermissionsModalProps) => {
4040
const {
4141
currentStep,
4242
activeTab,

src/layouts/SecondaryKeys/components/ConfirmationModal/styles.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/layouts/SecondaryKeys/components/NoSecondaryKeysView/index.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
StyledInfo,
88
StyledLink,
99
StyledLinkGroup,
10+
StyledNavLink,
1011
} from './styles';
1112

1213
export const NoSecondaryKeysView = () => (
@@ -16,11 +17,15 @@ export const NoSecondaryKeysView = () => (
1617
</StyledIcon>
1718
<StyledTitle>No secondary keys attached</StyledTitle>
1819
<StyledInfo>
19-
No secondary keys are currently associated with this identity. Add
20-
secondary keys and set their permissions from the Authorizations page.
20+
No secondary keys are currently associated with this identity.
21+
<br />
22+
First, add a secondary key from the Authorizations page. Then return here
23+
to set its permissions.
2124
</StyledInfo>
2225
<StyledLinkGroup>
23-
<StyledLink href={PATHS.AUTHORIZATIONS}>Go to Authorizations</StyledLink>
26+
<StyledNavLink to={PATHS.AUTHORIZATIONS}>
27+
Go to Authorizations
28+
</StyledNavLink>
2429
<StyledLink
2530
href="https://developers.polymesh.network/identity/advanced/secondary-keys/"
2631
target="_blank"

src/layouts/SecondaryKeys/components/NoSecondaryKeysView/styles.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { NavLink } from 'react-router-dom';
12
import styled from 'styled-components';
23

34
export const StyledContainer = styled.section`
@@ -70,3 +71,19 @@ export const StyledLinkGroup = styled.div`
7071
width: 100%;
7172
align-items: center;
7273
`;
74+
75+
export const StyledNavLink = styled(NavLink)`
76+
font-size: 16px;
77+
line-height: 150%;
78+
color: ${({ theme }) => theme.colors.textPink};
79+
text-decoration: underline;
80+
text-align: center;
81+
82+
&:hover {
83+
opacity: 0.8;
84+
}
85+
86+
@media screen and (max-width: 767px) {
87+
font-size: 15px;
88+
}
89+
`;

src/layouts/SecondaryKeys/components/SecondaryKeyItem/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { AccountContext } from '~/context/AccountContext';
55
import { PortfolioContext } from '~/context/PortfolioContext';
66
import { AssetContext } from '~/context/AssetContext';
77
import { formatBalance } from '~/helpers/formatters';
8-
import { UI_CONSTANTS } from '../../uiConstants';
98
import { formatAssetDisplay, deduplicateAssetsByID } from '../../utils';
109
import {
1110
StyledSecondaryKeyItem,
@@ -261,9 +260,7 @@ export const SecondaryKeyItem = ({
261260
{data.permissions.transactions.values.map((tx) => {
262261
const extrinsicsText = tx.extrinsics?.join(', ') || '';
263262
const fullText = `${tx.pallet}.${extrinsicsText}`;
264-
const shouldBreak =
265-
fullText.length >
266-
UI_CONSTANTS.EXTRINSIC_TEXT_BREAK_LENGTH;
263+
const shouldBreak = fullText.length > 35;
267264
const txKey = `${tx.pallet}-${
268265
tx.extrinsics?.join('-') || 'all'
269266
}`;

src/layouts/SecondaryKeys/components/SecondaryKeysNavigation/constants.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)