38516bff63
t("resultPlural"/"resultSingular") never got the count param the
strings' own {count} placeholder needs, while the JSX separately
prepended a raw count value next to it — visible in every locale,
worse in French where "recette"/"recettes" made the duplication
obvious. Pass count into t() and drop the redundant prefix.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
30 lines
892 B
TypeScript
30 lines
892 B
TypeScript
"use client";
|
|
import { useTranslations } from "next-intl";
|
|
import { BookOpen, Search } from "lucide-react";
|
|
import { EmptyState } from "@/components/shared/empty-state";
|
|
|
|
export function RecipesEmptyState({ query, count }: { query: string; count: number }) {
|
|
const t = useTranslations("recipes");
|
|
if (count > 0) {
|
|
return query ? (
|
|
<p className="text-sm text-muted-foreground">
|
|
{t(count !== 1 ? "resultPlural" : "resultSingular", { count })} {t("for")} “{query}”
|
|
</p>
|
|
) : null;
|
|
}
|
|
return query ? (
|
|
<EmptyState
|
|
icon={Search}
|
|
title={`${t("noMatch")} "${query}"`}
|
|
action={{ label: t("clearSearch"), href: "/recipes" }}
|
|
/>
|
|
) : (
|
|
<EmptyState
|
|
icon={BookOpen}
|
|
title={t("noRecipes")}
|
|
description={t("emptyStateDescription")}
|
|
action={{ label: t("createFirst"), href: "/recipes/new" }}
|
|
/>
|
|
);
|
|
}
|