Skip to content

Commit

Permalink
chore: fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
olgakup committed Jan 3, 2025
1 parent a38ed36 commit b650e64
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
6 changes: 5 additions & 1 deletion packages/extension/src/libs/networks-state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ class NetworksState {
});
}

/**
* Pins or unpins a network on the UI.
* @param targetNetworkName - the name of the network to set the status of
* @param isActive - represents whether or not the network is pinned on the ui
*/
async setNetworkStatus(
targetNetworkName: string,
// isActive represents whether or not the network is pinned on the ui
isActive: boolean,
): Promise<void> {
const state: IState = await this.getState();
Expand Down
14 changes: 11 additions & 3 deletions packages/extension/src/ui/action/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -537,12 +537,20 @@ onClickOutside(
{ ignore: [toggle] },
);
const setIsPinnedNetwork = async (network: string, isPinned: boolean) => {
await networksState.setNetworkStatus(network, isPinned);
await setActiveNetworks();
try {
await networksState.setNetworkStatus(network, isPinned);
await setActiveNetworks();
} catch (error) {
console.error('Failed to set pined network:', error);
}
};
const setIsToggledTestNetwork = async () => {
await setActiveNetworks();
try {
await setActiveNetworks();
} catch (error) {
console.error('Failed to set is toggled test network:', error);
}
};
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ import { NodeType } from '@/types/provider';
import { CustomEvmNetwork } from '@/providers/ethereum/types/custom-evm-network';
import PinIcon from '@action/icons/actions/pin.vue';
import customNetworkIcon from '@/ui/action/icons/common/custom-network-icon.vue';
import { NetworkNames } from '@enkryptcom/types';
const isHovered = ref(false);
const emit = defineEmits<{
(e: 'networkToggled', name: string, isActive: boolean): void;
(e: 'networkDeleted', chainId: string): void;
(e: 'update:pinNetwork', network: string, isPinned: boolean): void;
(e: 'testNetworkToggled', name: string, isActive: boolean): void;
(e: 'testNetworkToggled', name: NetworkNames, isActive: boolean): void;
}>();
const props = defineProps({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@import '@action/styles/theme.less';
.network-assets {
&__header {
padding: 10px 12px 2px 12px;
padding: 10px 16px 2px 16px;
position: relative;
display: flex;
justify-content: space-between;
Expand All @@ -34,7 +34,7 @@
margin: 0;
}
&__token {
width: 200px;
width: 196px;
p {
padding-left: 48px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const toggleDetail = () => {
.network-assets {
&__token {
height: 72px;
padding: 0 6px;
padding: 0 4px;
position: relative;
box-sizing: border-box;
display: flex;
Expand All @@ -202,7 +202,7 @@ const toggleDetail = () => {
border-radius: 10px;
transition: background 300ms ease-in-out;
text-decoration: none;
margin: 0 6px;
margin: 0 12px;
cursor: pointer;
&:hover {
Expand All @@ -214,7 +214,7 @@ const toggleDetail = () => {
justify-content: flex-start;
align-items: center;
flex-direction: row;
width: 200px;
width: 196px;
overflow: hidden;
&.max {
Expand Down

0 comments on commit b650e64

Please sign in to comment.