import { useGetAnalyticsSummary, useGetTopTools, useListTools, GetTopToolsMetric } from "@workspace/api-client-react"; import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "@/components/ui/card"; import { Skeleton } from "@/components/ui/skeleton"; import { Layout } from "@/components/layout"; import { ToolCard } from "@/components/tool-card"; import { Star, Wrench, MessageSquare, ArrowRight, Plus } from "lucide-react"; import { Link } from "wouter"; import { Button } from "@/components/ui/button"; import { useTranslation } from "react-i18next"; export default function Home() { const { t } = useTranslation(); const { data: summary, isLoading: loadingSummary } = useGetAnalyticsSummary(); const { data: topTools, isLoading: loadingTopTools } = useGetTopTools({ limit: 4, metric: GetTopToolsMetric.combined }); const { data: recentTools, isLoading: loadingRecent } = useListTools({ sort: "newest" }); return (

{t("home.welcome")}

{t("home.tagline")}

{/* Stats Banner */}

{t("home.totalTools")}

{loadingSummary ? ( ) : (

{summary?.totalTools || 0}

)}

{t("home.totalRatings")}

{loadingSummary ? ( ) : (

{summary?.totalRatings || 0}

)}

{t("home.avgRating")}

{loadingSummary ? ( ) : (

{summary?.avgCombined ? summary.avgCombined.toFixed(1) : "0.0"}

)}
{/* Top Tools Section */}

{t("home.topRated")}

{t("home.topRatedSub")}

{loadingTopTools ? (
{[1, 2, 3, 4].map(i => ( ))}
) : topTools && topTools.length > 0 ? (
{topTools.map(({ tool }) => ( ))}
) : (

{t("home.noRatingsYet")}

{t("home.noRatingsSub")}

)}
{/* Recently Added Section */}

{t("home.recentlyAdded")}

{t("home.recentlyAddedSub")}

{loadingRecent ? (
{[1, 2, 3, 4].map(i => ( ))}
) : recentTools && recentTools.length > 0 ? (
{recentTools.slice(0, 4).map((tool) => ( ))}
) : (

{t("home.noTools")}

{t("home.noToolsSub")}

)}
); }