Files
SnapOtter/apps/landing/src/components/ToolGrid.astro
T
SnapOtterandGitHub 17726ae59d docs: multi-modality rebrand, 2.0 architecture accuracy, and full OpenAPI coverage (#254)
* docs: rebrand from image-only to multi-modality across docs and metadata

SnapOtter expanded from image-only to 157 tools across 5 modalities
(image, video, audio, document/PDF, data). Update all product-level
copy, metadata, and i18n that still framed it as an image-only tool.

- README, package.json, root llms.txt: multi-modality framing, 157 tools
- OpenAPI info + tags, generated /llms.txt tagline (docs.ts)
- VitePress docs site: hero, getting-started, architecture, security,
  deployment, configuration, developer, supported-formats
- i18n: 10 product keys across all 21 locales (hero, app description,
  privacy notes, AI features, progress messages, getting-started)
- web/demo/landing meta + privacy copy, COMMUNITY_GUIDE, .env.example

Stale tool counts (53/50+/52/70+/35) corrected to 157 throughout.
Database/container deployment claims left unchanged (out of scope).

* docs: fix stale post-rebrand test assertions and README language list

- tests/e2e-docs/homepage.spec.ts: assert the current docs homepage (file toolkit, 157 tools, 5 modalities) instead of the old image-only strings
- tests/unit/api/docs-route.test.ts: sync the reproduced llms.txt tagline with docs.ts
- README.md: 21 languages with the correct list (add Swedish and Chinese Traditional, drop Czech which is not supported)

* docs: correct 2.0 architecture references (Postgres 17 + Redis 8, 3-container stack)

The docs and metadata still described the 1.x stack (SQLite, single container, p-queue). Update them to the current 2.0 reality.

- README: replace the broken single-container `docker run` quick-start with the real Docker Compose stack (app + Postgres 17 + Redis 8); fix the "no Redis, no Postgres" feature bullet
- package.json: description no longer claims a single container
- apps/docs: rewrite database.md for Postgres; configuration.md DB_PATH -> DATABASE_URL + REDIS_URL; architecture.md SQLite/p-queue/better-sqlite3 -> Postgres/BullMQ/pg and add media-engine + doc-engine; developer/security/deployment/docker-tags/getting-started/contributing compose examples now include postgres + redis; index.md + api/ai.md AI count 16 -> 19
- SECURITY.md: Drizzle (SQLite) -> (PostgreSQL)
- landing: enterprise/FeatureHighlights single-container wording; TrustSignals/ToolGrid 150+ -> 157 (dynamic); Pricing/FAQ 15 -> 19 AI tools

* docs(api): document all video, audio, document, and data tool endpoints in OpenAPI

The spec covered only image tools; the Scalar UI and the generated /llms.txt and /llms-full.txt inherited that gap. Add the 104 missing tool endpoints so the API docs match the code.

- Video: 29 endpoints (most long/async; auto-subtitles is AI)
- Audio: 17 (transcribe-audio is AI)
- Document/PDF: 36 (ocr-pdf is AI; conversions are long/async)
- Data: 10
- Image: 12 newer tools (background-replace, blur-background AI; histogram/lqip-placeholder/sprite-sheet custom responses; barcode-generate uses a JSON body)

Each schema is derived from the tool's Zod validator and executionHint (fast -> 200, long -> 202+SSE, AI adds 501 FeatureNotInstalledError, multi-file inputs as arrays), referencing the existing shared schemas. Tool path entries: 64 -> 168. Spec parses as valid YAML with no duplicate paths and only known $refs.
2026-06-16 18:04:52 +08:00

194 lines
7.2 KiB
Plaintext

---
import { CATEGORIES, TOOLS } from "@snapotter/shared";
import * as lucideIcons from "lucide";
import SectionHeading from "./SectionHeading.astro";
const toolCount = TOOLS.length;
const categoryMap = new Map(CATEGORIES.map((c) => [c.id, c]));
const modalities = [
{ id: "all", label: "All", count: TOOLS.length },
{ id: "image", label: "Image", count: TOOLS.filter((t) => t.modality === "image").length },
{ id: "video", label: "Video", count: TOOLS.filter((t) => t.modality === "video").length },
{ id: "audio", label: "Audio", count: TOOLS.filter((t) => t.modality === "audio").length },
{
id: "document,file",
label: "PDF & Files",
count: TOOLS.filter((t) => t.modality === "document" || t.modality === "file").length,
},
];
function renderIcon(iconName: string): string {
const iconData = (lucideIcons as Record<string, unknown>)[iconName];
if (!iconData || !Array.isArray(iconData)) return "";
return iconData
.map(([tag, attrs]: [string, Record<string, string>]) => {
const attrStr = Object.entries(attrs)
.map(([k, v]) => `${k}="${v}"`)
.join(" ");
return `<${tag} ${attrStr}/>`;
})
.join("");
}
---
<section class="bg-background-alt px-6 py-20 md:py-28" id="features">
<SectionHeading
title="One platform. Every file tool."
subtitle={`Browse ${toolCount} self-hosted tools across image, video, audio, documents, and data.`}
/>
<div class="mx-auto max-w-6xl">
<!-- Modality pills -->
<div class="flex flex-wrap items-center justify-center gap-2" id="modality-pills">
{modalities.map((m) => (
<button
type="button"
data-modality={m.id}
class:list={[
"tool-pill shrink-0 rounded-full px-4 py-1.5 text-sm font-medium transition-colors",
m.id === "all"
? "bg-primary text-white"
: "border border-border bg-surface hover:bg-background-emphasis",
]}
>
{m.label} ({m.count})
</button>
))}
</div>
<!-- Category pills -->
<div class="mt-3 flex flex-wrap items-center justify-center gap-2" id="category-pills">
{CATEGORIES.map((cat) => {
const count = TOOLS.filter((t) => t.category === cat.id).length;
return (
<button
type="button"
data-category={cat.id}
class="tool-pill shrink-0 rounded-full border border-border bg-surface px-3 py-1 text-xs font-medium transition-colors hover:bg-background-emphasis"
>
{cat.name} ({count})
</button>
);
})}
</div>
<!-- Result count -->
<p class="mt-6 text-center text-sm text-muted" id="tool-count">
Showing {toolCount} of {toolCount} tools
</p>
<!-- Tool grid -->
<div class="mt-8 grid gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5" id="tool-grid">
{TOOLS.map((tool) => {
const cat = categoryMap.get(tool.category);
return (
<a
href={`/tools/${tool.id}`}
class="tool-card flex flex-col items-center rounded-xl border border-border bg-surface px-4 py-5 text-center no-underline transition-all"
data-name={tool.name.toLowerCase()}
data-desc={tool.description.toLowerCase()}
data-modality={tool.modality}
data-category={tool.category}
style={{ "--cat-color": cat?.color } as any}
>
<svg
class="mb-2.5 h-7 w-7 shrink-0"
style={{ color: cat?.color }}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
set:html={renderIcon(tool.icon)}
/>
<span class="text-sm font-semibold text-foreground">{tool.name}</span>
<p class="mt-1 text-xs leading-relaxed text-muted line-clamp-2">{tool.description}</p>
</a>
);
})}
</div>
<!-- Empty state -->
<p class="mt-8 hidden text-center text-muted" id="tool-empty">
No tools match these filters.
</p>
<!-- Browse all link -->
<div class="mt-10 text-center">
<a href="/tools" class="inline-flex items-center gap-2 text-sm font-medium text-primary hover:underline">
Browse full tool catalog
<svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg>
</a>
</div>
</div>
</section>
<script is:inline>
(function () {
var grid = document.getElementById("tool-grid");
var countEl = document.getElementById("tool-count");
var emptyEl = document.getElementById("tool-empty");
var cards = grid.querySelectorAll(".tool-card");
var total = cards.length;
var activeModality = "all";
var activeCategory = "";
function updatePillStyles() {
document.querySelectorAll("#modality-pills .tool-pill").forEach(function (btn) {
var m = btn.getAttribute("data-modality");
if (m === activeModality) {
btn.className = "tool-pill shrink-0 rounded-full px-4 py-1.5 text-sm font-medium transition-colors bg-primary text-white";
} else {
btn.className = "tool-pill shrink-0 rounded-full px-4 py-1.5 text-sm font-medium transition-colors border border-border bg-surface hover:bg-background-emphasis";
}
});
document.querySelectorAll("#category-pills .tool-pill").forEach(function (btn) {
var c = btn.getAttribute("data-category");
if (c === activeCategory) {
btn.className = "tool-pill shrink-0 rounded-full px-3 py-1 text-xs font-medium transition-colors bg-primary text-white";
} else {
btn.className = "tool-pill shrink-0 rounded-full border border-border bg-surface px-3 py-1 text-xs font-medium transition-colors hover:bg-background-emphasis";
}
});
}
function filter() {
var visible = 0;
cards.forEach(function (card) {
var mod = card.getAttribute("data-modality") || "";
var cat = card.getAttribute("data-category") || "";
var matchMod = activeModality === "all" || activeModality.split(",").indexOf(mod) !== -1;
var matchCat = !activeCategory || cat === activeCategory;
if (matchMod && matchCat) {
card.style.display = "";
visible++;
} else {
card.style.display = "none";
}
});
countEl.textContent = "Showing " + visible + " of " + total + " tools";
emptyEl.style.display = visible === 0 ? "block" : "none";
grid.style.display = visible === 0 ? "none" : "";
}
document.querySelectorAll("#modality-pills .tool-pill").forEach(function (btn) {
btn.addEventListener("click", function () {
activeModality = btn.getAttribute("data-modality");
updatePillStyles();
filter();
});
});
document.querySelectorAll("#category-pills .tool-pill").forEach(function (btn) {
btn.addEventListener("click", function () {
var cat = btn.getAttribute("data-category");
activeCategory = activeCategory === cat ? "" : cat;
updatePillStyles();
filter();
});
});
})();
</script>