Skip to content

Commit

Permalink
feat: add option to account overflow to make account primary
Browse files Browse the repository at this point in the history
  • Loading branch information
kieranroneill committed Sep 22, 2024
1 parent ac394f7 commit 40b441f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/extension/pages/AccountPage/AccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
IoLockOpenOutline,
IoPencil,
IoQrCodeOutline,
IoStarOutline,
IoTrashOutline,
} from 'react-icons/io5';
import { useDispatch } from 'react-redux';
Expand Down Expand Up @@ -68,6 +69,7 @@ import {
TReKeyType,
} from '@extension/features/re-key-account';
import { saveToStorageThunk as saveSettingsToStorageThunk } from '@extension/features/settings';
import { savePolisAccountIDThunk } from '@extension/features/system';

// hooks
import useDefaultTextColor from '@extension/hooks/useDefaultTextColor';
Expand Down Expand Up @@ -174,6 +176,8 @@ const AccountPage: FC = () => {
};
const handleAddAccountClick = () => navigate(ADD_ACCOUNT_ROUTE);
const handleOnEditAccountClick = () => onEditAccountModalOpen();
const handleOnMakePrimaryClick = () =>
account && dispatch(savePolisAccountIDThunk(account.id));
const handleOnWhatsNewClick = () => dispatch(setWhatsNewModal(true));
const handleOnRefreshActivityClick = () => {
dispatch(
Expand Down Expand Up @@ -417,6 +421,18 @@ const AccountPage: FC = () => {
<OverflowMenu
context={_context}
items={[
// make primary
...(!account ||
!systemInfo ||
systemInfo.polisAccountID !== account.id
? [
{
icon: IoStarOutline,
label: t<string>('labels.makePrimary'),
onSelect: handleOnMakePrimaryClick,
},
]
: []),
// re-key
...(canReKeyAccount()
? [
Expand Down
1 change: 1 addition & 0 deletions src/extension/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ const translation: IResourceLanguage = {
lastRound: 'Last Round',
light: 'Light',
debugLogging: 'Debug Logging',
makePrimary: 'Make Primary',
manage: 'Manage',
managerAccount: 'Manager Account',
max: 'Max',
Expand Down

0 comments on commit 40b441f

Please sign in to comment.