Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fd7e367
Update react package version
Adamj1232 Jun 20, 2022
5fefd3b
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 20, 2022
00e8ef5
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 21, 2022
fa2cc09
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 21, 2022
74a1a25
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 21, 2022
e2c3968
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 22, 2022
1a60785
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 22, 2022
2fcd526
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 23, 2022
3a91656
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 24, 2022
70e36f3
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 27, 2022
8ec94e0
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 28, 2022
49b90da
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 28, 2022
b84befc
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 29, 2022
883fc52
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:bloc…
Adamj1232 Jun 29, 2022
26f8cbf
Not working
Adamj1232 Jun 29, 2022
84b5e66
push for taylor to review
Adamj1232 Jun 29, 2022
08d5309
Moved notification stream up a level, positioning working as expected
Adamj1232 Jun 29, 2022
d98bb50
working but needs cleanup
Adamj1232 Jun 29, 2022
aa5c4bf
Handle placement and abstract logic into variables
Adamj1232 Jun 29, 2022
1751c65
Bump versions
Adamj1232 Jun 29, 2022
4dac77f
Remove unnecessary opperators
Adamj1232 Jun 29, 2022
c91cf3b
Refine naming
Adamj1232 Jun 29, 2022
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
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
77 changes: 69 additions & 8 deletions packages/core/src/views/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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)
</script>

<style>
Expand Down Expand Up @@ -280,7 +329,7 @@
<SwitchChain />
{/if}

{#if $notify$.enabled && $accountCenter$.enabled && $wallets$.length}
{#if displayAccountCenterNotifySameContainer}
<div
class="container flex flex-column fixed z-indexed"
style="{positioningDefaults[$accountCenter$.position]}; {device.type ===
Expand All @@ -290,8 +339,12 @@
? 'padding-top:0;'
: ''} "
>
{#if $notify$.position.includes('bottom') && $accountCenter$.position.includes('bottom') && (device.type === 'mobile' || $accountCenter$.position === $notify$.position)}
<Notify position={$notify$.position} sharedContainer={true} />
{#if $notify$.position.includes('bottom') && $accountCenter$.position.includes('bottom') && samePositionMobile}
<Notify
notifications={$notifications$}
position={$notify$.position}
{sharedContainer}
/>
{/if}
<div
style={!$accountCenter$.expanded &&
Expand All @@ -306,12 +359,16 @@
>
<AccountCenter settings={$accountCenter$} />
</div>
{#if $notify$.position.includes('top') && $accountCenter$.position.includes('top') && (device.type === 'mobile' || $accountCenter$.position === $notify$.position)}
<Notify position={$notify$.position} sharedContainer={true} />
{#if $notify$.position.includes('top') && $accountCenter$.position.includes('top') && samePositionMobile}
<Notify
notifications={$notifications$}
position={$notify$.position}
{sharedContainer}
/>
{/if}
</div>
{/if}
{#if $accountCenter$.enabled && (!$notify$.enabled || ($notify$.position !== $accountCenter$.position && device.type !== 'mobile')) && $wallets$.length}
{#if displayAccountCenterSeparate}
<div
class="container flex flex-column fixed z-indexed"
style="{positioningDefaults[$accountCenter$.position]}; {device.type ===
Expand All @@ -338,7 +395,7 @@
</div>
</div>
{/if}
{#if $notify$.enabled && (!$accountCenter$.enabled || ($notify$.position !== $accountCenter$.position && device.type !== 'mobile') || ($notify$.position.includes('top') && $accountCenter$.position.includes('bottom')) || ($notify$.position.includes('bottom') && $accountCenter$.position.includes('top'))) && $wallets$.length}
{#if displayNotifySeparate}
<div
class="container flex flex-column fixed z-indexed"
style="{positioningDefaults[$notify$.position]}; {device.type ===
Expand All @@ -348,6 +405,10 @@
? 'padding-top:0;'
: ''} "
>
<Notify position={$notify$.position} sharedContainer={false} />
<Notify
notifications={$notifications$}
position={$notify$.position}
{sharedContainer}
/>
</div>
{/if}
8 changes: 4 additions & 4 deletions packages/core/src/views/notify/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { shareReplay, startWith } from 'rxjs/operators'
import Notification from './Notification.svelte'
import { configuration } from '../../configuration'
import type { Notification as NotificationType } from '../../types'

const { device } = configuration

Expand All @@ -16,6 +17,7 @@

export let position: string
export let sharedContainer: boolean
export let notifications: NotificationType[]

let x: number
let y: number
Expand All @@ -36,8 +38,6 @@
x = 0
y = 0

const notifications$ = state.select('notifications').pipe(startWith([]))

let overflowY = 'y-scroll'
const updateScrollYOnRemove = (): void => {
if (overflowY !== 'y-visible') {
Expand Down Expand Up @@ -114,7 +114,7 @@
}
</style>

{#if $notifications$.length}
{#if notifications.length}
<ul
class="bn-notify-{position} {overflowY}"
style={`${
Expand All @@ -129,7 +129,7 @@
: '24px'
})`}
>
{#each $notifications$ as notification (notification.key)}
{#each notifications as notification (notification.key)}
<li
animate:flip={{ duration: 500 }}
on:click|stopPropagation
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/react",
"version": "2.2.2-alpha.1",
"version": "2.2.2-alpha.2",
"description": "Collection of React Hooks for web3-onboard",
"repository": "blocknative/web3-onboard",
"module": "dist/index.js",
Expand All @@ -24,7 +24,7 @@
"typescript": "^4.5.5"
},
"dependencies": {
"@web3-onboard/core": "^2.3.2-alpha.2",
"@web3-onboard/core": "^2.3.2-alpha.3",
"@web3-onboard/common": "^2.1.4-alpha.1",
"use-sync-external-store": "1.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/vue",
"version": "2.1.2-alpha.1",
"version": "2.1.2-alpha.2",
"description": "Vue Composable for web3-onboard",
"repository": "blocknative/web3-onboard",
"module": "dist/index.js",
Expand All @@ -25,7 +25,7 @@
"@vueuse/core": "^8.4.2",
"@vueuse/rxjs": "^8.2.0",
"@web3-onboard/common": "^2.1.4-alpha.1",
"@web3-onboard/core": "^2.3.2-alpha.2",
"@web3-onboard/core": "^2.3.2-alpha.3",
"vue-demi": "^0.12.4"
},
"peerDependencies": {
Expand Down