mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat: polish home page UI -- card borders, colored icons, 3-col grid, Cmd+K hint
- Tool cards: subtle border, modality-colored icon backgrounds, better hover - Category headers: bottom border separator for visual structure - Grid: 3 columns on lg screens instead of 2 - Search bar: Cmd+K keyboard shortcut hint, tighter styling - Tabs: softer styling, count separated from label - Recent pills: subtler border style instead of bright orange - Tighter vertical spacing throughout - Wider max-width (max-w-6xl) for better use of screen space
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import type { Tool } from "@snapotter/shared";
|
import type { Tool } from "@snapotter/shared";
|
||||||
import { MODALITIES, PYTHON_SIDECAR_TOOLS, TOOL_BUNDLE_MAP } from "@snapotter/shared";
|
import { MODALITIES, PYTHON_SIDECAR_TOOLS, TOOL_BUNDLE_MAP } from "@snapotter/shared";
|
||||||
import { Clock, Download, FileImage, Loader2, Star } from "lucide-react";
|
import { Clock, Download, FileImage, Loader2 } from "lucide-react";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { useTranslation } from "@/contexts/i18n-context";
|
import { useTranslation } from "@/contexts/i18n-context";
|
||||||
@@ -38,12 +38,14 @@ export function ToolCard({ tool, variant = "compact", showModalityBadge }: ToolC
|
|||||||
return bundle?.status === "installed" ? "installed" : "not_installed";
|
return bundle?.status === "installed" ? "installed" : "not_installed";
|
||||||
}, [isAiTool, tool.id, bundles, installing, queued]);
|
}, [isAiTool, tool.id, bundles, installing, queued]);
|
||||||
|
|
||||||
|
const modalityColor = MODALITY_COLOR_MAP[tool.modality] ?? "#6B7280";
|
||||||
|
|
||||||
const modalityBadge = showModalityBadge ? (
|
const modalityBadge = showModalityBadge ? (
|
||||||
<span
|
<span
|
||||||
className="text-[10px] px-1.5 py-0.5 rounded-full font-medium shrink-0"
|
className="text-[10px] px-1.5 py-0.5 rounded-full font-medium shrink-0"
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: `${MODALITY_COLOR_MAP[tool.modality] ?? "#6B7280"}20`,
|
backgroundColor: `${modalityColor}20`,
|
||||||
color: MODALITY_COLOR_MAP[tool.modality] ?? "#6B7280",
|
color: modalityColor,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{MODALITIES.find((m) => m.id === tool.modality)?.name ?? tool.modality}
|
{MODALITIES.find((m) => m.id === tool.modality)?.name ?? tool.modality}
|
||||||
@@ -52,20 +54,14 @@ export function ToolCard({ tool, variant = "compact", showModalityBadge }: ToolC
|
|||||||
|
|
||||||
const aiStatusIcon =
|
const aiStatusIcon =
|
||||||
aiStatus === "not_installed" ? (
|
aiStatus === "not_installed" ? (
|
||||||
<>
|
<Download className="h-3.5 w-3.5 text-muted-foreground shrink-0" aria-hidden="true" />
|
||||||
<Download className="h-3.5 w-3.5 text-muted-foreground" aria-hidden="true" />
|
|
||||||
<span className="sr-only">{t.a11y.notInstalled}</span>
|
|
||||||
</>
|
|
||||||
) : aiStatus === "queued" ? (
|
) : aiStatus === "queued" ? (
|
||||||
<>
|
<Clock className="h-3.5 w-3.5 text-muted-foreground shrink-0" aria-hidden="true" />
|
||||||
<Clock className="h-3.5 w-3.5 text-muted-foreground" aria-hidden="true" />
|
|
||||||
<span className="sr-only">{t.a11y.queued}</span>
|
|
||||||
</>
|
|
||||||
) : aiStatus === "installing" ? (
|
) : aiStatus === "installing" ? (
|
||||||
<>
|
<Loader2
|
||||||
<Loader2 className="h-3.5 w-3.5 text-muted-foreground animate-spin" aria-hidden="true" />
|
className="h-3.5 w-3.5 text-muted-foreground animate-spin shrink-0"
|
||||||
<span className="sr-only">{t.a11y.installing}</span>
|
aria-hidden="true"
|
||||||
</>
|
/>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
if (variant === "descriptive") {
|
if (variant === "descriptive") {
|
||||||
@@ -73,13 +69,16 @@ export function ToolCard({ tool, variant = "compact", showModalityBadge }: ToolC
|
|||||||
<Link
|
<Link
|
||||||
to={tool.route}
|
to={tool.route}
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex items-center gap-3 py-2.5 px-3 rounded-lg w-full transition-colors",
|
"flex items-start gap-3 p-3 rounded-lg border border-border/60 bg-card transition-all",
|
||||||
"hover:bg-muted",
|
"hover:border-border hover:shadow-sm",
|
||||||
tool.disabled && "opacity-50 pointer-events-none",
|
tool.disabled && "opacity-50 pointer-events-none",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="p-2 rounded-md bg-muted shrink-0">
|
<div
|
||||||
<IconComponent className="h-4 w-4 text-muted-foreground" />
|
className="p-2 rounded-lg shrink-0 mt-0.5"
|
||||||
|
style={{ backgroundColor: `${modalityColor}12`, color: modalityColor }}
|
||||||
|
>
|
||||||
|
<IconComponent className="h-5 w-5" />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
@@ -94,7 +93,7 @@ export function ToolCard({ tool, variant = "compact", showModalityBadge }: ToolC
|
|||||||
)}
|
)}
|
||||||
{aiStatusIcon}
|
{aiStatusIcon}
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-muted-foreground line-clamp-1">
|
<p className="text-xs text-muted-foreground mt-0.5 line-clamp-1">
|
||||||
{getToolDescription(t, tool.id, tool.description)}
|
{getToolDescription(t, tool.id, tool.description)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -103,35 +102,25 @@ export function ToolCard({ tool, variant = "compact", showModalityBadge }: ToolC
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="group flex items-center gap-3 relative">
|
<Link
|
||||||
<button
|
to={tool.route}
|
||||||
type="button"
|
className={cn(
|
||||||
className="opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity absolute -left-7 p-2"
|
"flex items-center gap-3 p-2.5 px-3 rounded-lg transition-colors",
|
||||||
title={t.toolCard.addToFavourites}
|
"hover:bg-muted",
|
||||||
aria-label={t.toolCard.addToFavourites}
|
tool.disabled && "opacity-50 pointer-events-none",
|
||||||
>
|
)}
|
||||||
<Star className="h-3 w-3 text-muted-foreground hover:text-yellow-500" />
|
>
|
||||||
</button>
|
<IconComponent className="h-5 w-5 text-muted-foreground shrink-0" />
|
||||||
<Link
|
<span className="text-sm font-medium text-foreground">
|
||||||
to={tool.route}
|
{getToolName(t, tool.id, tool.name)}
|
||||||
className={cn(
|
</span>
|
||||||
"flex items-center gap-3 py-2 px-3 rounded-lg w-full transition-colors",
|
{modalityBadge}
|
||||||
"hover:bg-muted",
|
{tool.experimental && (
|
||||||
tool.disabled && "opacity-50 pointer-events-none",
|
<span className="text-[10px] px-1.5 py-0.5 rounded bg-orange-100 text-orange-600 font-medium">
|
||||||
)}
|
{t.common.experimental}
|
||||||
>
|
|
||||||
<IconComponent className="h-5 w-5 text-muted-foreground" />
|
|
||||||
<span className="text-sm font-medium text-foreground">
|
|
||||||
{getToolName(t, tool.id, tool.name)}
|
|
||||||
</span>
|
</span>
|
||||||
{modalityBadge}
|
)}
|
||||||
{tool.experimental && (
|
{aiStatusIcon}
|
||||||
<span className="text-[10px] px-1.5 py-0.5 rounded bg-orange-100 text-orange-600 font-medium">
|
</Link>
|
||||||
{t.common.experimental}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
{aiStatusIcon}
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,16 +15,11 @@ import { getCategoryName, getToolName } from "@/lib/tool-i18n.js";
|
|||||||
import { cn } from "@/lib/utils.js";
|
import { cn } from "@/lib/utils.js";
|
||||||
import { useSettingsStore } from "@/stores/settings-store";
|
import { useSettingsStore } from "@/stores/settings-store";
|
||||||
|
|
||||||
// ── Constants ────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
interface TabDef {
|
interface TabDef {
|
||||||
key: string;
|
key: string;
|
||||||
label: string;
|
label: string;
|
||||||
modalityKey?: string; // maps to Tool.modality; undefined = "all"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Home Page ────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
export function HomePage() {
|
export function HomePage() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [activeTab, setActiveTab] = useState<string>("all");
|
const [activeTab, setActiveTab] = useState<string>("all");
|
||||||
@@ -39,8 +34,6 @@ export function HomePage() {
|
|||||||
fetchSettings();
|
fetchSettings();
|
||||||
}, [fetchSettings]);
|
}, [fetchSettings]);
|
||||||
|
|
||||||
// ── Tab definitions ──────────────────────────────────────────
|
|
||||||
|
|
||||||
const tabs: TabDef[] = useMemo(
|
const tabs: TabDef[] = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{ key: "all", label: t.homePage.all },
|
{ key: "all", label: t.homePage.all },
|
||||||
@@ -53,8 +46,6 @@ export function HomePage() {
|
|||||||
[t],
|
[t],
|
||||||
);
|
);
|
||||||
|
|
||||||
// ── Visible tools (exclude disabled + experimental unless enabled) ──
|
|
||||||
|
|
||||||
const visibleTools = useMemo(() => {
|
const visibleTools = useMemo(() => {
|
||||||
if (!loaded) return [];
|
if (!loaded) return [];
|
||||||
return TOOLS.filter((tool) => {
|
return TOOLS.filter((tool) => {
|
||||||
@@ -65,20 +56,14 @@ export function HomePage() {
|
|||||||
});
|
});
|
||||||
}, [disabledTools, experimentalEnabled, loaded]);
|
}, [disabledTools, experimentalEnabled, loaded]);
|
||||||
|
|
||||||
// ── Search (global, searches all tools regardless of active tab) ──
|
|
||||||
|
|
||||||
const searchResults = useFuseSearch(visibleTools, search);
|
const searchResults = useFuseSearch(visibleTools, search);
|
||||||
|
|
||||||
// ── Tab-filtered tools ──────────────────────────────────────
|
|
||||||
|
|
||||||
const tabTools = useMemo(() => {
|
const tabTools = useMemo(() => {
|
||||||
if (activeTab === "all") return visibleTools;
|
if (activeTab === "all") return visibleTools;
|
||||||
const modalityKey = activeTab === "data" ? "file" : activeTab;
|
const modalityKey = activeTab === "data" ? "file" : activeTab;
|
||||||
return visibleTools.filter((tool) => tool.modality === modalityKey);
|
return visibleTools.filter((tool) => tool.modality === modalityKey);
|
||||||
}, [visibleTools, activeTab]);
|
}, [visibleTools, activeTab]);
|
||||||
|
|
||||||
// ── Group by category for modality tabs ─────────────────────
|
|
||||||
|
|
||||||
const groupedTools = useMemo(() => {
|
const groupedTools = useMemo(() => {
|
||||||
const map = new Map<string, Tool[]>();
|
const map = new Map<string, Tool[]>();
|
||||||
for (const tool of tabTools) {
|
for (const tool of tabTools) {
|
||||||
@@ -92,8 +77,6 @@ export function HomePage() {
|
|||||||
return map;
|
return map;
|
||||||
}, [tabTools]);
|
}, [tabTools]);
|
||||||
|
|
||||||
// ── Tab counts ──────────────────────────────────────────────
|
|
||||||
|
|
||||||
const tabCounts = useMemo(() => {
|
const tabCounts = useMemo(() => {
|
||||||
const counts: Record<string, number> = { all: visibleTools.length };
|
const counts: Record<string, number> = { all: visibleTools.length };
|
||||||
for (const tool of visibleTools) {
|
for (const tool of visibleTools) {
|
||||||
@@ -103,8 +86,6 @@ export function HomePage() {
|
|||||||
return counts;
|
return counts;
|
||||||
}, [visibleTools]);
|
}, [visibleTools]);
|
||||||
|
|
||||||
// ── Recent tools (resolve IDs to Tool objects) ──────────────
|
|
||||||
|
|
||||||
const recentTools = useMemo(
|
const recentTools = useMemo(
|
||||||
() =>
|
() =>
|
||||||
recentToolIds
|
recentToolIds
|
||||||
@@ -113,13 +94,10 @@ export function HomePage() {
|
|||||||
[recentToolIds, visibleTools],
|
[recentToolIds, visibleTools],
|
||||||
);
|
);
|
||||||
|
|
||||||
// ── Render ──────────────────────────────────────────────────
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppLayout>
|
<AppLayout>
|
||||||
<div>
|
<div>
|
||||||
<div className="mx-auto max-w-5xl px-4 py-6 sm:px-6">
|
<div className="mx-auto max-w-6xl px-4 py-8 sm:px-6 lg:px-8">
|
||||||
{/* Search bar */}
|
|
||||||
<HomeSearchBar
|
<HomeSearchBar
|
||||||
value={search}
|
value={search}
|
||||||
onChange={setSearch}
|
onChange={setSearch}
|
||||||
@@ -128,7 +106,6 @@ export function HomePage() {
|
|||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Modality tabs */}
|
|
||||||
<ModalityTabs
|
<ModalityTabs
|
||||||
tabs={tabs}
|
tabs={tabs}
|
||||||
activeTab={activeTab}
|
activeTab={activeTab}
|
||||||
@@ -136,20 +113,13 @@ export function HomePage() {
|
|||||||
counts={tabCounts}
|
counts={tabCounts}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Content */}
|
|
||||||
{search ? (
|
{search ? (
|
||||||
<SearchResults results={searchResults} query={search} onClear={() => setSearch("")} />
|
<SearchResults results={searchResults} query={search} onClear={() => setSearch("")} />
|
||||||
) : activeTab === "all" ? (
|
|
||||||
<AllTabContent
|
|
||||||
recentTools={recentTools}
|
|
||||||
groupedTools={groupedTools}
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<ModalityTabContent groupedTools={groupedTools} />
|
<ToolGrid recentTools={recentTools} groupedTools={groupedTools} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Footer */}
|
|
||||||
<Footer />
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
</AppLayout>
|
</AppLayout>
|
||||||
@@ -171,7 +141,6 @@ function HomeSearchBar({
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
// Auto-focus when navigated here with ?focus=search (e.g. from Cmd+K on a tool page)
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const params = new URLSearchParams(location.search);
|
const params = new URLSearchParams(location.search);
|
||||||
if (params.get("focus") === "search") {
|
if (params.get("focus") === "search") {
|
||||||
@@ -181,8 +150,8 @@ function HomeSearchBar({
|
|||||||
}, [location.search, navigate]);
|
}, [location.search, navigate]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative max-w-xl mx-auto mb-6">
|
<div className="relative max-w-2xl mx-auto mb-8">
|
||||||
<Search className="absolute start-4 top-1/2 -translate-y-1/2 h-5 w-5 text-muted-foreground pointer-events-none" />
|
<Search className="absolute start-4 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" />
|
||||||
<input
|
<input
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
data-search-input
|
data-search-input
|
||||||
@@ -191,20 +160,24 @@ function HomeSearchBar({
|
|||||||
onChange={(e) => onChange(e.target.value)}
|
onChange={(e) => onChange(e.target.value)}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
aria-label={placeholder}
|
aria-label={placeholder}
|
||||||
className="w-full ps-12 pe-10 py-3 rounded-xl border border-border bg-background text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20"
|
className="w-full ps-11 pe-20 py-2.5 rounded-lg border border-border bg-card text-sm text-foreground placeholder:text-muted-foreground/60 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary/40 transition-shadow"
|
||||||
/>
|
/>
|
||||||
{value && (
|
{value ? (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onChange("");
|
onChange("");
|
||||||
inputRef.current?.focus();
|
inputRef.current?.focus();
|
||||||
}}
|
}}
|
||||||
className="absolute end-3 top-1/2 -translate-y-1/2 p-1 rounded-full hover:bg-muted transition-colors"
|
className="absolute end-3 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted transition-colors"
|
||||||
aria-label="Clear search"
|
aria-label="Clear search"
|
||||||
>
|
>
|
||||||
<X className="h-4 w-4 text-muted-foreground" />
|
<X className="h-4 w-4 text-muted-foreground" />
|
||||||
</button>
|
</button>
|
||||||
|
) : (
|
||||||
|
<kbd className="absolute end-3 top-1/2 -translate-y-1/2 hidden sm:inline-flex items-center gap-0.5 px-2 py-0.5 rounded border border-border bg-muted/50 text-[11px] text-muted-foreground font-mono">
|
||||||
|
<span className="text-xs">⌘</span>K
|
||||||
|
</kbd>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -224,21 +197,24 @@ function ModalityTabs({
|
|||||||
counts: Record<string, number>;
|
counts: Record<string, number>;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="mb-6 overflow-x-auto scrollbar-none -mx-4 px-4 sm:mx-0 sm:px-0">
|
<div className="mb-8 overflow-x-auto scrollbar-none -mx-4 px-4 sm:mx-0 sm:px-0">
|
||||||
<div className="flex gap-2 min-w-max">
|
<div className="flex gap-1.5 min-w-max">
|
||||||
{tabs.map((tab) => (
|
{tabs.map((tab) => (
|
||||||
<button
|
<button
|
||||||
key={tab.key}
|
key={tab.key}
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => onTabChange(tab.key)}
|
onClick={() => onTabChange(tab.key)}
|
||||||
className={cn(
|
className={cn(
|
||||||
"px-4 py-2 rounded-full text-sm font-medium transition-colors whitespace-nowrap",
|
"px-3.5 py-1.5 rounded-full text-sm font-medium transition-colors whitespace-nowrap",
|
||||||
activeTab === tab.key
|
activeTab === tab.key
|
||||||
? "bg-primary text-primary-foreground"
|
? "bg-primary text-primary-foreground shadow-sm"
|
||||||
: "bg-muted/50 text-muted-foreground hover:bg-muted",
|
: "text-muted-foreground hover:bg-muted hover:text-foreground",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{tab.label} ({counts[tab.key] ?? 0})
|
{tab.label}
|
||||||
|
<span className={cn("ms-1", activeTab === tab.key ? "opacity-80" : "opacity-50")}>
|
||||||
|
{counts[tab.key] ?? 0}
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -275,17 +251,17 @@ function SearchResults({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-1">
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2">
|
||||||
{results.map((tool) => (
|
{results.map((tool) => (
|
||||||
<ToolCard key={tool.id} tool={tool} showModalityBadge />
|
<ToolCard key={tool.id} tool={tool} variant="descriptive" showModalityBadge />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── All Tab Content ──────────────────────────────────────────────
|
// ── Tool Grid (used by both All tab and modality tabs) ───────────
|
||||||
|
|
||||||
function AllTabContent({
|
function ToolGrid({
|
||||||
recentTools,
|
recentTools,
|
||||||
groupedTools,
|
groupedTools,
|
||||||
}: {
|
}: {
|
||||||
@@ -295,19 +271,18 @@ function AllTabContent({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-8">
|
<div className="space-y-6">
|
||||||
{/* Recent tools (only shown if user has history) */}
|
|
||||||
{recentTools.length > 0 && (
|
{recentTools.length > 0 && (
|
||||||
<section>
|
<section>
|
||||||
<h2 className="text-xs font-semibold uppercase text-muted-foreground tracking-wider mb-2">
|
<h2 className="text-[11px] font-semibold uppercase text-muted-foreground/70 tracking-widest mb-2">
|
||||||
{t.homePage.recent}
|
{t.homePage.recent}
|
||||||
</h2>
|
</h2>
|
||||||
<div className="flex flex-wrap gap-2">
|
<div className="flex flex-wrap gap-1.5">
|
||||||
{recentTools.map((tool) => (
|
{recentTools.map((tool) => (
|
||||||
<Link
|
<Link
|
||||||
key={tool.id}
|
key={tool.id}
|
||||||
to={tool.route}
|
to={tool.route}
|
||||||
className="inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium bg-primary/10 text-primary hover:bg-primary/20 transition-colors"
|
className="inline-flex items-center gap-1.5 px-3 py-1 rounded-md text-sm text-muted-foreground border border-border/60 hover:border-border hover:text-foreground hover:bg-muted/50 transition-colors"
|
||||||
>
|
>
|
||||||
{getToolName(t, tool.id, tool.name)}
|
{getToolName(t, tool.id, tool.name)}
|
||||||
</Link>
|
</Link>
|
||||||
@@ -316,47 +291,14 @@ function AllTabContent({
|
|||||||
</section>
|
</section>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* All tools grouped by category */}
|
|
||||||
{CATEGORIES.filter((cat) => groupedTools.has(cat.id)).map((category) => {
|
{CATEGORIES.filter((cat) => groupedTools.has(cat.id)).map((category) => {
|
||||||
const tools = groupedTools.get(category.id) ?? [];
|
const tools = groupedTools.get(category.id) ?? [];
|
||||||
return (
|
return (
|
||||||
<section key={category.id}>
|
<section key={category.id}>
|
||||||
<h2 className="text-xs font-semibold uppercase text-muted-foreground tracking-wider mb-2">
|
<h2 className="text-[11px] font-semibold uppercase text-muted-foreground/70 tracking-widest mb-2 pb-1.5 border-b border-border/40">
|
||||||
{getCategoryName(t, category.id, category.name)}
|
{getCategoryName(t, category.id, category.name)}
|
||||||
</h2>
|
</h2>
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-1">
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2">
|
||||||
{tools.map((tool) => (
|
|
||||||
<ToolCard key={tool.id} tool={tool} variant="descriptive" />
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Modality Tab Content (grouped by category) ───────────────────
|
|
||||||
|
|
||||||
function ModalityTabContent({ groupedTools }: { groupedTools: Map<string, Tool[]> }) {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
if (groupedTools.size === 0) {
|
|
||||||
return (
|
|
||||||
<p className="text-center text-muted-foreground py-16">{t.fullscreenGrid.noToolsFound}</p>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="space-y-8">
|
|
||||||
{CATEGORIES.filter((cat) => groupedTools.has(cat.id)).map((category) => {
|
|
||||||
const tools = groupedTools.get(category.id) ?? [];
|
|
||||||
return (
|
|
||||||
<section key={category.id}>
|
|
||||||
<h2 className="text-xs font-semibold uppercase text-muted-foreground tracking-wider mb-2">
|
|
||||||
{getCategoryName(t, category.id, category.name)}
|
|
||||||
</h2>
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-1">
|
|
||||||
{tools.map((tool) => (
|
{tools.map((tool) => (
|
||||||
<ToolCard key={tool.id} tool={tool} variant="descriptive" />
|
<ToolCard key={tool.id} tool={tool} variant="descriptive" />
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user