Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TW-1544 Networks management #1202

Merged
merged 53 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
130b27a
TW-1555 Update some design and fix some bugs
keshan3262 Sep 13, 2024
b2dad24
TW-1555 Make some modals close after their backdrop is clicked
keshan3262 Sep 13, 2024
1414857
TW-1542 Resolve merge conflicts
keshan3262 Sep 13, 2024
6b250f3
TW-1542 Revert harmful changes
keshan3262 Sep 13, 2024
6dbdca1
TW-1542 Remove unused components
keshan3262 Sep 13, 2024
982e447
TW-1542 Implement new Settings menu design
keshan3262 Sep 13, 2024
4fb9a56
TW-1542 Remove some unused translations
keshan3262 Sep 13, 2024
6fcb3d7
TW-1542 Fix find-deadcode errors
keshan3262 Sep 13, 2024
f18b05d
TW-1542 Add changes from comments
keshan3262 Sep 16, 2024
f97bee1
TW-1543 Redesign 'General' settings section
keshan3262 Sep 16, 2024
3bbbc88
TW-1543 Refactoring
keshan3262 Sep 17, 2024
25b2037
TW-1542 Move localStorage clearing to frontend
keshan3262 Sep 17, 2024
03342d6
TW-1542 Update a label
keshan3262 Sep 17, 2024
9cdeb5c
TW-1555 Some more bugfixes
keshan3262 Sep 17, 2024
de837fa
Merge branch 'TW-1555-final-epic-testing' of https://github.com/madfi…
keshan3262 Sep 17, 2024
cf85bbd
Merge branch 'TW-1542-apply-design-for-settings-page' of https://gith…
keshan3262 Sep 17, 2024
74041ca
TW-1543 Change error output
keshan3262 Sep 17, 2024
93bd61d
TW-1543 Apply design updates
keshan3262 Sep 17, 2024
06f82f7
TW-1555 Remove some commented out code
keshan3262 Sep 17, 2024
ba0dc8a
TW-1543 Remove excessive locales loading checks
keshan3262 Sep 17, 2024
4dee114
TW-1555 Refactor setting classes
keshan3262 Sep 18, 2024
1feeace
TW-1555 Fix prettier problem
keshan3262 Sep 18, 2024
b3df9cc
TW-1555 Agree styles for app content wrapper and action modals
keshan3262 Sep 18, 2024
375d0c9
TW-1543 Bugfixes according to the comment from Figma
keshan3262 Sep 18, 2024
c885837
Merge branch 'TW-1555-final-epic-testing' of https://github.com/madfi…
keshan3262 Sep 18, 2024
f448902
TW-1542 Change a label
keshan3262 Sep 18, 2024
6aa1703
TW-1542 Fix font size for page header
keshan3262 Sep 18, 2024
9fcfbb8
Merge branch 'TW-1542-apply-design-for-settings-page' of https://gith…
keshan3262 Sep 18, 2024
438ab67
TW-1543 Remove an unused import
keshan3262 Sep 18, 2024
58f3ece
TW-1544 Implement RPCs and block explorers management (raw version)
keshan3262 Sep 20, 2024
3b02db6
TW-1544 Fix some bugs
keshan3262 Sep 23, 2024
9bb455e
TW-1542: Apply design for settings menu (#1199)
keshan3262 Sep 24, 2024
b1a95a9
TW-1543: 'General' section update (#1200)
keshan3262 Sep 24, 2024
625167f
TW-1544 Implement whole networks management
keshan3262 Sep 25, 2024
ce71784
TW-1544 Resolve merge conflicts
keshan3262 Sep 25, 2024
9a1ffa7
TW-1544 Some bugfixes
keshan3262 Sep 25, 2024
ff03850
TW-1544 Some bugfixes
keshan3262 Sep 26, 2024
48b25c5
TW-1544 Additional refactoring
keshan3262 Sep 26, 2024
c3d4c3b
TW-1544 Major refactoring
keshan3262 Sep 30, 2024
db0eb51
TW-1544 Refactoring according to comments
keshan3262 Oct 1, 2024
3172936
TW-1544 Fix a linting error
keshan3262 Oct 1, 2024
0b0585a
TW-1544 Additional refactoring according to comments
keshan3262 Oct 1, 2024
1e6bf34
TW-1548: Redesign 'Advanced Features' section (#1205)
keshan3262 Oct 7, 2024
e5db334
Merge branch 'TW-1541-epic-evm-settings' of https://github.com/madfis…
keshan3262 Oct 9, 2024
ce6d43e
Fix some bugs from comments in Jira
keshan3262 Oct 10, 2024
8e00f6c
TW-1544 Fix rest of bugs from comments in Jira
keshan3262 Oct 11, 2024
7ddbba2
TW-1544 Implmenent reserving space for an error below FormField
keshan3262 Oct 11, 2024
3239ec4
TW-1544 Resolve merge conflicts
keshan3262 Oct 11, 2024
1b145b7
TW-1544 Remove an unused import
keshan3262 Oct 14, 2024
7e1ef85
Merge branch 'development-2' of https://github.com/madfish-solutions/…
keshan3262 Oct 24, 2024
5ebde31
TW-1544 Prevent disabling main Tezos and EVM networks
keshan3262 Oct 24, 2024
71849a3
TW-1544 Minor refactoring
keshan3262 Oct 25, 2024
3c68cd2
TW-1544 Resolve merge conflicts
keshan3262 Oct 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions e2e/src/page-objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ConfirmationModalPage } from '../page-objects/pages/confirmation-modal.
import { GeneralSettingsPage } from '../page-objects/pages/general-settings.page';
import { HomePage } from '../page-objects/pages/home.page';
import { BackupOptionsModalPage } from '../page-objects/pages/modal/backup-options-modal.page';
import { NetworksPage } from '../page-objects/pages/networks.page';
import { NotificationContentPage } from '../page-objects/pages/notification-content.page';
import { NotificationsListPage } from '../page-objects/pages/notifications-list.page';
import { SwapPage } from '../page-objects/pages/swap.page';
Expand Down Expand Up @@ -40,7 +39,7 @@ export const Pages = {
Swap: new SwapPage(),
AddressBook: new AddressBookPage(),
ConfirmationModal: new ConfirmationModalPage(),
Networks: new NetworksPage(),
// TODO: add tests for networks settings
CollectiblePage: new CollectiblePage(),
CollectiblesTabPage: new CollectiblesTabPage(),
NotificationsList: new NotificationsListPage(),
Expand Down
19 changes: 0 additions & 19 deletions e2e/src/page-objects/pages/networks.page.ts

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"react-dev-utils": "^12",
"react-dom": "18.2.0",
"react-hook-form": "5.3.1",
"react-hook-form-v7": "npm:react-hook-form@7.53.0",
"react-hot-toast": "^2.4.1",
"react-infinite-scroll-component": "^6.1.0",
"react-json-view": "1.21.3",
Expand Down
136 changes: 135 additions & 1 deletion public/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@
}
}
},
"networkEnabled": {
"message": "Network Enabled"
},
"pkhLabel": {
"message": "Account: $pkh$",
"placeholders": {
Expand Down Expand Up @@ -2199,6 +2202,129 @@
"defaultAccount": {
"message": "Default account (the first one)"
},
"defaultNetworksGroup": {
"message": "Default Networks"
},
"customNetworksGroup": {
"message": "Custom Networks"
},
"chainTestnetsGroup": {
"message": "$chain$ Testnets",
"placeholders": {
"chain": {
"content": "$1"
}
}
},
"customTestnetsGroup": {
"message": "Custom Testnets"
},
"active": {
"message": "Active"
},
"rpcEndpoints": {
"message": "RPC Endpoints"
},
"activeRpc": {
"message": "Active RPC"
},
"activeBlockExplorer": {
"message": "Active"
},
"deleteRpc": {
"message": "Delete RPC"
},
"deleteBlockExplorer": {
"message": "Delete"
},
"rpcAdded": {
"message": "RPC added"
},
"blockExplorerAdded": {
"message": "Block explorer added"
},
"invalidChainId": {
"message": "Invalid chain ID"
},
"chainId": {
"message": "Chain ID"
},
"chainIdTooltip": {
"message": "The chain ID is used for signing transactions. It must match the chain ID returned by the network."
},
"blockExplorerUrl": {
"message": "Block explorer URL"
},
"testnet": {
"message": "Testnet"
},
"removeNetwork": {
"message": "Remove Network"
},
"removeNetworkModalTitleLeftPart": {
"message": "Remove "
},
"removeNetworkModalTitleRightPart": {
"message": "?"
},
"removeNetworkModalDescription": {
"message": "You won’t be able to check the assets on this\nnetwork anymore."
},
"editSomeRpcLeftPart": {
"message": "Edit "
},
"editSomeRpcRightPart": {
"message": " RPC"
},
"editSomeBlockExplorerLeftPart": {
"message": "Edit "
},
"editSomeBlockExplorerRightPart": {
"message": ""
},
"rpcDoesNotRespond": {
"message": "RPC doesn’t respond"
},
"rpcDoesNotMatchChain": {
"message": "RPC doesn’t match chain"
},
"wrongAddress": {
"message": "Wrong address"
},
"addSomeRpc": {
"message": "Add $network$ RPC",
"placeholders": {
"network": {
"content": "$1"
}
}
},
"addSomeBlockExplorer": {
"message": "Add $network$ explorer",
"placeholders": {
"network": {
"content": "$1"
}
}
},
"confirmDeleteRpcTitleLeftPart": {
"message": "Delete "
},
"confirmDeleteRpcTitleRightPart": {
"message": " RPC?"
},
"confirmDeleteRpcDescription": {
"message": "This will remove the RPC from the list and automatically switch the network to the default RPC endpoint."
},
"confirmDeleteBlockExplorerTitleLeftPart": {
"message": "Delete "
},
"confirmDeleteBlockExplorerTitleRightPart": {
"message": "?"
},
"confirmDeleteBlockExplorerDescription": {
"message": "This will remove the block explorer from the list and automatically switch the network to the default one."
},
"loadMore": {
"message": "Load more"
},
Expand All @@ -2211,6 +2337,14 @@
"invalidJsonInput": {
"message": "Invalid JSON"
},
"anotherChainIdError": {
"message": "The chain ID used by RPC is $chainId$",
"placeholders": {
"chainId": {
"content": "$1"
}
}
},
"unknownErrorFromRPC": {
"message": "Failed to send request to $url$. Invalid request provided or RPC node is temporarily unreachable.",
"placeholders": {
Expand Down Expand Up @@ -2300,7 +2434,7 @@
"message": "Feel free to join and ask your questions 😊"
},
"blockExplorer": {
"message": "Blockchain explorer"
"message": "Block Explorer"
},
"viewOnBlockExplorer": { "message": "View on block explorer" },
"specifyTokenId": {
Expand Down
6 changes: 6 additions & 0 deletions src/app/PageRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import { usePageRouterAnalytics } from 'lib/analytics';
import { Notifications, NotificationsItem } from 'lib/notifications/components';
import { useTempleClient } from 'lib/temple/front';
import * as Woozie from 'lib/woozie';
import { TempleChainKind } from 'temple/types';

import { ChainSettings } from './pages/ChainSettings';
import { ImportWallet } from './pages/ImportWallet';
import { Market } from './pages/Market';
import { StakingPage } from './pages/Staking';
Expand Down Expand Up @@ -90,6 +92,10 @@ const ROUTE_MAP = Woozie.createMap<RouteContext>([
<CollectiblePage chainKind={chainKind!} chainId={chainId!} assetSlug={assetSlug!} />
))
],
[
'/settings/networks/:chainKind/:chainId',
onlyReady(({ chainId, chainKind }) => <ChainSettings chainKind={chainKind as TempleChainKind} chainId={chainId!} />)
],
['/settings/:tabSlug?', onlyReady(({ tabSlug }) => <Settings tabSlug={tabSlug} />)],
['/market', onlyReady(onlyInFullPage(() => <Market />))],
['/buy/crypto/exolix', onlyReady(onlyInFullPage(() => <Exolix />))],
Expand Down
2 changes: 1 addition & 1 deletion src/app/atoms/FilterButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ReactComponent as FilterOffIcon } from 'app/icons/base/filteroff.svg';
import { ReactComponent as FilterOnIcon } from 'app/icons/base/filteron.svg';
import { useAssetsFilterOptionsSelector } from 'app/store/assets-filter-options/selectors';
import { AssetsFilterOptionsInitialState } from 'app/store/assets-filter-options/state';
import { ACTIVE_STYLED_BUTTON_COLORS_CLASSNAME } from 'lib/ui/button-like-styles';
import { ACTIVE_STYLED_BUTTON_COLORS_CLASSNAME } from 'lib/ui/use-styled-button-or-link-props';

import { Button } from './Button';
import { IconBase } from './IconBase';
Expand Down
9 changes: 8 additions & 1 deletion src/app/atoms/FormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface FormFieldProps extends TestIDProperty, Omit<FormFieldAttrs, 'ty
labelWarning?: ReactNode;
errorCaption?: ReactNode;
shouldShowErrorCaption?: boolean;
reserveSpaceForError?: boolean;
warning?: boolean;
containerClassName?: string;
labelContainerClassName?: string;
Expand Down Expand Up @@ -90,6 +91,7 @@ export const FormField = forwardRef<FormFieldElement, FormFieldProps>(
labelWarning,
errorCaption,
shouldShowErrorCaption = true,
reserveSpaceForError = true,
warning = false,
containerClassName,
labelContainerClassName,
Expand Down Expand Up @@ -257,7 +259,12 @@ export const FormField = forwardRef<FormFieldElement, FormFieldProps>(
{secretCovered && <SecretCover onClick={handleSecretBannerClick} />}
</div>

{shouldShowErrorCaption && <ErrorCaption errorCaption={errorCaption} />}
{shouldShowErrorCaption &&
(reserveSpaceForError && !errorCaption ? (
<div className="size-4" />
) : (
<ErrorCaption errorCaption={errorCaption} />
))}
</div>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/atoms/IconBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import clsx from 'clsx';

export type Size = 12 | 16 | 24 | 32;

interface Props {
export interface IconBaseProps {
/** SVG of the 16px icon base container */
Icon: ImportedSVGComponent;
size?: Size;
Expand All @@ -13,7 +13,7 @@ interface Props {
}

/** For monochrome icons */
export const IconBase = memo<Props>(({ size = 16, className, Icon, onClick }) => (
export const IconBase = memo<IconBaseProps>(({ size = 16, className, Icon, onClick }) => (
<div data-icon-size={size} className={clsx(CONTAINER_CLASSNAME[size], className)} onClick={onClick}>
<Icon className="w-full h-full stroke-current fill-current" transform={SCALE_TRANSFORMS[size]} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/atoms/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
StyledButtonColor,
ACTIVE_STYLED_BUTTON_COLORS_CLASSNAME,
getStyledButtonColorsClassNames
} from 'lib/ui/button-like-styles';
} from 'lib/ui/use-styled-button-or-link-props';
import useTippy from 'lib/ui/useTippy';
import { combineRefs } from 'lib/ui/utils';

Expand Down
19 changes: 9 additions & 10 deletions src/app/atoms/PageModal/actions-buttons-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,45 @@ import clsx from 'clsx';
import { throttle } from 'lodash';
import { useDispatch } from 'react-redux';

import { useAppEnv } from 'app/env';
import { setToastsContainerBottomShiftAction } from 'app/store/settings/actions';

interface ActionsButtonsBoxProps extends HTMLAttributes<HTMLDivElement> {
shouldCastShadow?: boolean;
flexDirection?: 'row' | 'col';
shouldChangeBottomShift?: boolean;
}

export const ActionsButtonsBox = memo<ActionsButtonsBoxProps>(
({ className, shouldCastShadow, flexDirection = 'col', ...restProps }) => {
({ className, shouldCastShadow, flexDirection = 'col', shouldChangeBottomShift = true, ...restProps }) => {
const dispatch = useDispatch();
const { popup } = useAppEnv();

useEffect(() => {
return () => void dispatch(setToastsContainerBottomShiftAction(0));
}, []);
return () => void (shouldChangeBottomShift && dispatch(setToastsContainerBottomShiftAction(0)));
}, [dispatch, shouldChangeBottomShift]);

const handleResize = useMemo(
() =>
throttle<ResizeObserverCallback>(entries => {
const borderBoxSize = entries.map(entry => entry.borderBoxSize?.[0]).filter(Boolean)[0];

if (borderBoxSize) {
dispatch(setToastsContainerBottomShiftAction(borderBoxSize.blockSize - (popup ? 16 : 0)));
if (borderBoxSize && shouldChangeBottomShift) {
dispatch(setToastsContainerBottomShiftAction(borderBoxSize.blockSize - 24));
}
}, 100),
[dispatch, popup]
[dispatch, shouldChangeBottomShift]
);

const resizeObserver = useMemo(() => new ResizeObserver(handleResize), [handleResize]);
const rootRef = useCallback(
(node: HTMLDivElement | null) => {
resizeObserver.disconnect();
if (node) {
if (node && shouldChangeBottomShift) {
resizeObserver.observe(node);
const { height } = node.getBoundingClientRect();
dispatch(setToastsContainerBottomShiftAction(height));
}
},
[dispatch, resizeObserver]
[dispatch, resizeObserver, shouldChangeBottomShift]
);

return (
Expand Down
Loading
Loading