mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: show modality starting points in landing command center (#387)
This commit is contained in:
@@ -567,17 +567,20 @@ const safeDefaultToolIdsJson = JSON.stringify(defaultToolIds).replace(/</g, "\\u
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderDefault(): void {
|
function renderDefault(): void {
|
||||||
const defaultTools = tools.filter(
|
const matchingTools = tools.filter(matchesActiveModality);
|
||||||
(tool) => defaultToolIdSet.has(tool.id) && matchesActiveModality(tool),
|
const defaultTools =
|
||||||
);
|
activeModality === "all"
|
||||||
const fallbackTools =
|
? tools.filter((tool) => defaultToolIdSet.has(tool.id))
|
||||||
defaultTools.length > 0 ? defaultTools : tools.filter(matchesActiveModality).slice(0, 12);
|
: matchingTools.slice(0, 12);
|
||||||
const modalityName = modalityLabels.get(activeModality) ?? "All";
|
const modalityName = modalityLabels.get(activeModality) ?? "All";
|
||||||
|
|
||||||
titleNode.textContent =
|
titleNode.textContent =
|
||||||
activeModality === "all" ? "Suggested starting points" : `${modalityName} starting points`;
|
activeModality === "all" ? "Suggested starting points" : `${modalityName} starting points`;
|
||||||
countNode.textContent = `${fallbackTools.length} curated tools`;
|
countNode.textContent =
|
||||||
resultContainer.innerHTML = fallbackTools.map((tool) => renderCard(tool)).join("");
|
activeModality === "all"
|
||||||
|
? `${defaultTools.length} curated tools`
|
||||||
|
: `${defaultTools.length} of ${matchingTools.length} tools`;
|
||||||
|
resultContainer.innerHTML = defaultTools.map((tool) => renderCard(tool)).join("");
|
||||||
resultContainer.classList.remove("hidden");
|
resultContainer.classList.remove("hidden");
|
||||||
hideEmptyState();
|
hideEmptyState();
|
||||||
setRequestLinks("");
|
setRequestLinks("");
|
||||||
|
|||||||
@@ -80,6 +80,19 @@ test.describe("Landing Homepage", () => {
|
|||||||
expect(requestHref).toContain("title=Tool+request%3A+convert+figma+file+to+layered+psd");
|
expect(requestHref).toContain("title=Tool+request%3A+convert+figma+file+to+layered+psd");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("tool command center shows multiple starting points for a selected modality", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
await page.getByRole("button", { name: /Video 57/ }).click();
|
||||||
|
|
||||||
|
const results = page.locator("#tool-command-results");
|
||||||
|
await expect(page.getByText("Video starting points")).toBeVisible();
|
||||||
|
await expect(page.getByText(/12 of 57 tools/)).toBeVisible();
|
||||||
|
await expect(results.getByRole("link", { name: /Convert Video/ })).toBeVisible();
|
||||||
|
await expect(results.getByRole("link", { name: /Compress Video/ })).toBeVisible();
|
||||||
|
await expect(results.getByRole("link", { name: /Trim Video/ })).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
test("enterprise section renders eyebrow and feature cards", async ({ page }) => {
|
test("enterprise section renders eyebrow and feature cards", async ({ page }) => {
|
||||||
await expect(page.getByText("Built for enterprise deployment.")).toBeVisible();
|
await expect(page.getByText("Built for enterprise deployment.")).toBeVisible();
|
||||||
await expect(page.getByText("Enterprise-grade security")).toBeVisible();
|
await expect(page.getByText("Enterprise-grade security")).toBeVisible();
|
||||||
|
|||||||
Reference in New Issue
Block a user