Skip to content

The agent that grows with you

feat(catalog): featured hero becomes a slider when there are several picks

Austin Pickett93600451dd2e
diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-discovery.css b/apps/desktop/src/app/capabilities/catalog/catalog-discovery.css
index 371753dab34..cddcd602fc0 100644
--- a/apps/desktop/src/app/capabilities/catalog/catalog-discovery.css
+++ b/apps/desktop/src/app/capabilities/catalog/catalog-discovery.css
@@ -46,6 +46,17 @@
[data-catalog-variant=hero] .catalog-card-copy { flex: none; max-width: 58%; }
[data-catalog-variant=hero] .catalog-card-copy button > span { font-size: 2rem; }
[data-catalog-variant=hero] .catalog-card-dates { margin-top: 0; }
+.catalog-featured-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; border-radius: var(--radius-lg); }
+.catalog-featured-track::-webkit-scrollbar { display: none; }
+.catalog-featured-slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; display: flex; }
+.catalog-featured-slide > [data-catalog-card] { flex: 1; }
+.catalog-featured-controls { display: flex; align-items: center; justify-content: center; gap: var(--capabilities-gap-sticky); padding-top: var(--capabilities-gap-sticky); }
+.catalog-featured-dots { display: flex; align-items: center; gap: 6px; }
+.catalog-featured-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--ui-text-quaternary); transition: width 200ms ease, background-color 200ms ease; }
+.catalog-featured-dot:hover { background: var(--ui-text-tertiary); transition: none; }
+.catalog-featured-dot.is-active { width: 18px; background: var(--ui-text-primary); }
+.catalog-featured-dot:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
+@media (prefers-reduced-motion: reduce) { .catalog-featured-dot { transition: none; } }
[data-catalog-card][data-catalog-variant=showcase] { display: flex; flex-direction: column; }
[data-catalog-card] > * { min-width: 0; max-width: 100%; }
[data-catalog-variant=showcase] .catalog-card-topline { padding: 20px; }
diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-discovery.test.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-discovery.test.tsx
index b5278e688c0..edf294f5fc1 100644
--- a/apps/desktop/src/app/capabilities/catalog/catalog-discovery.test.tsx
+++ b/apps/desktop/src/app/capabilities/catalog/catalog-discovery.test.tsx
@@ -34,3 +34,17 @@ describe('multi-category discovery', () => {
expect(sections(renderDiscovery(picked, false))).toEqual(['featured', 'official', 'more'])
})
})
+
+describe('featured slider', () => {
+ const curated = (name: string, featured: number) => ({ ...entry(name, 'tools', 'official'), featured, imageUrl: 'x.png' }) as CatalogEntry
+
+ it('shows one hero bare, and several as a slider with a dot per pick', () => {
+ const one = renderDiscovery([curated('a', 1), entry('b', 'tools')], false)
+ expect(one.querySelector('[aria-roledescription=carousel]')).toBeNull()
+
+ const many = renderDiscovery([curated('a', 1), curated('b', 2), curated('c', 3)], false)
+ expect(many.querySelectorAll('[aria-roledescription=slide]')).toHaveLength(3)
+ expect(many.querySelectorAll('.catalog-featured-dot')).toHaveLength(3)
+ expect(many.querySelectorAll('[aria-roledescription=slide]:not([inert])')).toHaveLength(1)
+ })
+})
diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-discovery.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-discovery.tsx
index e9ad495ec51..b6af54288e7 100644
--- a/apps/desktop/src/app/capabilities/catalog/catalog-discovery.tsx
+++ b/apps/desktop/src/app/capabilities/catalog/catalog-discovery.tsx
@@ -1,6 +1,6 @@
import './catalog-discovery.css'
-import { groupCatalogPlugins, isOfficialSkillSource, pickFeatured, PLUGIN_CATEGORIES } from '@hermes/shared'
+import { featuredPicks, groupCatalogPlugins, isOfficialSkillSource, PLUGIN_CATEGORIES } from '@hermes/shared'
import { type ReactNode, useState } from 'react'
import { Button } from '@/components/ui/button'
@@ -12,6 +12,7 @@ import type { CatalogCardVariant } from './catalog-card'
import { pluginTier, type PluginTier } from './catalog-curation'
import { type CatalogEntry, type CatalogKind, catalogLabel } from './catalog-data'
import { CatalogDeveloper } from './catalog-developer'
+import { CatalogFeaturedSlider } from './catalog-featured-slider'
import { catalogCategories } from './catalog-query'
/** Fewest cards a category needs for its own shelf; smaller ones share "More to explore". */
@@ -47,7 +48,8 @@ export function CatalogDiscovery({ entries, kind, card, onCategory, actions, nar
const title = kind === 'plugins' ? t.skills.tabPlugins : t.skills.tabSkills
// Same pick as the website: curated ranks from the feed, rotated weekly.
- const featured = narrowed ? undefined : pickFeatured(entries, entry => ({
+ // Every curated pick, this week's first; more than one becomes a slider.
+ const featured = narrowed ? [] : featuredPicks(entries, entry => ({
featured: entry.featured,
official: kind === 'plugins' ? pluginTier(entry) === 'official' : isOfficialSkillSource(entry.source),
pictured: Boolean(entry.imageUrl),
@@ -55,7 +57,8 @@ export function CatalogDiscovery({ entries, kind, card, onCategory, actions, nar
stars: entry.stars
}))
- const others = entries.filter(entry => entry !== featured)
+ // A slide leaves its shelf, as the single hero always did.
+ const others = entries.filter(entry => !featured.includes(entry))
const tiered = kind === 'plugins' && !byCategory ? PLUGIN_TIERS.map(tier => ({ tier, ...t.catalog.tiers[tier], items: others.filter(entry => pluginTier(entry) === tier) })).filter(({ items }) => items.length) : []
const remaining = kind === 'plugins' && !byCategory ? others.filter(entry => pluginTier(entry) === 'community') : others
@@ -86,9 +89,9 @@ export function CatalogDiscovery({ entries, kind, card, onCategory, actions, nar
return (
<div className="catalog-discovery">
- {featured && <section data-catalog-section="featured">
+ {featured.length > 0 && <section data-catalog-section="featured">
<header className="catalog-section-heading"><h2>{t.catalog.discoverKind(title)}</h2></header>
- {card(featured, 0, 'hero')}
+ <CatalogFeaturedSlider slides={featured.map((entry, index) => card(entry, index, 'hero'))} />
</section>}
{tiered.map(({ tier, title: tierTitle, blurb, items }, index) => (
<section data-catalog-section={tier} data-catalog-tier={tier} key={tier}>
diff --git a/apps/desktop/src/app/capabilities/catalog/catalog-featured-slider.tsx b/apps/desktop/src/app/capabilities/catalog/catalog-featured-slider.tsx
new file mode 100644
index 00000000000..c1bb4e8d714
--- /dev/null
+++ b/apps/desktop/src/app/capabilities/catalog/catalog-featured-slider.tsx
@@ -0,0 +1,102 @@
+import { type ReactNode, useEffect, useRef, useState } from 'react'
+
+import { Button } from '@/components/ui/button'
+import { useI18n } from '@/i18n'
+import { ChevronLeft, ChevronRight } from '@/lib/icons'
+import { cn } from '@/lib/utils'
+
+/** How long a slide holds before the hero advances on its own. */
+const SLIDE_MS = 7000
+
+const reducedMotion = () => window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false
+
+/** The featured hero as a slider once there is more than one pick: native
+ * scroll-snap slides (swipe/trackpad work as-is), prev/next and dots. It
+ * advances every SLIDE_MS unless the pointer or focus is inside, the window
+ * is hidden, or the user prefers reduced motion. One pick renders bare. */
+export function CatalogFeaturedSlider({ slides }: { slides: ReactNode[] }) {
+ const { t } = useI18n()
+ const c = t.catalog
+ const track = useRef<HTMLDivElement>(null)
+ const [index, setIndex] = useState(0)
+ const [held, setHeld] = useState(false)
+ const count = slides.length
+
+ const go = (next: number) => {
+ const node = track.current
+
+ if (!node) {return}
+
+ const target = (next + count) % count
+ node.scrollTo({ left: target * node.clientWidth, behavior: reducedMotion() ? 'auto' : 'smooth' })
+ setIndex(target)
+ }
+
+ // Keep the dots honest when the user swipes or scrolls the track directly.
+ const onScroll = () => {
+ const node = track.current
+
+ if (node && node.clientWidth) {setIndex(Math.round(node.scrollLeft / node.clientWidth))}
+ }
+
+ useEffect(() => {
+ if (count < 2 || held || reducedMotion()) {return}
+
+ const timer = window.setInterval(() => {
+ if (!document.hidden) {go(index + 1)}
+ }, SLIDE_MS)
+
+ return () => window.clearInterval(timer)
+ })
+
+ if (count < 2) {return <>{slides[0]}</>}
+
+ return (
+ <div
+ aria-label={c.featured}
+ aria-roledescription="carousel"
+ className="catalog-featured-slider"
+ onBlur={() => setHeld(false)}
+ onFocus={() => setHeld(true)}
+ onPointerEnter={() => setHeld(true)}
+ onPointerLeave={() => setHeld(false)}
+ role="region"
+ >
+ <div className="catalog-featured-track" onScroll={onScroll} ref={track}>
+ {slides.map((slide, slideIndex) => (
+ <div
+ aria-hidden={slideIndex !== index || undefined}
+ aria-label={c.slideOf(slideIndex + 1, count)}
+ aria-roledescription="slide"
+ className="catalog-featured-slide"
+ inert={slideIndex !== index || undefined}
+ key={slideIndex}
+ role="group"
+ >
+ {slide}
+ </div>
+ ))}
+ </div>
+ <div className="catalog-featured-controls">
+ <Button aria-label={c.previousSlide} onClick={() => go(index - 1)} size="icon-xs" variant="secondary">
+ <ChevronLeft />
+ </Button>
+ <div className="catalog-featured-dots">
+ {slides.map((_, slideIndex) => (
+ <button
+ aria-current={slideIndex === index || undefined}
+ aria-label={c.slideOf(slideIndex + 1, count)}
+ className={cn('catalog-featured-dot', slideIndex === index && 'is-active')}
+ key={slideIndex}
+ onClick={() => go(slideIndex)}
+ type="button"
+ />
+ ))}
+ </div>
+ <Button aria-label={c.nextSlide} onClick={() => go(index + 1)} size="icon-xs" variant="secondary">
+ <ChevronRight />
+ </Button>
+ </div>
+ </div>
+ )
+}
diff --git a/apps/desktop/src/i18n/en_catalog.ts b/apps/desktop/src/i18n/en_catalog.ts
index ff2aca702da..73fe6a703ff 100644
--- a/apps/desktop/src/i18n/en_catalog.ts
+++ b/apps/desktop/src/i18n/en_catalog.ts
@@ -59,6 +59,9 @@ export const enCatalog: CatalogTranslations = {
results: (count: number) => `${count.toLocaleString()} result${count === 1 ? '' : 's'}`,
back: 'Back to results',
tier: 'Tier',
+ previousSlide: 'Previous featured',
+ nextSlide: 'Next featured',
+ slideOf: (index: number, count: number) => `${index} of ${count}`,
tierLabels: { official: 'Official', verified: 'Verified', community: 'Community' },
tiers: {
official: { title: 'Official Plugins', blurb: 'Built and maintained by Nous Research.' },
diff --git a/apps/desktop/src/i18n/overlay-gaps.json b/apps/desktop/src/i18n/overlay-gaps.json
index 1be4fffea0c..346955758f6 100644
--- a/apps/desktop/src/i18n/overlay-gaps.json
+++ b/apps/desktop/src/i18n/overlay-gaps.json
@@ -255,9 +255,11 @@
"catalog.moreToExploreBlurb": ["ar","de","es","fr","ja","ru","zh","zh-hant"],
"catalog.mostStarred": ["de","es","fr"],
"catalog.newest": ["de","es","fr"],
+ "catalog.nextSlide": ["ar","de","es","fr","ja","ru","zh","zh-hant"],
"catalog.noResults": ["de","es","fr"],
"catalog.pinned": ["de","es","fr"],
"catalog.platforms": ["de","es","fr"],
+ "catalog.previousSlide": ["ar","de","es","fr","ja","ru","zh","zh-hant"],
"catalog.recentlyUpdated": ["de","es","fr"],
"catalog.related": ["de","es","fr"],
"catalog.repository": ["de","es","fr"],
@@ -269,6 +271,7 @@
"catalog.searchSkills": ["de","es","fr"],
"catalog.seeAll": ["de","es","fr"],
"catalog.skillsFor": ["ar","de","es","fr","ja","ru","zh","zh-hant"],
+ "catalog.slideOf": ["ar","de","es","fr","ja","ru","zh","zh-hant"],
"catalog.snapshotHint": ["de","es","fr"],
"catalog.sortBy": ["de","es","fr"],
"catalog.source": ["de","es","fr"],
diff --git a/apps/desktop/src/i18n/types_catalog.ts b/apps/desktop/src/i18n/types_catalog.ts
index 6ea28e9543e..f7a93fb7cd8 100644
--- a/apps/desktop/src/i18n/types_catalog.ts
+++ b/apps/desktop/src/i18n/types_catalog.ts
@@ -57,6 +57,9 @@ export interface CatalogTranslations {
results: (count: number) => string
back: string
tier: string
+ previousSlide: string
+ nextSlide: string
+ slideOf: (index: number, count: number) => string
tierLabels: Record<'official' | 'verified' | 'community', string>
tiers: {
official: { title: string; blurb: string }
diff --git a/apps/shared/src/catalog-featured.test.ts b/apps/shared/src/catalog-featured.test.ts
index 07d317e4e34..9592e89f2dd 100644
--- a/apps/shared/src/catalog-featured.test.ts
+++ b/apps/shared/src/catalog-featured.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
-import { type FeaturedCandidate, pickFeatured } from './catalog-featured'
+import { type FeaturedCandidate, featuredPicks, pickFeatured } from './catalog-featured'
const WEEK = 7 * 24 * 60 * 60 * 1000
const NOW = Date.parse('2026-09-30T12:00:00Z')
@@ -55,4 +55,29 @@ describe('pickFeatured', () => {
expect(pick([...rows, { name: 'official-art', official: true, pictured: true, stars: 1 }])).toBe('official-art')
expect(pick([{ name: 'community', official: false, pictured: true }])).toBeUndefined()
})
+
+ it('lists every curated pick for the slider, starting at this week\'s', () => {
+ const rows = [
+ { name: 'c', featured: 3, official: true, pictured: true },
+ { name: 'a', featured: 1, official: true, pictured: true },
+ { name: 'b', featured: 2, official: true, pictured: true },
+ { name: 'x', official: true, pictured: true }
+ ]
+
+ const week = 7 * 24 * 60 * 60 * 1000
+
+ for (const offset of [0, 1, 2]) {
+ const now = NOW + offset * week
+ const slides = featuredPicks(rows, row => row, now).map(row => row.name)
+
+ expect(slides).toHaveLength(3)
+ expect(slides[0]).toBe(pick(rows, now))
+ expect([...slides].sort()).toEqual(['a', 'b', 'c'])
+ }
+ })
+
+ it('falls back to one slide without curated picks, none without candidates', () => {
+ expect(featuredPicks([{ name: 'x', official: true, pictured: true }], row => row, NOW).map(row => row.name)).toEqual(['x'])
+ expect(featuredPicks([{ name: 'y', official: false, pictured: true }], row => row, NOW)).toEqual([])
+ })
})
diff --git a/apps/shared/src/catalog-featured.ts b/apps/shared/src/catalog-featured.ts
index 79683967c36..64f19267199 100644
--- a/apps/shared/src/catalog-featured.ts
+++ b/apps/shared/src/catalog-featured.ts
@@ -30,16 +30,25 @@ const FRESH_MS = 30 * DAY_MS
const rank = (value: FeaturedCandidate) => (typeof value.featured === 'number' && value.featured > 0 ? value.featured : 0)
const added = (value: FeaturedCandidate) => Date.parse(value.addedAt ?? '') || 0
-export function pickFeatured<T>(entries: readonly T[], read: (entry: T) => FeaturedCandidate, now = Date.now()): T | undefined {
+/** Every hero slide, in order: the curated picks starting at this week's
+ * (so slide one is the same entry as `pickFeatured`), else the single
+ * fallback pick. */
+export function featuredPicks<T>(entries: readonly T[], read: (entry: T) => FeaturedCandidate, now = Date.now()): T[] {
const rows = entries.map(entry => ({ entry, value: read(entry) }))
const curated = rows.filter(row => rank(row.value)).sort((a, b) => rank(a.value) - rank(b.value))
if (curated.length) {
- return curated[Math.floor(now / WEEK_MS) % curated.length].entry
+ const start = Math.floor(now / WEEK_MS) % curated.length
+
+ return [...curated.slice(start), ...curated.slice(0, start)].map(row => row.entry)
}
const official = rows.filter(row => row.value.official)
const fresh = official.filter(row => row.value.pictured && added(row.value) > now - FRESH_MS).sort((a, b) => added(b.value) - added(a.value))
+ const pick = (fresh[0] ?? official.sort((a, b) => Number(b.value.pictured) - Number(a.value.pictured) || (b.value.stars ?? 0) - (a.value.stars ?? 0))[0])?.entry
- return (fresh[0] ?? official.sort((a, b) => Number(b.value.pictured) - Number(a.value.pictured) || (b.value.stars ?? 0) - (a.value.stars ?? 0))[0])?.entry
+ return pick === undefined ? [] : [pick]
}
+
+export const pickFeatured = <T>(entries: readonly T[], read: (entry: T) => FeaturedCandidate, now = Date.now()): T | undefined =>
+ featuredPicks(entries, read, now)[0]
diff --git a/apps/shared/src/index.ts b/apps/shared/src/index.ts
index b01c854e73c..d0d6dcf8b5b 100644
--- a/apps/shared/src/index.ts
+++ b/apps/shared/src/index.ts
@@ -28,7 +28,7 @@ export type {
UsageModelData
} from './billing-types'
export { groupCatalogPlugins, PLUGIN_CATEGORIES, PLUGIN_CATEGORY_ORDER, sortCatalogPlugins } from './catalog-browse'
-export { type FeaturedCandidate, isOfficialSkillSource, OFFICIAL_SKILL_SOURCES, pickFeatured } from './catalog-featured'
+export { type FeaturedCandidate, featuredPicks, isOfficialSkillSource, OFFICIAL_SKILL_SOURCES, pickFeatured } from './catalog-featured'
export { pluginCatalogInstallUrl, skillCatalogInstallIdentifier, skillCatalogInstallUrl } from './catalog-install'
export {
driveChargeSettlement,
diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.json
index 4bf7dead435..4e23c0c225c 100644
--- a/locales/_keys.desktop.json
+++ b/locales/_keys.desktop.json
@@ -604,9 +604,11 @@
"catalog.moreToExploreBlurb",
"catalog.mostStarred",
"catalog.newest",
+ "catalog.nextSlide",
"catalog.noResults",
"catalog.pinned",
"catalog.platforms",
+ "catalog.previousSlide",
"catalog.recentlyUpdated",
"catalog.related",
"catalog.repository",
@@ -618,6 +620,7 @@
"catalog.searchSkills",
"catalog.seeAll",
"catalog.skillsFor",
+ "catalog.slideOf",
"catalog.snapshotHint",
"catalog.sortBy",
"catalog.source",