* Build the shared status panel HTML for after-sharing and share control views * @param {Object} opts - {isPlaintext, apiKeyShared, apiKeyExpiresAt, isExpired, expiryDate, messageCount, shareUrl, previewHtml}
(opts)
| 270 | // Format API key expiry as relative time |
| 271 | const keyExpiry = apiKeyExpiresAt ? formatKeyExpiry(apiKeyExpiresAt) : null; |
| 272 | const statusText = isExpired ? 'Expired' : 'Active'; |
| 273 | const statusClass = isExpired ? 'text-amber-600 dark:text-amber-400' : 'text-status-success'; |
| 274 | |
| 275 | const encryptionValue = isPlaintext |
| 276 | ? '<span class="text-xs text-foreground">None</span>' |
| 277 | : '<span class="text-[10px] px-1.5 py-0.5 rounded badge-status-success">Encrypted</span>'; |
| 278 | |
| 279 | const apiKeyValue = apiKeyShared |
| 280 | ? (keyExpiry |
| 281 | ? (keyExpiry.isExpired |
| 282 | ? '<span class="text-amber-600 dark:text-amber-400">Included (expired)</span>' |
| 283 | : `<span class="text-xs text-foreground">Included (expires ${keyExpiry.text})</span>`) |
| 284 | : '<span class="text-xs text-foreground">Included</span>') |
| 285 | : '<span class="text-xs text-foreground">Not included</span>'; |
| 286 | |
| 287 | return ` |
| 288 | <!-- Content section that grows --> |
| 289 | <div class="flex-1"> |
| 290 | ${buildInfoRow('Sharing Status', `<span class="text-sm font-medium ${statusClass}">${statusText}</span>`)} |
| 291 | ${buildInfoRow('Encrypted Sharing', encryptionValue)} |
| 292 | ${buildInfoRow('Expires', `<span class="text-xs text-foreground">${expiryDate || 'Never'}</span>`)} |
| 293 | ${buildInfoRow('Messages', `<span class="text-xs text-foreground">${messageCount || 0}</span>`)} |
| 294 | ${buildInfoRow('Session API key', apiKeyValue, 'mb-4')} |
| 295 | |
| 296 | <!-- Share link box --> |
| 297 | <div class="mb-4 rounded-lg border border-border/50 overflow-hidden"> |
| 298 | <div class="flex items-center gap-1.5 text-xs text-muted-foreground px-2.5 py-1.5 bg-muted/30 border-b border-border/30"> |
| 299 | ${LINK_ICON_SMALL_SVG} |
| 300 | Share link |
| 301 | </div> |
| 302 | <div class="px-2.5 py-2 flex items-center gap-2"> |
| 303 | <input type="text" readonly class="share-url-input flex-1 text-xs bg-transparent text-foreground/80 outline-none truncate" value="${shareUrl}"> |
| 304 | </div> |
| 305 | </div> |
| 306 | |
| 307 | ${buildPreviewContainerHtml(previewHtml, 'Shared content preview')} |
| 308 | </div> |
| 309 | |
| 310 | <!-- Bottom buttons (equally spaced) --> |
| 311 | <div class="flex justify-between items-center mt-auto"> |
| 312 | <button id="done-btn" class="btn-ghost-hover px-4 py-1.5 text-sm rounded-md border border-border bg-background text-foreground transition-colors"> |
| 313 | Done |
| 314 | </button> |
| 315 | <button id="revoke-btn" class="btn-destructive-bright inline-flex items-center justify-center rounded-md bg-destructive px-4 py-1.5 text-sm font-medium text-destructive-foreground shadow-sm transition-all duration-200"> |
| 316 | Stop Sharing |
| 317 | </button> |
| 318 | <button id="copy-link-btn" class="btn-primary-bright px-4 py-1.5 text-sm rounded-md bg-blue-600 text-white transition-all duration-200 flex items-center gap-1.5"> |
| 319 | ${COPY_ICON_SVG} |
| 320 | <span>Copy link</span> |
| 321 | </button> |
| 322 | </div> |
| 323 | `; |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * Build expired share panel with "Share Again" button |
| 328 | */ |
| 329 | function buildExpiredPanelHtml(opts) { |
no test coverage detected