fix: shared setup items link to catalog instead of requiring auth

Items with a globalItemId now link to /global-items/:id (public) in
shared and public setup views. Items without a catalog link are not
clickable. Owner view behavior unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 20:10:02 +02:00
parent 1fbd9bc609
commit 731d677da6
2 changed files with 22 additions and 4 deletions

View File

@@ -25,6 +25,7 @@ interface ItemCardProps {
onRemove?: () => void;
classification?: string;
onClassificationCycle?: () => void;
linkTo?: string | null;
}
export function ItemCard({
@@ -46,19 +47,29 @@ export function ItemCard({
onRemove,
classification,
onClassificationCycle,
linkTo,
}: ItemCardProps) {
const { weight, price } = useFormatters();
const navigate = useNavigate();
const openExternalLink = useUIStore((s) => s.openExternalLink);
const duplicateItem = useDuplicateItem();
const handleClick =
linkTo === null
? undefined
: () => {
if (linkTo) {
navigate({ to: linkTo });
} else {
navigate({ to: "/items/$itemId", params: { itemId: String(id) } });
}
};
return (
<button
type="button"
onClick={() =>
navigate({ to: "/items/$itemId", params: { itemId: String(id) } })
}
className="relative w-full text-left bg-white rounded-xl border border-gray-100 hover:border-gray-200 hover:shadow-sm transition-all overflow-hidden group"
onClick={handleClick}
className={`relative w-full text-left bg-white rounded-xl border border-gray-100 transition-all overflow-hidden group ${linkTo === null ? "cursor-default" : "hover:border-gray-200 hover:shadow-sm"}`}
>
{!onRemove && (
<span

View File

@@ -381,6 +381,13 @@ function SetupDetailPage() {
})
: undefined
}
linkTo={
!showOwnerControls
? item.globalItemId
? `/global-items/${item.globalItemId}`
: null
: undefined
}
/>
))}
</div>