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:
@@ -60,6 +60,11 @@ export function ItemCard({
|
|||||||
const openExternalLink = useUIStore((s) => s.openExternalLink);
|
const openExternalLink = useUIStore((s) => s.openExternalLink);
|
||||||
const duplicateItem = useDuplicateItem();
|
const duplicateItem = useDuplicateItem();
|
||||||
|
|
||||||
|
const displayName =
|
||||||
|
brand && name.startsWith(`${brand} `)
|
||||||
|
? name.slice(brand.length + 1)
|
||||||
|
: name;
|
||||||
|
|
||||||
const handleClick =
|
const handleClick =
|
||||||
linkTo === null
|
linkTo === null
|
||||||
? undefined
|
? undefined
|
||||||
@@ -230,7 +235,7 @@ export function ItemCard({
|
|||||||
)}
|
)}
|
||||||
<div className="flex items-center gap-1.5 mb-2">
|
<div className="flex items-center gap-1.5 mb-2">
|
||||||
<h3 className="text-sm font-semibold text-gray-900 truncate min-w-0">
|
<h3 className="text-sm font-semibold text-gray-900 truncate min-w-0">
|
||||||
{brand ? name.replace(`${brand} `, "") : name}
|
{displayName}
|
||||||
</h3>
|
</h3>
|
||||||
{quantity != null && quantity > 1 && (
|
{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">
|
<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">
|
||||||
|
|||||||
Reference in New Issue
Block a user