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:
@@ -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
|
||||
|
||||
@@ -381,6 +381,13 @@ function SetupDetailPage() {
|
||||
})
|
||||
: undefined
|
||||
}
|
||||
linkTo={
|
||||
!showOwnerControls
|
||||
? item.globalItemId
|
||||
? `/global-items/${item.globalItemId}`
|
||||
: null
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user