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

fix: Switch wallet modal dark mode #10788

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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.
Loading