diff --git a/packages/core/package.json b/packages/core/package.json index bf773ec72..3f9c2bdb7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.3.2-alpha.2", + "version": "2.3.2-alpha.3", "repository": "blocknative/web3-onboard", "scripts": { "build": "rollup -c", diff --git a/packages/core/src/views/Index.svelte b/packages/core/src/views/Index.svelte index adcb618dc..dcdca9865 100644 --- a/packages/core/src/views/Index.svelte +++ b/packages/core/src/views/Index.svelte @@ -17,12 +17,61 @@ const notify$ = state .select('notify') .pipe(startWith(state.get().notify), shareReplay(1)) + + const notifications$ = $notify$.enabled + ? state.select('notifications').pipe(startWith(state.get().notifications)) + : null + const positioningDefaults = { topLeft: 'top: 0; left: 0;', topRight: 'top: 0; right: 0;', bottomRight: 'bottom: 0; right: 0;', bottomLeft: 'bottom: 0; left: 0;' } + + $: sharedContainer = + $accountCenter$.enabled && + $notify$.enabled && + $notify$.position === $accountCenter$.position + + $: samePositionMobile = + device.type === 'mobile' || $accountCenter$.position === $notify$.position + + $: sharedMobileContainerCheck = + device.type === 'mobile' && + (($notify$.position.includes('bottom') && + $accountCenter$.position.includes('bottom')) || + ($notify$.position.includes('top') && + $accountCenter$.position.includes('top'))) + + $: separateMobileContainerCheck = + device.type === 'mobile' && + (($notify$.position.includes('top') && + $accountCenter$.position.includes('bottom')) || + ($notify$.position.includes('bottom') && + $accountCenter$.position.includes('top'))) + + $: displayNotifySeparate = + $notify$.enabled && + (!$accountCenter$.enabled || + ($notify$.position !== $accountCenter$.position && + device.type !== 'mobile') || + separateMobileContainerCheck) && + $wallets$.length + + $: displayAccountCenterSeparate = + $accountCenter$.enabled && + (!$notify$.enabled || + ($notify$.position !== $accountCenter$.position && + device.type !== 'mobile') || + separateMobileContainerCheck) && + $wallets$.length + + $: displayAccountCenterNotifySameContainer = + $notify$.enabled && + $accountCenter$.enabled && + $wallets$.length && + (sharedContainer || sharedMobileContainerCheck) -{#if $notifications$.length} +{#if notifications.length}