Skip to content

Commit

Permalink
feat: updatated EvmNativeToken.vue
Browse files Browse the repository at this point in the history
  • Loading branch information
impelcrypto committed Dec 27, 2024
1 parent 5107c50 commit 15f7b27
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ astar-collator

# Chopstick binaries
db.sqlite*
.vercel
49 changes: 40 additions & 9 deletions src/components/assets/EvmNativeToken.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@

<div class="box--ccip">
<custom-router-link
v-if="isShibuyaEvm"
v-if="isShibuyaEvm || isAstarEvm"
:to="buildCcipBridgePageLink()"
:is-disabled="!ccipMinatoBridgeEnabled"
:is-disabled="!isEnableCcipBridge"
>
<button class="btn btn--icon">
<img
Expand Down Expand Up @@ -163,7 +163,12 @@ import {
} from 'src/router/routes';
import { useStore } from 'src/store';
import { computed, defineComponent, ref, watch, watchEffect } from 'vue';
import { nativeBridgeEnabled, layerZeroBridgeEnabled, ccipMinatoBridgeEnabled } from 'src/features';
import {
nativeBridgeEnabled,
layerZeroBridgeEnabled,
ccipMinatoBridgeEnabled,
ccipSoneiumBridgeEnabled,
} from 'src/features';
import CustomRouterLink from '../common/CustomRouterLink.vue';
import Balloon from 'src/components/common/Balloon.vue';
import { LOCAL_STORAGE } from 'src/config/localStorage';
Expand All @@ -188,8 +193,15 @@ export default defineComponent({
const isCcipBalloon = ref<boolean>(false);
const isBalloonClosing = ref<boolean>(false);
const { currentNetworkName, nativeTokenSymbol, isZkEvm, isZkyoto, isAstar, isShibuyaEvm } =
useNetworkInfo();
const {
currentNetworkName,
nativeTokenSymbol,
isZkEvm,
isZkyoto,
isAstar,
isShibuyaEvm,
isAstarEvm,
} = useNetworkInfo();
const closeCcipBalloon = () => {
isCcipBalloon.value = false;
Expand Down Expand Up @@ -239,16 +251,34 @@ export default defineComponent({
const isTruncate = !nativeTokenSymbol.value.toUpperCase().includes('BTC');
const isEnableCcipBridge = computed<boolean>(() => {
return (
(isShibuyaEvm.value && ccipMinatoBridgeEnabled) ||
(isAstarEvm.value && ccipSoneiumBridgeEnabled)
);
});
// Memo: display the balloon animation
watch(
[isShibuyaEvm],
[isShibuyaEvm, isAstarEvm],
async () => {
const isBallonDisplayed = Boolean(localStorage.getItem(LOCAL_STORAGE.BALLOON_CCIP_SHIBUYA));
if (isShibuyaEvm.value && !isBallonDisplayed) {
const isBallonShibuyaDisplayed = Boolean(
localStorage.getItem(LOCAL_STORAGE.BALLOON_CCIP_SHIBUYA)
);
const isBallonAstarDisplayed = Boolean(
localStorage.getItem(LOCAL_STORAGE.BALLOON_CCIP_ASTAR)
);
if (isShibuyaEvm.value && !isBallonShibuyaDisplayed) {
await wait(1000);
isCcipBalloon.value = true;
localStorage.setItem(LOCAL_STORAGE.BALLOON_CCIP_SHIBUYA, 'true');
}
if (isAstarEvm.value && !isBallonAstarDisplayed) {
await wait(1000);
isCcipBalloon.value = true;
localStorage.setItem(LOCAL_STORAGE.BALLOON_CCIP_ASTAR, 'true');
}
},
{ immediate: true }
);
Expand All @@ -272,9 +302,10 @@ export default defineComponent({
nativeBridgeEnabled,
layerZeroBridgeEnabled,
isShibuyaEvm,
ccipMinatoBridgeEnabled,
isEnableCcipBridge,
isCcipBalloon,
isBalloonClosing,
isAstarEvm,
closeCcipBalloon,
buildCcipBridgePageLink,
truncate,
Expand Down
1 change: 1 addition & 0 deletions src/config/localStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export enum LOCAL_STORAGE {
XVM_TX_HISTORIES = 'xvmTxHistories',
BALLOON_NATIVE_TOKEN = 'balloonNativeToken',
BALLOON_CCIP_SHIBUYA = 'balloonCcipShibuya',
BALLOON_CCIP_ASTAR = 'balloonCcipAstar',
THEME_COLOR = 'themeColor',
MULTISIG = 'multisig',
CLOSE_DAPP_STAKING_V3_ONBOARDING = 'closeDappStakingV3Onboarding',
Expand Down

0 comments on commit 15f7b27

Please sign in to comment.