Skip to content

The agent that grows with you

feat(website): uniform plugin catalog cards (clamped text, capped tool list)

teknium197a36078387d
diff --git a/website/src/components/PluginCatalog/catalog.ts b/website/src/components/PluginCatalog/catalog.ts
index 0f86ff931f5..f567320a351 100644
--- a/website/src/components/PluginCatalog/catalog.ts
+++ b/website/src/components/PluginCatalog/catalog.ts
@@ -118,6 +118,19 @@ export function tierOf(plugin: Pick<CatalogPlugin, "tier">) {
return TIER_CONFIG[plugin.tier] || TIER_CONFIG.community;
}
+/** Tool chips a catalog card shows: the first `max` names plus how many were folded into a `+N`. */
+export const CARD_TOOL_CHIP_LIMIT = 3;
+
+export interface CappedToolChips {
+ shown: string[];
+ hidden: number;
+}
+
+export function capToolChips(tools: string[] | undefined, max = CARD_TOOL_CHIP_LIMIT): CappedToolChips {
+ const all = tools ?? [];
+ return { shown: all.slice(0, max), hidden: Math.max(0, all.length - max) };
+}
+
export function formatStars(n: number): string {
return n >= 1000 ? `${(n / 1000).toFixed(n >= 10_000 ? 0 : 1)}k` : String(n);
}
diff --git a/website/src/pages/plugins/index.tsx b/website/src/pages/plugins/index.tsx
index 78356abc38c..6af1c0bc438 100644
--- a/website/src/pages/plugins/index.tsx
+++ b/website/src/pages/plugins/index.tsx
@@ -13,6 +13,7 @@ import {
SUBMIT_PLUGIN_URL,
TIER_CONFIG,
authorPagePath,
+ capToolChips,
categoryOf,
desktopInstallLink,
formatDate,
@@ -82,6 +83,12 @@ function PluginCard({
const toolCount = caps.providesTools?.length || 0;
const hookCount = caps.providesHooks?.length || 0;
const middlewareCount = caps.providesMiddleware?.length || 0;
+ const toolChips = capToolChips(caps.providesTools);
+ const description = plugin.description || "No description available.";
+ // A broken banner URL swaps to the placeholder instead of collapsing, so the card keeps its
+ // height (every card in a grid row shares one height; see .grid in styles.module.css).
+ const [imageBroken, setImageBroken] = useState(false);
+ const showImage = Boolean(plugin.image) && !imageBroken;
const pagePath = pluginPagePath(plugin.name);
const history = useHistory();
const pageHref = useBaseUrl(pagePath); // <Link> adds baseUrl itself; history.push does not
@@ -105,7 +112,7 @@ function PluginCard({
>
<div className={styles.cardAccent} style={{ background: tier.color }} />
- {plugin.image && (
+ {showImage ? (
<img
className={styles.cardImage}
src={plugin.image}
@@ -113,15 +120,23 @@ function PluginCard({
loading="lazy"
decoding="async"
referrerPolicy="no-referrer"
- onError={(e) => { e.currentTarget.style.display = "none"; }}
+ onError={() => setImageBroken(true)}
/>
+ ) : (
+ <div
+ className={styles.cardImagePlaceholder}
+ aria-hidden="true"
+ style={{ background: `linear-gradient(135deg, color-mix(in srgb, ${tier.color} 12%, transparent), transparent 70%)` }}
+ >
+ <span className={styles.cardImagePlaceholderIcon}>{category.icon}</span>
+ </div>
)}
<div className={styles.cardInner}>
<div className={styles.cardTop}>
<span className={styles.cardIcon} title={category.label}>{category.icon}</span>
<div className={styles.cardTitleGroup}>
- <h3 className={styles.cardTitle}>
+ <h3 className={styles.cardTitle} title={plugin.name}>
<Link className={styles.cardTitleLink} to={pagePath} onClick={(e) => e.stopPropagation()}>
{highlightMatch(plugin.name, query)}
</Link>
@@ -156,8 +171,8 @@ function PluginCard({
</div>
</div>
- <p className={styles.cardDesc}>
- {highlightMatch(plugin.description || "No description available.", query)}
+ <p className={styles.cardDesc} title={description}>
+ {highlightMatch(description, query)}
</p>
<div className={styles.cardMeta}>
@@ -198,22 +213,23 @@ function PluginCard({
))}
</div>
- {/* Updated is omitted while it equals Added: a fresh entry has nothing to say yet. */}
- {plugin.addedAt && (
- <div className={styles.cardDates}>
+ {/* Always rendered (empty when undated) so every card keeps the same row layout.
+ Updated is omitted while it equals Added: a fresh entry has nothing to say yet. */}
+ <div className={styles.cardDates}>
+ {plugin.addedAt && (
<span title={`Added to the catalog ${formatDate(plugin.addedAt)}`}>
Added {formatRelativeTime(plugin.addedAt) ?? formatDate(plugin.addedAt)}
</span>
- {plugin.updatedAt && plugin.updatedAt !== plugin.addedAt && (
- <>
- <span aria-hidden="true" className={styles.cardDatesSep}>·</span>
- <span title={`Last catalog change ${formatDate(plugin.updatedAt)}`}>
- Updated {formatRelativeTime(plugin.updatedAt) ?? formatDate(plugin.updatedAt)}
- </span>
- </>
- )}
- </div>
- )}
+ )}
+ {plugin.addedAt && plugin.updatedAt && plugin.updatedAt !== plugin.addedAt && (
+ <>
+ <span aria-hidden="true" className={styles.cardDatesSep}>·</span>
+ <span title={`Last catalog change ${formatDate(plugin.updatedAt)}`}>
+ Updated {formatRelativeTime(plugin.updatedAt) ?? formatDate(plugin.updatedAt)}
+ </span>
+ </>
+ )}
+ </div>
{onPick ? (
<button
@@ -238,55 +254,60 @@ function PluginCard({
{
<div className={styles.cardDetail}>
- {plugin.maintainer && (
- <div className={styles.metaRow}>
- <span className={styles.metaLabel}>Maintainer</span>
- <span className={styles.metaValue}>
- {plugin.maintainerSlug ? (
- <Link to={authorPagePath(plugin.maintainerSlug)} onClick={(e) => e.stopPropagation()}>
- {plugin.maintainer}
- </Link>
- ) : (
- plugin.maintainer
- )}
- </span>
- </div>
- )}
- {plugin.requiresHermes && (
- <div className={styles.metaRow}>
- <span className={styles.metaLabel}>Requires</span>
- <span className={styles.metaValue}>
- <code>hermes {plugin.requiresHermes}</code>
- </span>
- </div>
- )}
+ {/* Exactly three fixed-height fact rows so the install box and links land on the same
+ edge in every card: Maintainer, Pinned (+ Requires), Tools (capped, or a dash). */}
+ <div className={styles.metaRow}>
+ <span className={styles.metaLabel}>Maintainer</span>
+ <span className={styles.metaValue} title={plugin.maintainer || undefined}>
+ {plugin.maintainerSlug ? (
+ <Link to={authorPagePath(plugin.maintainerSlug)} onClick={(e) => e.stopPropagation()}>
+ {plugin.maintainer}
+ </Link>
+ ) : (
+ plugin.maintainer || <span className={styles.metaEmpty}>—</span>
+ )}
+ </span>
+ </div>
<div className={styles.metaRow}>
<span className={styles.metaLabel}>Pinned</span>
- <span className={styles.metaValue}>
+ <span
+ className={styles.metaValue}
+ title={plugin.requiresHermes ? `${plugin.sha} · requires hermes ${plugin.requiresHermes}` : plugin.sha}
+ >
<a
href={pinUrl(plugin)}
target="_blank"
rel="noopener noreferrer"
onClick={(e) => e.stopPropagation()}
className={styles.shaLink}
- title={plugin.sha}
>
<code>{plugin.version ? `${plugin.version} @ ${plugin.shaShort}` : plugin.shaShort}</code> ↗
</a>
+ {plugin.requiresHermes && (
+ <>
+ <span aria-hidden="true" className={styles.cardDatesSep}> · </span>
+ <code>hermes {plugin.requiresHermes}</code>
+ </>
+ )}
</span>
</div>
- {caps.providesTools?.length ? (
- <div className={styles.metaRow}>
- <span className={styles.metaLabel}>Tools</span>
- <span className={styles.chipList}>
- {caps.providesTools.map((t) => (
+ <div className={styles.metaRow}>
+ <span className={styles.metaLabel}>Tools</span>
+ {toolChips.shown.length ? (
+ <span className={styles.chipList} title={caps.providesTools?.join(", ")}>
+ {toolChips.shown.map((t) => (
<code key={t} className={styles.envChip}>
{t}
</code>
))}
+ {toolChips.hidden > 0 && (
+ <code className={`${styles.envChip} ${styles.moreChip}`}>+{toolChips.hidden}</code>
+ )}
</span>
- </div>
- ) : null}
+ ) : (
+ <span className={`${styles.metaValue} ${styles.metaEmpty}`}>—</span>
+ )}
+ </div>
<div className={styles.installHint}>
<code>{plugin.installCommand}</code>
<CopyButton text={plugin.installCommand} />
diff --git a/website/src/pages/plugins/styles.module.css b/website/src/pages/plugins/styles.module.css
index 850dad62c1c..e18d5ff8271 100644
--- a/website/src/pages/plugins/styles.module.css
+++ b/website/src/pages/plugins/styles.module.css
@@ -440,6 +440,7 @@
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
+ grid-auto-rows: 1fr;
gap: 0.75rem;
}
@@ -454,8 +455,14 @@
}
}
+/* Every card in a grid shares one height (grid-auto-rows: 1fr); the column flex lets
+ .cardDetail sink to the bottom edge so install boxes and links line up across a row. */
.card {
position: relative;
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ min-width: 0;
border: 1px solid rgba(255, 255, 255, 0.05);
border-radius: 10px;
overflow: hidden;
@@ -489,16 +496,43 @@
opacity: 1;
}
-.cardImage {
+/* Banner slot: a fixed 120px strip whether the entry ships an image or not. */
+.cardImage,
+.cardImagePlaceholder {
display: block;
width: 100%;
- aspect-ratio: 2 / 1;
- object-fit: cover;
+ height: 120px;
+ flex: 0 0 120px;
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
+}
+
+.cardImage {
+ object-fit: cover;
+ object-position: center;
background: rgba(255, 255, 255, 0.02);
}
+/* No banner: the tier tint (inline gradient) with the category glyph, muted so it reads as a
+ deliberate blank rather than a missing image. */
+.cardImagePlaceholder {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.cardImagePlaceholderIcon {
+ font-size: 2.2rem;
+ line-height: 1;
+ opacity: 0.45;
+ filter: saturate(0.6);
+ user-select: none;
+}
+
.cardInner {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
padding: 1rem 1rem 0.85rem 1.15rem;
}
@@ -519,19 +553,25 @@
.cardTitleGroup {
display: flex;
- align-items: flex-start;
+ align-items: center;
justify-content: space-between;
+ flex-wrap: nowrap;
gap: 0.5rem;
flex: 1;
min-width: 0;
}
+/* One line: a long name gets an ellipsis, the pills never wrap under it. */
.cardTitle {
font-size: 0.92rem;
font-weight: 600;
line-height: 1.3;
margin: 0;
- word-break: break-word;
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
color: var(--ifm-font-color-base);
}
@@ -564,29 +604,58 @@
margin-top: 0.1rem;
}
+/* Three lines, always: long copy is clamped with an ellipsis (full text in the title attribute),
+ short copy reserves the same three lines so the rows below start at one offset. */
.cardDesc {
font-size: 0.82rem;
line-height: 1.55;
color: var(--ifm-font-color-secondary, #9a968e);
margin: 0 0 0.6rem;
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ min-height: calc(3 * 1.55em);
}
-
-.cardMeta {
+/* Chip rows stay one line; whatever does not fit fades out at the right edge instead of
+ wrapping or clipping mid-glyph. */
+.cardMeta,
+.chipList {
display: flex;
align-items: center;
+ flex-wrap: nowrap;
+ overflow: hidden;
+ min-width: 0;
+ -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
+ mask-image: linear-gradient(to right, #000 85%, transparent);
+}
+
+.cardMeta {
gap: 0.35rem;
- flex-wrap: wrap;
+ height: 1.5rem;
}
-/* Added / Updated line from the catalog's git history. */
+.cardMeta > * {
+ flex-shrink: 0;
+}
+
+/* Added / Updated line from the catalog's git history. Always one line tall, even when the
+ entry is undated, so the button below sits at the same offset on every card. */
.cardDates {
- display: flex;
- flex-wrap: wrap;
- gap: 0.35rem;
+ display: block;
+ height: 1.1rem;
margin-top: 0.5rem;
font-size: 0.7rem;
+ line-height: 1.1rem;
color: var(--ifm-color-emphasis-500);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.cardDates > * + * {
+ margin-left: 0.35rem;
}
.cardDatesSep {
@@ -624,17 +693,24 @@
border: 1px solid rgba(96, 165, 250, 0.1);
}
+/* Sinks to the card's bottom edge so install boxes and links align across a grid row; the
+ margin on .pickBtn keeps a floor on the gap above it in the tallest card. */
.cardDetail {
- margin-top: 0.75rem;
+ margin-top: auto;
padding-top: 0.7rem;
border-top: 1px solid rgba(255, 255, 255, 0.04);
}
+/* Fixed-height fact rows (exactly three per card: Maintainer, Pinned, Tools). */
.metaRow {
display: flex;
- align-items: flex-start;
+ align-items: center;
gap: 0.5rem;
+ height: 1.4rem;
margin-bottom: 0.3rem;
+ overflow: hidden;
+ white-space: nowrap;
+ min-width: 0;
}
.metaLabel {
@@ -645,12 +721,20 @@
color: var(--ifm-font-color-secondary);
opacity: 0.5;
min-width: 4.5rem;
- padding-top: 0.15rem;
+ flex-shrink: 0;
}
.metaValue {
font-size: 0.78rem;
color: var(--ifm-font-color-base);
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.metaEmpty {
+ opacity: 0.35;
}
.metaValue code {
@@ -662,9 +746,32 @@
}
.chipList {
- display: flex;
- flex-wrap: wrap;
gap: 0.3rem;
+ flex: 1;
+}
+
+/* Tool chips squeeze (ellipsis each) before the row overflows, so the "+N" tail stays visible
+ even when three long tool names cannot fit side by side. */
+.chipList .envChip {
+ white-space: nowrap;
+ flex: 0 1 auto;
+ min-width: 4rem;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.cardMeta .envChip {
+ white-space: nowrap;
+ flex-shrink: 0;
+}
+
+/* "+N" tail on a capped tool list; hover the row for the full list. */
+.chipList .moreChip {
+ flex-shrink: 0;
+ min-width: 0;
+ color: var(--ifm-font-color-secondary);
+ border-style: dashed;
+ border-color: rgba(255, 255, 255, 0.22);
}
.shaLink {
@@ -695,13 +802,10 @@
background: none;
padding: 0;
flex: 1;
- overflow-x: auto;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
white-space: nowrap;
- scrollbar-width: none;
-}
-
-.installHint code::-webkit-scrollbar {
- display: none;
}
.copyBtn {
@@ -1112,6 +1216,7 @@
display: block;
width: 100%;
margin-top: 0.5rem;
+ margin-bottom: 0.75rem;
padding: 0.45rem 0.75rem;
border: 1px solid var(--ifm-color-primary);
border-radius: 8px;
@@ -1294,6 +1399,20 @@ a.pickBtn {
border-color: rgba(110, 79, 0, 0.22);
}
+[data-theme="light"] .cardImage,
+[data-theme="light"] .cardImagePlaceholder {
+ border-bottom-color: rgba(28, 30, 33, 0.1);
+}
+
+[data-theme="light"] .chipList .moreChip {
+ border-color: rgba(28, 30, 33, 0.35);
+ color: #525860;
+}
+
+[data-theme="light"] .metaEmpty {
+ opacity: 0.6;
+}
+
[data-theme="light"] .copyBtn,
[data-theme="light"] .copyBtn:hover {
border-color: rgba(110, 79, 0, 0.35);