|
13 | 13 | import { |
14 | 14 | faChevronDown, |
15 | 15 | faClose, |
16 | | - faDownload, |
| 16 | + faDownload, faInfo, |
17 | 17 | faRefresh |
18 | 18 | } from '@fortawesome/free-solid-svg-icons' |
19 | 19 | import { getDrawerStore, getToastStore } from '@skeletonlabs/skeleton' |
|
26 | 26 | import Number from '../Input/Number.svelte' |
27 | 27 | import Search from '../Input/Search.svelte' |
28 | 28 | import Dropdown from "$lib/svelte/components/Input/Dropdown.svelte"; |
| 29 | + import Popup from '$lib/svelte/components/Popup.svelte' |
| 30 | + import Link from '$lib/svelte/components/Link.svelte' |
29 | 31 |
|
30 | 32 | const drawerStore = getDrawerStore() |
31 | 33 |
|
|
81 | 83 | begin: number |
82 | 84 | end: number |
83 | 85 | annotationType: string |
| 86 | + details: string |
84 | 87 | } |
85 | 88 |
|
86 | 89 | type ProcessedAnnotation = { |
87 | 90 | text: string |
88 | 91 | annotationType?: string |
| 92 | + details: string |
89 | 93 | } |
90 | 94 |
|
91 | 95 | let selectedAnnotation: string = "" |
|
133 | 137 |
|
134 | 138 | Object.values(annotations) |
135 | 139 | .filter((annotation) => annotation.annotationType === selectedType) |
136 | | - .forEach(({ begin, end, annotationType }) => { |
| 140 | + .forEach(({ begin, end, annotationType, details }) => { |
137 | 141 | if (currentIndex < begin) { |
138 | | - parts.push({ text: text.slice(currentIndex, begin) }); |
| 142 | + parts.push({ text: text.slice(currentIndex, begin), details }); |
139 | 143 | } |
140 | 144 | parts.push({ |
141 | 145 | text: text.slice(begin, end), |
142 | | - annotationType |
| 146 | + annotationType, |
| 147 | + details |
143 | 148 | }); |
144 | 149 | currentIndex = end; |
145 | 150 | }); |
146 | 151 |
|
147 | 152 | if (currentIndex < text.length) { |
148 | | - parts.push({ text: text.slice(currentIndex) }); |
| 153 | + parts.push({ text: text.slice(currentIndex), details: "" }); |
149 | 154 | } |
150 | 155 |
|
151 | 156 | processingText = false |
|
413 | 418 | options={annotationNames} |
414 | 419 | /> |
415 | 420 | <hr class="border-t border-gray-300 my-4 rounded-md"> |
416 | | - <div class="p-8 py-4 border-b border-color flex justify-between items-center gap-8"> |
417 | | - <div class="flex flex-col items-start justify-center gap-2"> |
| 421 | + <div class="p-8 py-4 border-b border-color flex gap-8"> |
| 422 | + <div class="flex flex-col items-start gap-2"> |
418 | 423 | <div class="h-64 overflow-y-auto"> |
419 | 424 | {#each processedAnnotations as part} |
420 | 425 | {#if part.annotationType} |
421 | | - <span class=" variant-soft-primary px-1 rounded"> {part.text}</span> |
| 426 | + <span class=" variant-soft-primary px-1 rounded"> |
| 427 | + <Popup autoPopupWidth={true} arrow={false} position="left"> |
| 428 | + <svelte:fragment slot="trigger"> |
| 429 | + {part.text} |
| 430 | + </svelte:fragment> |
| 431 | + <svelte:fragment slot="popup" > |
| 432 | + <div class="bg-primary-50-900-token bg-transparent absolute p-3 rounded-md w-48 overflow-y-auto h-36"> |
| 433 | + <small class="max-w-prose text-primary-700 whitespace-pre-wrap"> |
| 434 | + {part.details} |
| 435 | + </small> |
| 436 | + </div> |
| 437 | + </svelte:fragment> |
| 438 | + </Popup> |
| 439 | + </span> |
422 | 440 | {:else} |
423 | 441 | <span>{part.text}</span> |
424 | 442 | {/if} |
|
0 commit comments