Skip to content

Commit 28a8547

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

11 files changed

Lines changed: 78 additions & 62 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/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/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import {
1313
ModalTitle,
1414
ModalDescription,
1515
ButtonGroup,
16-
} from './components/ConfirmationModal/styles';
16+
StyledSecondaryKeysList,
17+
} from './styles';
1718
import { UI_CONSTANTS } from './uiConstants';
18-
import { StyledSecondaryKeysList } from './styles';
1919
import { ISecondaryKeyData } from './components/SecondaryKeyItem/helpers';
2020
import {
2121
convertSdkPermissionsToKeyData,

src/layouts/SecondaryKeys/styles.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
import styled from 'styled-components';
22

3+
export const ModalContent = styled.div`
4+
padding: 24px;
5+
`;
6+
7+
export const ModalTitle = styled.h2`
8+
margin: 0 0 24px 0;
9+
font-size: 18px;
10+
font-weight: 500;
11+
`;
12+
13+
export const ModalDescription = styled.p`
14+
margin: 0 0 24px 0;
15+
font-size: 14px;
16+
line-height: 1.5;
17+
color: inherit;
18+
`;
19+
20+
export const ButtonGroup = styled.div`
21+
display: flex;
22+
gap: 12px;
23+
justify-content: flex-end;
24+
margin-top: 24px;
25+
`;
26+
327
export const StyledSecondaryKeysList = styled.ul`
428
display: flex;
529
flex-direction: column;

0 commit comments

Comments
 (0)