fix(webui): align catalog headings and simplify skill labels
Use the existing inline section-heading layout to clear standalone title spacing in Apps, align the count with its heading, and reduce excess header height. Drop decorative count badges and uppercase skill group labels while preserving catalog filtering and actions.
This commit is contained in:
1 parent
ddf4eb5054
commit
66370b170e
3 files changed
+51
-5
No files matched your search
@@ -151,10 +151,10 @@ export function SkillsCatalogSettings({ skills }: { skills: SkillSummary[] }) {
|
||||
{groupedSkills.map((group) => (
|
||||
<section key={group.key} className="space-y-1">
|
||||
<div className="flex items-center gap-2 px-2 py-1.5">
|
||||
<h2 className="text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground">
|
||||
<h2 className="text-[13px] font-medium leading-5 text-muted-foreground">
|
||||
{group.label}
|
||||
</h2>
|
||||
<span className="text-[11px] tabular-nums text-muted-foreground/60">
|
||||
<span className="text-[12px] leading-5 tabular-nums text-muted-foreground/60">
|
||||
{group.skills.length}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -291,13 +291,13 @@ export function AppsCatalogSettings({
|
||||
) : null}
|
||||
|
||||
<section className="rounded-panel bg-settings-surface px-3 py-3 sm:px-4">
|
||||
<div className="flex items-center justify-between border-b border-border/45 pb-3">
|
||||
<div className="settings-section-heading border-b border-border/45 pb-2">
|
||||
<SettingsSectionTitle>
|
||||
{filter === "mcp"
|
||||
? tx("settings.apps.mcpTools", "MCP tools")
|
||||
: tx("settings.apps.featured", "Tools")}
|
||||
</SettingsSectionTitle>
|
||||
<span className="rounded-full bg-muted px-2.5 py-1 text-[12px] font-medium text-muted-foreground">
|
||||
<span className="text-[12px] tabular-nums text-muted-foreground">
|
||||
{items.length}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { act, fireEvent, screen, waitFor, within } from "@testing-library/react";
|
||||
import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
|
||||
import { expect, it, vi } from "vitest";
|
||||
import { installedMcpPresetsFromPayload } from "@/lib/mcp-preset-events";
|
||||
import { SkillsCatalogSettings } from "@/components/settings/SkillsCatalogSettings";
|
||||
import { ClientProvider } from "@/providers/ClientProvider";
|
||||
import { requestMutationMock, jsonResponse, settingsPayload, renderSettingsView, installSettingsViewTestHooks } from "@/tests/settings-test-utils";
|
||||
|
||||
|
||||
@@ -162,6 +164,50 @@ describe("Settings system domains", () => {
|
||||
expect(screen.getByTestId("settings-section-transition")).not.toHaveClass("settings-feature-page");
|
||||
});
|
||||
|
||||
it("uses the inline section heading layout to align Apps titles and counts", async () => {
|
||||
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
|
||||
const url = String(input);
|
||||
if (url === "/api/settings") return jsonResponse(settingsPayload());
|
||||
if (url === "/api/settings/cli-apps") return jsonResponse({ apps: [installedAnyGen], installed_count: 1 });
|
||||
if (url === "/api/settings/mcp-presets") return jsonResponse({ presets: [], installed_count: 0 });
|
||||
return jsonResponse({});
|
||||
}));
|
||||
renderSettingsView({ initialSection: "apps", initialSettings: settingsPayload() });
|
||||
await screen.findByText("AnyGen");
|
||||
const title = screen.getByRole("heading", { name: "Tools" });
|
||||
expect(title.parentElement).toHaveClass("settings-section-heading");
|
||||
expect(title.nextElementSibling).toHaveTextContent("1");
|
||||
expect(title.nextElementSibling).toHaveClass("tabular-nums");
|
||||
expect(title.nextElementSibling).not.toHaveClass("rounded-full", "bg-muted");
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "MCP", exact: true }));
|
||||
const mcpTitle = screen.getByRole("heading", { name: "MCP tools" });
|
||||
expect(mcpTitle.parentElement).toHaveClass("settings-section-heading");
|
||||
expect(mcpTitle.nextElementSibling).toHaveTextContent("0");
|
||||
});
|
||||
|
||||
it("keeps skill group labels natural without changing grouping or filtering", () => {
|
||||
render(<ClientProvider client={{} as never} token="tok">
|
||||
<SkillsCatalogSettings skills={[
|
||||
{ name: "pr-review", description: "Review pull requests", source: "workspace", available: true },
|
||||
{ name: "cron", description: "Schedule reminders", source: "builtin", available: true },
|
||||
{ name: "team-guide", description: "Team conventions", source: "team", available: true },
|
||||
]} />
|
||||
</ClientProvider>);
|
||||
for (const name of ["Custom", "Built-in", "Other"]) {
|
||||
const title = screen.getByRole("heading", { name, exact: true });
|
||||
expect(title).toHaveClass("text-[13px]", "font-medium", "leading-5");
|
||||
expect(title).not.toHaveClass("uppercase", "tracking-[0.08em]");
|
||||
expect(title.nextElementSibling).toHaveTextContent("1");
|
||||
expect(title.nextElementSibling).toHaveClass("leading-5");
|
||||
}
|
||||
fireEvent.change(screen.getByRole("textbox", { name: "Search installed skills" }), { target: { value: "cron" } });
|
||||
expect(screen.queryByRole("heading", { name: "Custom" })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("heading", { name: "Other" })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("heading", { name: "Built-in" })).toBeVisible();
|
||||
expect(screen.getByRole("button", { name: "Open details for cron" })).toBeVisible();
|
||||
});
|
||||
|
||||
it("opens a chat from the standalone automations empty state", async () => {
|
||||
const onBackToChat = vi.fn();
|
||||
vi.stubGlobal("fetch", vi.fn(async (input: RequestInfo | URL) => {
|
||||
|
||||
Reference in new issue
Block a user