| 1 | <script type="module"> |
| 2 | import { store } from "/plugins/_discovery/webui/discovery-store.js"; |
| 3 | </script> |
| 4 | |
| 5 | <div x-data> |
| 6 | <template x-if="$store.discoveryStore"> |
| 7 | <div class="discovery-slot" |
| 8 | @modal-closed.window="$store.discoveryStore.refreshCards()" |
| 9 | x-create="$store.discoveryStore.refreshCards()" |
| 10 | x-show="$store.discoveryStore.featureCards.length > 0 || $store.discoveryStore.oauthAccountCards.length > 0 || $store.discoveryStore.hasDismissedCards"> |
| 11 | |
| 12 | <section class="discovery-features-panel" x-show="$store.discoveryStore.featureCards.length > 0"> |
| 13 | <header class="discovery-panel-header"> |
| 14 | <div class="discovery-panel-copy"> |
| 15 | <h2>Connect Channels</h2> |
| 16 | <p>Extend Agent Zero across your favorite platforms.</p> |
| 17 | </div> |
| 18 | <button class="discovery-dismiss discovery-panel-dismiss" |
| 19 | type="button" |
| 20 | x-show="$store.discoveryStore.featureCards.some(card => card.dismissible !== false)" |
| 21 | @click.stop="$store.discoveryStore.dismissFeatureCards()" |
| 22 | aria-label="Dismiss Connect Channels" |
| 23 | title="Dismiss"> |
| 24 | <x-icon name="close"></x-icon> |
| 25 | </button> |
| 26 | </header> |
| 27 | |
| 28 | <div class="discovery-features"> |
| 29 | <template x-for="card in $store.discoveryStore.featureCards" :key="card.id"> |
| 30 | <button class="discovery-feature-card" |
| 31 | type="button" |
| 32 | @click="$store.discoveryStore.executeCta(card.cta_action)"> |
| 33 | <span class="discovery-feature-thumb"> |
| 34 | <template x-if="card.thumbnail"> |
| 35 | <img :src="card.thumbnail" :alt="card.title" loading="lazy"> |
| 36 | </template> |
| 37 | <template x-if="!card.thumbnail && card.icon"> |
| 38 | <x-icon class="discovery-feature-icon" :name="card.icon"></x-icon> |
| 39 | </template> |
| 40 | </span> |
| 41 | <span class="discovery-feature-title" x-text="`${card.cta_text || 'Connect'} ${card.title}`"></span> |
| 42 | </button> |
| 43 | </template> |
| 44 | </div> |
| 45 | </section> |
| 46 | |
| 47 | <template x-for="card in $store.discoveryStore.oauthAccountCards" :key="card.id"> |
| 48 | <article class="discovery-account-card"> |
| 49 | <button class="discovery-dismiss" |
| 50 | type="button" |
| 51 | x-show="card.dismissible" |
| 52 | @click.stop="$store.discoveryStore.dismissCard(card.id)" |
| 53 | :aria-label="`Dismiss ${card.title}`" |
| 54 | title="Dismiss"> |
| 55 | <x-icon name="close"></x-icon> |
| 56 | </button> |
| 57 | |
| 58 | <header class="discovery-account-header"> |
| 59 | <div class="discovery-account-copy"> |
| 60 | <h2 x-text="card.title"></h2> |
| 61 | <p x-show="card.description" x-text="card.description"></p> |
| 62 | </div> |
| 63 | <button class="btn btn primary discovery-account-cta" |
| 64 | type="button" |
| 65 | @click="$store.discoveryStore.executeCta(card.cta_action)"> |
| 66 | <span x-text="card.cta_text"></span> |
| 67 | <x-icon name="arrow_forward"></x-icon> |
| 68 | </button> |
| 69 | </header> |
| 70 | |
| 71 | <div class="discovery-account-chips" x-show="(card.account_chips || []).length > 0"> |
| 72 | <template x-for="chip in card.account_chips || []" :key="chip.provider_id || chip.label"> |
| 73 | <span class="discovery-account-chip" :class="{ 'is-connected': chip.connected }"> |
| 74 | <span class="discovery-account-chip-dot" aria-hidden="true"></span> |
| 75 | <span class="discovery-account-chip-label" x-text="chip.label"></span> |
| 76 | <span class="discovery-account-chip-detail" x-show="chip.detail" x-text="chip.detail"></span> |
| 77 | </span> |
| 78 | </template> |
| 79 | </div> |
| 80 | |
| 81 | <div class="discovery-account-usage" x-show="(card.usage_windows || []).length > 0"> |
| 82 | <template x-for="window in card.usage_windows || []" :key="window.key || window.title"> |
| 83 | <div class="discovery-account-usage-row"> |
| 84 | <div class="discovery-account-usage-label"> |
| 85 | <span x-text="window.title"></span> |
| 86 | <small x-show="$store.discoveryStore.formatReset(window)" |
| 87 | x-text="`Resets in ${$store.discoveryStore.formatReset(window)}`"></small> |
| 88 | </div> |
| 89 | <div class="discovery-account-usage-meter"> |
| 90 | <span class="discovery-account-usage-track"> |
| 91 | <span class="discovery-account-usage-fill" |
| 92 | :style="`width: ${$store.discoveryStore.usageWidth(window)}`"></span> |
| 93 | </span> |
| 94 | <span class="discovery-account-usage-value" |
| 95 | x-text="$store.discoveryStore.formatRemainingPercent(window)"></span> |
| 96 | </div> |
| 97 | </div> |
| 98 | </template> |
| 99 | </div> |
| 100 | |
| 101 | </article> |
| 102 | </template> |
| 103 | |
| 104 | <div class="discovery-undismiss" x-show="$store.discoveryStore.hasDismissedCards"> |
| 105 | <button type="button" |
| 106 | class="discovery-undismiss-btn" |
| 107 | @click="$store.discoveryStore.undismissCards()"> |
| 108 | <x-icon name="undo"></x-icon> |
| 109 | <span>Show dismissed suggestions</span> |
| 110 | </button> |
| 111 | </div> |
| 112 | </div> |
| 113 | </template> |
| 114 | |
| 115 | <style> |
| 116 | .discovery-slot { |
| 117 | display: grid; |
| 118 | gap: 1rem; |
| 119 | min-width: 0; |
| 120 | width: 100%; |
| 121 | } |
| 122 | |
| 123 | .discovery-features-panel, |
| 124 | .discovery-account-card { |
| 125 | border: 1px solid color-mix(in srgb, var(--color-border) 66%, transparent); |
| 126 | border-radius: 8px; |
| 127 | background: color-mix(in srgb, var(--color-panel) 78%, var(--color-background) 22%); |
| 128 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.026); |
| 129 | backdrop-filter: blur(18px); |
| 130 | text-align: left; |
| 131 | } |
| 132 | |
| 133 | .discovery-features-panel { |
| 134 | min-height: 100%; |
| 135 | padding: 1.25rem 1.45rem; |
| 136 | } |
| 137 | |
| 138 | .discovery-panel-header { |
| 139 | display: grid; |
| 140 | grid-template-columns: minmax(0, 1fr) auto; |
| 141 | gap: 0.7rem; |
| 142 | align-items: start; |
| 143 | margin-bottom: 1.28rem; |
| 144 | } |
| 145 | |
| 146 | .discovery-panel-copy { |
| 147 | display: grid; |
| 148 | gap: 0.42rem; |
| 149 | min-width: 0; |
| 150 | } |
| 151 | |
| 152 | .discovery-panel-header h2 { |
| 153 | margin: 0; |
| 154 | color: var(--color-text); |
| 155 | font-size: 1.05rem; |
| 156 | font-weight: 520; |
| 157 | line-height: 1.2; |
| 158 | } |
| 159 | |
| 160 | .discovery-panel-header p { |
| 161 | margin: 0; |
| 162 | color: color-mix(in srgb, var(--color-text) 58%, transparent); |
| 163 | font-size: 0.92rem; |
| 164 | line-height: 1.35; |
| 165 | } |
| 166 | |
| 167 | .discovery-features { |
| 168 | display: grid; |
| 169 | grid-template-columns: repeat(3, minmax(0, 1fr)); |
| 170 | gap: 0.65rem; |
| 171 | } |
| 172 | |
| 173 | .discovery-feature-card { |
| 174 | display: inline-flex; |
| 175 | align-items: center; |
| 176 | gap: 0.5rem; |
| 177 | min-width: 0; |
| 178 | min-height: 3.1rem; |
| 179 | border: 1px solid color-mix(in srgb, var(--color-border) 52%, transparent); |
| 180 | border-radius: 8px; |
| 181 | padding: 0.56rem 0.58rem; |
| 182 | background: color-mix(in srgb, var(--color-background) 50%, transparent); |
| 183 | color: inherit; |
| 184 | cursor: pointer; |
| 185 | font-family: var(--font-family-main, "Rubik", Arial, Helvetica, sans-serif); |
| 186 | text-align: left; |
| 187 | transition: |
| 188 | border-color 0.18s ease, |
| 189 | background-color 0.18s ease; |
| 190 | } |
| 191 | |
| 192 | .discovery-feature-thumb { |
| 193 | flex: 0 0 auto; |
| 194 | width: 32px; |
| 195 | height: 32px; |
| 196 | display: flex; |
| 197 | align-items: center; |
| 198 | justify-content: center; |
| 199 | border-radius: 999px; |
| 200 | overflow: hidden; |
| 201 | background: color-mix(in srgb, var(--color-primary) 10%, transparent); |
| 202 | box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-primary) 10%, transparent); |
| 203 | } |
| 204 | |
| 205 | .discovery-feature-thumb img { |
| 206 | width: 100%; |
| 207 | height: 100%; |
| 208 | object-fit: cover; |
| 209 | } |
| 210 | |
| 211 | .discovery-feature-icon { |
| 212 | font-size: 1.45rem; |
| 213 | color: var(--color-highlight-dark); |
| 214 | } |
| 215 | |
| 216 | .discovery-feature-title { |
| 217 | margin: 0; |
| 218 | flex: 1 1 auto; |
| 219 | min-width: 0; |
| 220 | color: var(--color-text); |
| 221 | font-size: 0.84rem; |
| 222 | font-weight: 520; |
| 223 | line-height: 1.25; |
| 224 | } |
| 225 | |
| 226 | .discovery-feature-card:hover, |
| 227 | .discovery-feature-card:focus-visible { |
| 228 | border-color: color-mix(in srgb, var(--color-border) 88%, var(--color-text) 12%); |
| 229 | background: color-mix(in srgb, var(--color-panel) 86%, var(--color-background) 14%); |
| 230 | outline: none; |
| 231 | } |
| 232 | |
| 233 | .discovery-dismiss { |
| 234 | position: absolute; |
| 235 | top: 0.65rem; |
| 236 | right: 0.65rem; |
| 237 | display: flex; |
| 238 | align-items: center; |
| 239 | justify-content: center; |
| 240 | width: 28px; |
| 241 | height: 28px; |
| 242 | border: none; |
| 243 | border-radius: 8px; |
| 244 | background: transparent; |
| 245 | color: var(--color-secondary); |
| 246 | cursor: pointer; |
| 247 | opacity: 0; |
| 248 | transition: |
| 249 | opacity 0.2s ease, |
| 250 | background-color 0.2s ease, |
| 251 | color 0.2s ease; |
| 252 | z-index: 2; |
| 253 | } |
| 254 | |
| 255 | .discovery-dismiss-small { |
| 256 | top: 0.55rem; |
| 257 | right: 0.55rem; |
| 258 | width: 26px; |
| 259 | height: 26px; |
| 260 | } |
| 261 | |
| 262 | .discovery-panel-dismiss { |
| 263 | position: static; |
| 264 | opacity: 0.68; |
| 265 | } |
| 266 | |
| 267 | .discovery-account-card > .discovery-dismiss { |
| 268 | opacity: 0.68; |
| 269 | } |
| 270 | |
| 271 | .discovery-dismiss:hover, |
| 272 | .discovery-dismiss:focus-visible { |
| 273 | opacity: 1; |
| 274 | color: var(--color-text); |
| 275 | background: color-mix(in srgb, var(--color-border) 84%, transparent); |
| 276 | outline: none; |
| 277 | } |
| 278 | |
| 279 | .discovery-dismiss .material-symbols-outlined { |
| 280 | font-size: 1rem; |
| 281 | } |
| 282 | |
| 283 | .discovery-account-card { |
| 284 | position: relative; |
| 285 | display: grid; |
| 286 | gap: 1rem; |
| 287 | padding: 1.25rem 1.45rem 1.25rem; |
| 288 | } |
| 289 | |
| 290 | .discovery-account-header { |
| 291 | display: grid; |
| 292 | grid-template-columns: minmax(0, 1fr) auto; |
| 293 | gap: 0.95rem; |
| 294 | align-items: center; |
| 295 | min-width: 0; |
| 296 | padding-right: 2.1rem; |
| 297 | } |
| 298 | |
| 299 | .discovery-account-copy { |
| 300 | display: grid; |
| 301 | gap: 0.3rem; |
| 302 | min-width: 0; |
| 303 | } |
| 304 | |
| 305 | .discovery-account-copy h2 { |
| 306 | margin: 0; |
| 307 | color: var(--color-text); |
| 308 | font-size: 1.05rem; |
| 309 | font-weight: 520; |
| 310 | line-height: 1.2; |
| 311 | } |
| 312 | |
| 313 | .discovery-account-copy p { |
| 314 | margin: 0; |
| 315 | color: color-mix(in srgb, var(--color-text) 58%, transparent); |
| 316 | font-size: 0.9rem; |
| 317 | line-height: 1.42; |
| 318 | } |
| 319 | |
| 320 | .discovery-account-chips { |
| 321 | display: flex; |
| 322 | flex-wrap: wrap; |
| 323 | gap: 0.5rem; |
| 324 | min-width: 0; |
| 325 | } |
| 326 | |
| 327 | .discovery-account-chip { |
| 328 | display: inline-grid; |
| 329 | grid-template-columns: auto auto minmax(0, auto); |
| 330 | align-items: center; |
| 331 | gap: 0.4rem; |
| 332 | max-width: 100%; |
| 333 | min-height: 2rem; |
| 334 | padding: 0.32rem 0.58rem; |
| 335 | border: 1px solid color-mix(in srgb, var(--color-border) 52%, transparent); |
| 336 | border-radius: 8px; |
| 337 | background: color-mix(in srgb, var(--color-background) 50%, transparent); |
| 338 | color: color-mix(in srgb, var(--color-text) 74%, transparent); |
| 339 | font-size: 0.8rem; |
| 340 | line-height: 1.2; |
| 341 | } |
| 342 | |
| 343 | .discovery-account-chip-dot { |
| 344 | width: 0.44rem; |
| 345 | height: 0.44rem; |
| 346 | border-radius: 999px; |
| 347 | background: color-mix(in srgb, var(--color-text) 34%, transparent); |
| 348 | } |
| 349 | |
| 350 | .discovery-account-chip.is-connected .discovery-account-chip-dot { |
| 351 | background: #22c55e; |
| 352 | } |
| 353 | |
| 354 | .discovery-account-chip-label, |
| 355 | .discovery-account-chip-detail { |
| 356 | min-width: 0; |
| 357 | overflow: hidden; |
| 358 | text-overflow: ellipsis; |
| 359 | white-space: nowrap; |
| 360 | } |
| 361 | |
| 362 | .discovery-account-chip-label { |
| 363 | color: var(--color-text); |
| 364 | font-weight: 500; |
| 365 | } |
| 366 | |
| 367 | .discovery-account-chip-detail { |
| 368 | color: color-mix(in srgb, var(--color-text) 52%, transparent); |
| 369 | } |
| 370 | |
| 371 | .discovery-account-usage { |
| 372 | display: grid; |
| 373 | gap: 0.74rem; |
| 374 | padding-top: 0.12rem; |
| 375 | } |
| 376 | |
| 377 | .discovery-account-usage-row { |
| 378 | display: grid; |
| 379 | grid-template-columns: minmax(0, 1fr) minmax(8rem, 0.82fr); |
| 380 | gap: 1rem; |
| 381 | align-items: center; |
| 382 | min-width: 0; |
| 383 | } |
| 384 | |
| 385 | .discovery-account-usage-label { |
| 386 | display: grid; |
| 387 | gap: 0.22rem; |
| 388 | min-width: 0; |
| 389 | } |
| 390 | |
| 391 | .discovery-account-usage-label span, |
| 392 | .discovery-account-usage-label small { |
| 393 | min-width: 0; |
| 394 | overflow: hidden; |
| 395 | text-overflow: ellipsis; |
| 396 | white-space: nowrap; |
| 397 | } |
| 398 | |
| 399 | .discovery-account-usage-label span { |
| 400 | color: color-mix(in srgb, var(--color-text) 74%, transparent); |
| 401 | font-size: 0.84rem; |
| 402 | line-height: 1.25; |
| 403 | } |
| 404 | |
| 405 | .discovery-account-usage-label small { |
| 406 | color: color-mix(in srgb, var(--color-text) 44%, transparent); |
| 407 | font-size: 0.72rem; |
| 408 | line-height: 1.2; |
| 409 | } |
| 410 | |
| 411 | .discovery-account-usage-meter { |
| 412 | display: grid; |
| 413 | grid-template-columns: minmax(0, 1fr) auto; |
| 414 | gap: 0.58rem; |
| 415 | align-items: center; |
| 416 | min-width: 0; |
| 417 | } |
| 418 | |
| 419 | .discovery-account-usage-track { |
| 420 | height: 0.52rem; |
| 421 | overflow: hidden; |
| 422 | border-radius: 999px; |
| 423 | background: color-mix(in srgb, var(--color-border) 70%, transparent); |
| 424 | } |
| 425 | |
| 426 | .discovery-account-usage-fill { |
| 427 | display: block; |
| 428 | height: 100%; |
| 429 | border-radius: inherit; |
| 430 | background: #22c55e; |
| 431 | transition: width 0.22s ease; |
| 432 | } |
| 433 | |
| 434 | .discovery-account-usage-value { |
| 435 | color: color-mix(in srgb, var(--color-text) 70%, transparent); |
| 436 | font-family: var(--font-family-code, "Roboto Mono", monospace); |
| 437 | font-size: 0.74rem; |
| 438 | line-height: 1; |
| 439 | white-space: nowrap; |
| 440 | } |
| 441 | |
| 442 | .discovery-account-cta { |
| 443 | justify-self: end; |
| 444 | display: inline-flex; |
| 445 | align-items: center; |
| 446 | justify-content: center; |
| 447 | gap: 0.36rem; |
| 448 | min-height: 2.35rem; |
| 449 | min-width: 8.65rem; |
| 450 | border: 0; |
| 451 | border-radius: 8px; |
| 452 | padding: 0.55rem 0.9rem; |
| 453 | background-color: #4248f1; |
| 454 | color: #fff; |
| 455 | font-family: var(--font-family-main, "Rubik", Arial, Helvetica, sans-serif); |
| 456 | font-size: 0.88rem; |
| 457 | font-weight: 460; |
| 458 | white-space: nowrap; |
| 459 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2); |
| 460 | } |
| 461 | |
| 462 | .discovery-account-cta:hover, |
| 463 | .discovery-account-cta:focus-visible { |
| 464 | background-color: #353bc5; |
| 465 | filter: none; |
| 466 | outline: none; |
| 467 | } |
| 468 | |
| 469 | .discovery-account-cta .material-symbols-outlined { |
| 470 | font-size: 1.05rem; |
| 471 | } |
| 472 | |
| 473 | .discovery-undismiss { |
| 474 | display: flex; |
| 475 | justify-content: flex-start; |
| 476 | } |
| 477 | |
| 478 | .discovery-undismiss-btn { |
| 479 | display: inline-flex; |
| 480 | align-items: center; |
| 481 | justify-content: center; |
| 482 | gap: 0.35rem; |
| 483 | border: none; |
| 484 | background: transparent; |
| 485 | padding: 0; |
| 486 | color: var(--color-secondary); |
| 487 | cursor: pointer; |
| 488 | font-size: 0.8rem; |
| 489 | font-weight: 500; |
| 490 | transition: color 0.2s ease; |
| 491 | } |
| 492 | |
| 493 | .discovery-undismiss-btn:hover, |
| 494 | .discovery-undismiss-btn:focus-visible { |
| 495 | color: var(--color-primary); |
| 496 | outline: none; |
| 497 | } |
| 498 | |
| 499 | .discovery-undismiss-btn .material-symbols-outlined { |
| 500 | font-size: 1rem; |
| 501 | } |
| 502 | |
| 503 | @media (hover: none) { |
| 504 | .discovery-dismiss { |
| 505 | opacity: 0.68; |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | @media (max-width: 768px) { |
| 510 | .discovery-features { |
| 511 | grid-template-columns: 1fr; |
| 512 | gap: 0.75rem; |
| 513 | } |
| 514 | |
| 515 | .discovery-feature-card { |
| 516 | display: inline-flex; |
| 517 | min-height: 0; |
| 518 | padding: 0.62rem 0.7rem; |
| 519 | } |
| 520 | |
| 521 | .discovery-feature-thumb { |
| 522 | width: 32px; |
| 523 | height: 32px; |
| 524 | } |
| 525 | |
| 526 | .discovery-account-usage-row { |
| 527 | grid-template-columns: 1fr; |
| 528 | gap: 0.45rem; |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | @media (max-width: 520px) { |
| 533 | .discovery-slot { |
| 534 | margin-top: 0.15rem; |
| 535 | } |
| 536 | |
| 537 | .discovery-feature-card { |
| 538 | padding-right: 0.7rem; |
| 539 | } |
| 540 | |
| 541 | .discovery-account-card { |
| 542 | padding: 1.05rem; |
| 543 | } |
| 544 | |
| 545 | .discovery-account-header { |
| 546 | grid-template-columns: 1fr; |
| 547 | padding-right: 2.2rem; |
| 548 | } |
| 549 | |
| 550 | .discovery-account-cta { |
| 551 | grid-column: 1 / -1; |
| 552 | justify-self: start; |
| 553 | } |
| 554 | |
| 555 | } |
| 556 | </style> |
| 557 | </div> |