Skip to content

Commit

Permalink
Merge pull request #10788 from hassnian/issue-10761
Browse files Browse the repository at this point in the history
fix: Switch wallet modal dark mode
  • Loading branch information
vikiival authored Aug 13, 2024
2 parents 3d09bc5 + 1cc7e64 commit 2ee26c1
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 22 deletions.
44 changes: 23 additions & 21 deletions components/common/ConnectWallet/ReconnectWalletModal.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<ModalBody
class="border border-border-color"
:title="$t('reconnect.required')"
:scrollable="false"
@close="emit('close')"
Expand All @@ -9,21 +8,21 @@
<div class="flex gap-5 items-center justify-center !py-5 ">
<div>
<BasicImage
:src="vmDetails.current.icon"
:alt="vmDetails.current.name"
:src="vmSwitchDetails.current.icon"
:alt="vmSwitchDetails.current.name"
class="image is-48x48"
/>
</div>

<img
:src="'/right-arrow.svg'"
:src="isDarkMode ? '/right-arrow_dark.svg' :'/right-arrow.svg'"
alt="right arrow"
>

<div>
<BasicImage
:src="vmDetails.target.icon"
:alt="vmDetails.target.name"
:src="vmSwitchDetails.target.icon"
:alt="vmSwitchDetails.target.name"
class="image is-48x48"
/>
</div>
Expand All @@ -34,7 +33,7 @@
{{ $t("reconnect.title") }}
</p>
<p
v-dompurify-html="$t('reconnect.toProceed', [vmDetails.target.name, vmDetails.target.shortName ? `(${vmDetails.target.shortName})` : undefined])"
v-dompurify-html="$t('reconnect.toProceed', [vmSwitchDetails.target.name, vmSwitchDetails.target.shortName ? `(${vmSwitchDetails.target.shortName})` : undefined])"
class="max-w-60 text-center"
/>
</div>
Expand Down Expand Up @@ -64,31 +63,34 @@ const VM_SWITCH_MAP: Record<ChainVM, ChainVM> = {
SUB: 'EVM',
}
const VM_DETAILS: Record<ChainVM, { icon: string, name: string, shortName?: string }> = {
const emit = defineEmits(['close', 'connect'])
const { logout } = useWallet()
const { getWalletVM } = storeToRefs(useWalletStore())
const { doAfterLogin } = useDoAfterlogin()
const { isDarkMode } = useTheme()
const loading = ref(false)
const vmDetails = computed<Record<ChainVM, { icon: string, name: string, shortName?: string }>>(() => ({
SUB: {
name: 'Polkadot',
icon: '/token/dot_branded.svg',
icon: isDarkMode.value ? '/token/dot_branded_dark.svg' : '/token/dot_branded.svg',
},
EVM: {
name: 'Ethereum',
shortName: 'EVM',
icon: '/token/base_branded.svg',
},
}
icon: isDarkMode.value ? '/token/base_branded_dark.svg' : '/token/base_branded.svg',
const emit = defineEmits(['close', 'connect'])
},
}))
const { logout } = useWallet()
const { getWalletVM } = storeToRefs(useWalletStore())
const { doAfterLogin } = useDoAfterlogin()
const currentWalletVM = computed(() => getWalletVM.value || 'SUB')
const loading = ref(false)
const targetVm = computed(() => VM_SWITCH_MAP[currentWalletVM.value]) // make prop
const vmDetails = computed(() => ({
current: VM_DETAILS[currentWalletVM.value],
target: VM_DETAILS[targetVm.value],
const vmSwitchDetails = computed(() => ({
current: vmDetails.value[currentWalletVM.value],
target: vmDetails.value[targetVm.value],
}))
const switchWallet = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const openReconnectWalletModal = ({ onCancel, onSuccess, closeOnSuccess =
...{
component: ReconnectWalletModal,
canCancel: ['escape', 'outside'],
rootClass: 'connect-wallet-modal !z-[998]',
rootClass: 'connect-wallet-modal neo-modal !z-[998]',
trapFocus: false,
},
})
Expand Down
6 changes: 6 additions & 0 deletions public/right-arrow_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions public/token/base_branded_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions public/token/dot_branded_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2ee26c1

Please sign in to comment.