|
1 | 1 | <script lang="ts"> |
2 | 2 | import { onMount, onDestroy } from 'svelte'; |
3 | | - import { ShieldUserIcon } from '@lucide/svelte'; |
4 | 3 | import { Tooltip, Dialog, Portal } from '@skeletonlabs/skeleton-svelte'; |
5 | 4 | import { createLogger } from '$lib/utils/logger'; |
6 | 5 |
|
|
256 | 255 | } |
257 | 256 | }); |
258 | 257 |
|
259 | | - let authPipOpenState = $state(false); |
260 | | -
|
261 | | - // async function formatAuthStatusPip(session: SessionSnapshot, consentInfo?: OBPConsentInfo): { |
262 | | - // const |
263 | | - // } |
264 | 258 |
|
265 | 259 | async function sendMessage(text: string) { |
266 | 260 | if (!text.trim()) return; |
|
539 | 533 |
|
540 | 534 | {#snippet statusPips(session: SessionSnapshot, consentInfo?: OBPConsentInfo)} |
541 | 535 | {#if options.displayConnectionPips} |
542 | | - <div class="flex flex-col items-center"> |
| 536 | + <div class="flex flex-row items-center gap-1.5"> |
543 | 537 | <!-- Connection Pip with Tooltip --> |
544 | | - <Tooltip positioning={{ placement: 'top' }}> |
| 538 | + <Tooltip> |
545 | 539 | <Tooltip.Trigger> |
546 | | - <div class="badge-icon {connectionPipColor} h-3 w-3"> |
547 | | - <ShieldUserIcon size={12} /> |
548 | | - </div> |
| 540 | + <div class="h-2 w-2 rounded-full {connectionPipColor} cursor-pointer transition-all hover:scale-125"></div> |
549 | 541 | </Tooltip.Trigger> |
550 | | - <Tooltip.Content>Opey Connection Status: {connectionStatusString}</Tooltip.Content> |
| 542 | + <Portal> |
| 543 | + <Tooltip.Positioner class="z-10"> |
| 544 | + <Tooltip.Content class="card bg-primary-200-800 text-xs p-2"> |
| 545 | + Opey Connection Status: {connectionStatusString} |
| 546 | + <Tooltip.Arrow class="[--arrow-size:--spacing(2)] [--arrow-background:var(--color-primary-200-800)]"> |
| 547 | + <Tooltip.ArrowTip /> |
| 548 | + </Tooltip.Arrow> |
| 549 | + </Tooltip.Content> |
| 550 | + </Tooltip.Positioner> |
| 551 | + </Portal> |
551 | 552 | </Tooltip> |
552 | | - <!-- Authentication Pip with Tooltip --> |
553 | | - <Tooltip open={authPipOpenState}> |
| 553 | + <!-- Authentication/Consent Pip with Tooltip --> |
| 554 | + <Tooltip> |
554 | 555 | <Tooltip.Trigger> |
555 | | - <div class="badge-icon {authPipColor} h-3 w-3"> |
556 | | - <ShieldUserIcon size={12} /> |
557 | | - </div> |
| 556 | + <a |
| 557 | + href="/user#opey-consent" |
| 558 | + class="h-2 w-2 rounded-full {authPipColor} cursor-pointer transition-all hover:scale-125 block" |
| 559 | + aria-label="View Opey consent" |
| 560 | + ></a> |
558 | 561 | </Tooltip.Trigger> |
559 | | - <Tooltip.Content> |
560 | | - {#if session.status === 'loading'} |
561 | | - Authenticating... |
562 | | - {:else if session.status === 'error'} |
563 | | - Error during authentication: {session.error} |
564 | | - {:else if session.isAuthenticated} |
565 | | - <h1 class="font-bold text-success-500">Authenticated</h1> |
566 | | - {#if consentInfo} |
567 | | - <br /> |
568 | | - Consent ID: |
569 | | - <a href="/user#opey-consent" aria-label="view opey consent" |
570 | | - >{consentInfo.consent_id}</a |
571 | | - > |
572 | | - {/if} |
573 | | - {:else} |
574 | | - Not Authenticated |
575 | | - {/if} |
576 | | - </Tooltip.Content> |
| 562 | + <Portal> |
| 563 | + <Tooltip.Positioner class="z-10"> |
| 564 | + <Tooltip.Content class="card bg-primary-200-800 text-xs p-2"> |
| 565 | + {#if session.status === 'loading'} |
| 566 | + Authenticating... |
| 567 | + {:else if session.status === 'error'} |
| 568 | + Error: {session.error} |
| 569 | + {:else if session.isAuthenticated && consentInfo} |
| 570 | + Click to view consent |
| 571 | + {:else if session.isAuthenticated} |
| 572 | + Authenticated (no consent info) |
| 573 | + {:else} |
| 574 | + Not Authenticated |
| 575 | + {/if} |
| 576 | + <Tooltip.Arrow class="[--arrow-size:--spacing(2)] [--arrow-background:var(--color-primary-200-800)]"> |
| 577 | + <Tooltip.ArrowTip /> |
| 578 | + </Tooltip.Arrow> |
| 579 | + </Tooltip.Content> |
| 580 | + </Tooltip.Positioner> |
| 581 | + </Portal> |
577 | 582 | </Tooltip> |
578 | | - <!-- {#if !session.isAuthenticated} |
579 | | - <button class="btn btn-sm btn-primary" onclick={upgradeSession} disabled={session.status === 'loading'}> |
580 | | - Log in to connect banking data |
581 | | - </button> |
582 | | - {/if} --> |
583 | 583 | </div> |
584 | 584 | {/if} |
585 | 585 | {/snippet} |
|
0 commit comments