|
17 | 17 | const notify$ = state
|
18 | 18 | .select('notify')
|
19 | 19 | .pipe(startWith(state.get().notify), shareReplay(1))
|
| 20 | +
|
| 21 | + const notifications$ = $notify$.enabled |
| 22 | + ? state.select('notifications').pipe(startWith(state.get().notifications)) |
| 23 | + : null |
| 24 | +
|
20 | 25 | const positioningDefaults = {
|
21 | 26 | topLeft: 'top: 0; left: 0;',
|
22 | 27 | topRight: 'top: 0; right: 0;',
|
23 | 28 | bottomRight: 'bottom: 0; right: 0;',
|
24 | 29 | bottomLeft: 'bottom: 0; left: 0;'
|
25 | 30 | }
|
| 31 | +
|
| 32 | + $: sharedContainer = |
| 33 | + $accountCenter$.enabled && |
| 34 | + $notify$.enabled && |
| 35 | + $notify$.position === $accountCenter$.position |
| 36 | +
|
| 37 | + $: samePositionMobile = |
| 38 | + device.type === 'mobile' || $accountCenter$.position === $notify$.position |
| 39 | +
|
| 40 | + $: sharedMobileContainerCheck = |
| 41 | + device.type === 'mobile' && |
| 42 | + (($notify$.position.includes('bottom') && |
| 43 | + $accountCenter$.position.includes('bottom')) || |
| 44 | + ($notify$.position.includes('top') && |
| 45 | + $accountCenter$.position.includes('top'))) |
| 46 | +
|
| 47 | + $: separateMobileContainerCheck = |
| 48 | + device.type === 'mobile' && |
| 49 | + (($notify$.position.includes('top') && |
| 50 | + $accountCenter$.position.includes('bottom')) || |
| 51 | + ($notify$.position.includes('bottom') && |
| 52 | + $accountCenter$.position.includes('top'))) |
| 53 | +
|
| 54 | + $: displayNotifySeparate = |
| 55 | + $notify$.enabled && |
| 56 | + (!$accountCenter$.enabled || |
| 57 | + ($notify$.position !== $accountCenter$.position && |
| 58 | + device.type !== 'mobile') || |
| 59 | + separateMobileContainerCheck) && |
| 60 | + $wallets$.length |
| 61 | +
|
| 62 | + $: displayAccountCenterSeparate = |
| 63 | + $accountCenter$.enabled && |
| 64 | + (!$notify$.enabled || |
| 65 | + ($notify$.position !== $accountCenter$.position && |
| 66 | + device.type !== 'mobile') || |
| 67 | + separateMobileContainerCheck) && |
| 68 | + $wallets$.length |
| 69 | +
|
| 70 | + $: displayAccountCenterNotifySameContainer = |
| 71 | + $notify$.enabled && |
| 72 | + $accountCenter$.enabled && |
| 73 | + $wallets$.length && |
| 74 | + (sharedContainer || sharedMobileContainerCheck) |
26 | 75 | </script>
|
27 | 76 |
|
28 | 77 | <style>
|
|
280 | 329 | <SwitchChain />
|
281 | 330 | {/if}
|
282 | 331 |
|
283 |
| -{#if $notify$.enabled && $accountCenter$.enabled && $wallets$.length} |
| 332 | +{#if displayAccountCenterNotifySameContainer} |
284 | 333 | <div
|
285 | 334 | class="container flex flex-column fixed z-indexed"
|
286 | 335 | style="{positioningDefaults[$accountCenter$.position]}; {device.type ===
|
|
290 | 339 | ? 'padding-top:0;'
|
291 | 340 | : ''} "
|
292 | 341 | >
|
293 |
| - {#if $notify$.position.includes('bottom') && $accountCenter$.position.includes('bottom') && (device.type === 'mobile' || $accountCenter$.position === $notify$.position)} |
294 |
| - <Notify position={$notify$.position} sharedContainer={true} /> |
| 342 | + {#if $notify$.position.includes('bottom') && $accountCenter$.position.includes('bottom') && samePositionMobile} |
| 343 | + <Notify |
| 344 | + notifications={$notifications$} |
| 345 | + position={$notify$.position} |
| 346 | + {sharedContainer} |
| 347 | + /> |
295 | 348 | {/if}
|
296 | 349 | <div
|
297 | 350 | style={!$accountCenter$.expanded &&
|
|
306 | 359 | >
|
307 | 360 | <AccountCenter settings={$accountCenter$} />
|
308 | 361 | </div>
|
309 |
| - {#if $notify$.position.includes('top') && $accountCenter$.position.includes('top') && (device.type === 'mobile' || $accountCenter$.position === $notify$.position)} |
310 |
| - <Notify position={$notify$.position} sharedContainer={true} /> |
| 362 | + {#if $notify$.position.includes('top') && $accountCenter$.position.includes('top') && samePositionMobile} |
| 363 | + <Notify |
| 364 | + notifications={$notifications$} |
| 365 | + position={$notify$.position} |
| 366 | + {sharedContainer} |
| 367 | + /> |
311 | 368 | {/if}
|
312 | 369 | </div>
|
313 | 370 | {/if}
|
314 |
| -{#if $accountCenter$.enabled && (!$notify$.enabled || ($notify$.position !== $accountCenter$.position && device.type !== 'mobile')) && $wallets$.length} |
| 371 | +{#if displayAccountCenterSeparate} |
315 | 372 | <div
|
316 | 373 | class="container flex flex-column fixed z-indexed"
|
317 | 374 | style="{positioningDefaults[$accountCenter$.position]}; {device.type ===
|
|
338 | 395 | </div>
|
339 | 396 | </div>
|
340 | 397 | {/if}
|
341 |
| -{#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} |
| 398 | +{#if displayNotifySeparate} |
342 | 399 | <div
|
343 | 400 | class="container flex flex-column fixed z-indexed"
|
344 | 401 | style="{positioningDefaults[$notify$.position]}; {device.type ===
|
|
348 | 405 | ? 'padding-top:0;'
|
349 | 406 | : ''} "
|
350 | 407 | >
|
351 |
| - <Notify position={$notify$.position} sharedContainer={false} /> |
| 408 | + <Notify |
| 409 | + notifications={$notifications$} |
| 410 | + position={$notify$.position} |
| 411 | + {sharedContainer} |
| 412 | + /> |
352 | 413 | </div>
|
353 | 414 | {/if}
|
0 commit comments