fix(35): WR-04 use startsWith/slice for brand-stripping to avoid mid-string matches

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-19 20:14:28 +02:00
parent 93c273d266
commit 7e684176ab

View File

@@ -60,6 +60,11 @@ export function ItemCard({
const openExternalLink = useUIStore((s) => s.openExternalLink);
const duplicateItem = useDuplicateItem();
const displayName =
brand && name.startsWith(`${brand} `)
? name.slice(brand.length + 1)
: name;
const handleClick =
linkTo === null
? undefined
@@ -230,7 +235,7 @@ export function ItemCard({
)}
<div className="flex items-center gap-1.5 mb-2">
<h3 className="text-sm font-semibold text-gray-900 truncate min-w-0">
{brand ? name.replace(`${brand} `, "") : name}
{displayName}
</h3>
{quantity != null && quantity > 1 && (
<span className="shrink-0 inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600">