|
5 | 5 | import Connect from './connect/Index.svelte'
|
6 | 6 | import SwitchChain from './chain/SwitchChain.svelte'
|
7 | 7 | import ActionRequired from './connect/ActionRequired.svelte'
|
8 |
| - import AccountCenter from './account-center/Index.svelte' |
9 |
| - import Notify from './notify/Index.svelte' |
10 | 8 | import { configuration } from '../configuration'
|
11 | 9 | import type { Observable } from 'rxjs'
|
12 | 10 | import type { Notification } from '../types'
|
|
43 | 41 | }
|
44 | 42 | }
|
45 | 43 |
|
| 44 | + const accountCenterComponent = $accountCenter$.enabled |
| 45 | + ? import('./account-center/Index.svelte').then(mod => mod.default) |
| 46 | + : Promise.resolve(null) |
| 47 | +
|
| 48 | + const notifyComponent = $notify$.enabled |
| 49 | + ? import('./notify/Index.svelte').then(mod => mod.default) |
| 50 | + : Promise.resolve(null) |
| 51 | +
|
46 | 52 | $: sharedContainer =
|
47 | 53 | $accountCenter$.enabled &&
|
48 | 54 | $notify$.enabled &&
|
|
359 | 365 | : ''} "
|
360 | 366 | >
|
361 | 367 | {#if $notify$.position.includes('bottom') && $accountCenter$.position.includes('bottom') && samePositionOrMobile}
|
362 |
| - <Notify |
363 |
| - notifications={$notifications$} |
364 |
| - position={$notify$.position} |
365 |
| - {sharedContainer} |
366 |
| - /> |
| 368 | + {#await notifyComponent then Notify} |
| 369 | + {#if Notify} |
| 370 | + <svelte:component |
| 371 | + this={Notify} |
| 372 | + notifications={$notifications$} |
| 373 | + position={$notify$.position} |
| 374 | + {sharedContainer} |
| 375 | + /> |
| 376 | + {/if} |
| 377 | + {/await} |
367 | 378 | {/if}
|
368 | 379 | <div
|
369 | 380 | style={!$accountCenter$.expanded &&
|
|
376 | 387 | ? 'margin-right: auto'
|
377 | 388 | : ''}
|
378 | 389 | >
|
379 |
| - <AccountCenter settings={$accountCenter$} /> |
| 390 | + {#await accountCenterComponent then AccountCenter} |
| 391 | + {#if AccountCenter} |
| 392 | + <svelte:component this={AccountCenter} settings={$accountCenter$} /> |
| 393 | + {/if} |
| 394 | + {/await} |
380 | 395 | </div>
|
381 | 396 | {#if $notify$.position.includes('top') && $accountCenter$.position.includes('top') && samePositionOrMobile}
|
382 |
| - <Notify |
383 |
| - notifications={$notifications$} |
384 |
| - position={$notify$.position} |
385 |
| - {sharedContainer} |
386 |
| - /> |
| 397 | + {#await notifyComponent then Notify} |
| 398 | + {#if Notify} |
| 399 | + <svelte:component |
| 400 | + this={Notify} |
| 401 | + notifications={$notifications$} |
| 402 | + position={$notify$.position} |
| 403 | + {sharedContainer} |
| 404 | + /> |
| 405 | + {/if} |
| 406 | + {/await} |
387 | 407 | {/if}
|
388 | 408 | </div>
|
389 | 409 | {/if}
|
|
410 | 430 | : ''}
|
411 | 431 | >
|
412 | 432 | {#if $accountCenter$.enabled && $wallets$.length}
|
413 |
| - <AccountCenter settings={$accountCenter$} /> |
| 433 | + {#await accountCenterComponent then AccountCenter} |
| 434 | + {#if AccountCenter} |
| 435 | + <svelte:component this={AccountCenter} settings={$accountCenter$} /> |
| 436 | + {/if} |
| 437 | + {/await} |
414 | 438 | {/if}
|
415 | 439 | </div>
|
416 | 440 | </div>
|
|
426 | 450 | ? 'padding-top:0;'
|
427 | 451 | : ''} "
|
428 | 452 | >
|
429 |
| - <Notify |
430 |
| - notifications={$notifications$} |
431 |
| - position={$notify$.position} |
432 |
| - {sharedContainer} |
433 |
| - /> |
| 453 | + {#await notifyComponent then Notify} |
| 454 | + {#if Notify} |
| 455 | + <svelte:component |
| 456 | + this={Notify} |
| 457 | + notifications={$notifications$} |
| 458 | + position={$notify$.position} |
| 459 | + {sharedContainer} |
| 460 | + /> |
| 461 | + {/if} |
| 462 | + {/await} |
434 | 463 | </div>
|
435 | 464 | {/if}
|
0 commit comments