Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(evals): plain text Show all link in the evaluator gallery (#18908)

Trang Nguyen084ea652342b
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.stories.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.stories.tsx
index c11c8856fe..7def109435 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.stories.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.stories.tsx
@@ -106,6 +106,22 @@ const safetySection: GallerySection = {
],
};
+const projectSection: GallerySection = {
+ key: "custom",
+ label: "Your templates",
+ description: "Start from a template this project already created.",
+ totalCount: 15,
+ templates: Array.from({ length: 15 }, (_, index) => ({
+ source: "custom" as const,
+ id: `evaluator-${index + 1}`,
+ name: `project-evaluator-${index + 1}`,
+ description: "Flags generations that miss the expected format.",
+ type: EvalTemplateTypeEnum.CODE,
+ updatedAt: new Date("2026-10-01T00:00:00.000Z"),
+ version: 1,
+ })),
+};
+
const meta = preview.meta({ component: EvaluatorGallerySection });
export const Collapsed = meta.story({
@@ -118,6 +134,16 @@ export const Collapsed = meta.story({
render: StatefulEvaluatorGallerySection,
});
+export const YourTemplatesCollapsed = meta.story({
+ args: {
+ section: projectSection,
+ expanded: false,
+ onExpandedChange: fn(),
+ onSelectTemplate: fn(),
+ },
+ render: StatefulEvaluatorGallerySection,
+});
+
export const Expanded = meta.story({
args: {
section: listSection,
diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.tsx
index 8f277a2194..2bdb91694c 100644
--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.tsx
+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.tsx
@@ -1,4 +1,4 @@
-import { DropdownIndicator } from "@/src/components/design-system/DropdownIndicator/DropdownIndicator";
+import { Button } from "@/src/components/design-system/Button/Button";
import { InfoTooltip } from "@/src/components/ui/InfoTooltip/InfoTooltip";
import { EvaluatorGallerySectionHeader } from "@/src/features/evals/v2/components/EvaluatorGallerySectionHeader/EvaluatorGallerySectionHeader";
@@ -71,19 +71,40 @@ export function EvaluatorGallerySection({
/>
)}
{canToggle ? (
- <button
- type="button"
- className="text-muted-foreground hover:text-foreground flex w-fit items-center gap-1.5 px-1 text-sm"
- onClick={handleToggleExpanded}
- >
- <DropdownIndicator direction={expanded ? "up" : "down"} nudge />
- {expanded ? "Show fewer" : `Show all ${totalCount} templates`}
- </button>
+ <GalleryShowAllToggle
+ expanded={expanded}
+ totalCount={totalCount}
+ isProjectRows={section.key === EVALUATOR_GALLERY_PROJECT_SECTION_KEY}
+ onToggle={handleToggleExpanded}
+ />
) : null}
</section>
);
}
+type GalleryShowAllToggleProps = {
+ expanded: boolean;
+ totalCount: number;
+ isProjectRows: boolean;
+ onToggle: () => void;
+};
+
+/** Text link under a section; under project rows it cancels the gap, since rows end in their own padding. */
+function GalleryShowAllToggle({
+ expanded,
+ totalCount,
+ isProjectRows,
+ onToggle,
+}: GalleryShowAllToggleProps) {
+ const label = expanded ? "Show fewer" : `Show all ${totalCount} templates`;
+
+ return (
+ <div className={isProjectRows ? "-mt-3" : undefined}>
+ <Button variant="text" size="sm" text={label} onClick={onToggle} />
+ </div>
+ );
+}
+
type GalleryCategoryBlockProps = {
section: GallerySection;
templates: GalleryTemplate[];