mirror of
https://github.com/openclaw/clawhub.git
synced 2026-08-14 00:47:57 +00:00
fix: default homepage Plugins to Featured (#3434)
Default the homepage Plugins catalog to Featured when switching from the Skills-only Trending tab, while preserving explicit valid plugin tabs and existing Skills behavior.\n\nCloses #3433
This commit is contained in:
@@ -311,7 +311,9 @@ describe("HomeListingSection", () => {
|
||||
render(<HomeListingSection initialListing={initialTrending([], false, "unavailable")} />);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Plugins" }));
|
||||
expect(screen.getByRole("tab", { name: "New" }).getAttribute("aria-selected")).toBe("true");
|
||||
expect(screen.getByRole("tab", { name: "Featured" }).getAttribute("aria-selected")).toBe(
|
||||
"true",
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Skills" }));
|
||||
expect(screen.getByRole("tab", { name: "Featured" }).getAttribute("aria-selected")).toBe(
|
||||
@@ -326,12 +328,14 @@ describe("HomeListingSection", () => {
|
||||
expect(screen.getByText(/eligible activity in the current 24-hour window/i)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("shows Featured, Official, and New for plugins but never plugin Trending", async () => {
|
||||
it("defaults Plugins to Featured, preserves explicit New, and returns to Skills Trending", async () => {
|
||||
render(<HomeListingSection initialListing={initialTrending([])} />);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Plugins" }));
|
||||
|
||||
expect(screen.getByRole("tab", { name: "New" }).getAttribute("aria-selected")).toBe("true");
|
||||
expect(screen.getByRole("tab", { name: "Featured" }).getAttribute("aria-selected")).toBe(
|
||||
"true",
|
||||
);
|
||||
expect(screen.getAllByRole("tab").map((tab) => tab.textContent)).toEqual([
|
||||
"Featured",
|
||||
"Official",
|
||||
@@ -339,12 +343,25 @@ describe("HomeListingSection", () => {
|
||||
]);
|
||||
expect(screen.queryByRole("tab", { name: "Trending" })).toBeNull();
|
||||
expect(screen.queryByRole("tab", { name: "Top" })).toBeNull();
|
||||
await waitFor(() =>
|
||||
expect(fetchPluginCatalogMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ featured: true }),
|
||||
),
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("tab", { name: "New" }));
|
||||
await waitFor(() =>
|
||||
expect(convexQueryMock).toHaveBeenCalledWith(
|
||||
"packages:listPublicNewPluginsPage",
|
||||
expect.any(Object),
|
||||
),
|
||||
);
|
||||
expect(screen.getByRole("tab", { name: "New" }).getAttribute("aria-selected")).toBe("true");
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Skills" }));
|
||||
expect(screen.getByRole("tab", { name: "Trending" }).getAttribute("aria-selected")).toBe(
|
||||
"true",
|
||||
);
|
||||
});
|
||||
|
||||
it("uses the native New, Featured, and Official eligibility contracts", async () => {
|
||||
|
||||
@@ -25,7 +25,6 @@ import { fetchPluginCatalog, type PackageListItem } from "../lib/packageApi";
|
||||
import { buildPluginDetailHref } from "../lib/pluginRoutes";
|
||||
import { presentationTitle } from "../lib/presentationTitle";
|
||||
import { PUBLIC_CATALOG_NAME_PREVIEW_LENGTH, truncateText } from "../lib/truncateText";
|
||||
import { MarketplaceIcon } from "./MarketplaceIcon";
|
||||
import {
|
||||
BrowseControlsDivider,
|
||||
BrowseCategorySelect,
|
||||
@@ -34,6 +33,7 @@ import {
|
||||
BrowseSearchTrigger,
|
||||
useBrowseSearchDisclosure,
|
||||
} from "./BrowseControls";
|
||||
import { MarketplaceIcon } from "./MarketplaceIcon";
|
||||
import { OfficialBadge } from "./OfficialBadge";
|
||||
import { BrowseResultsSkeleton } from "./skeletons/BrowseResultsSkeleton";
|
||||
import { Badge } from "./ui/badge";
|
||||
@@ -567,7 +567,13 @@ export function HomeListingSection({ initialListing = null }: HomeListingSection
|
||||
setKind(nextKind);
|
||||
setCategorySlug(undefined);
|
||||
setTab(
|
||||
nextKind === "skills" ? (canonicalTrendingUnavailable ? "featured" : "trending") : "new",
|
||||
nextKind === "skills"
|
||||
? canonicalTrendingUnavailable
|
||||
? "featured"
|
||||
: "trending"
|
||||
: tab === "trending"
|
||||
? "featured"
|
||||
: tab,
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user