Skip to content
This repository was archived by the owner on Apr 28, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/src/components/inventory/InventoryHotbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const InventoryHotbar: React.FC = () => {
<div
className="hotbar-item-slot"
style={{
backgroundImage: `url(${item?.name ? getItemUrl(item as SlotWithItem) : 'none'}`,
backgroundImage: item?.name ? `url(${getItemUrl(item as SlotWithItem)})` : 'none',
}}
key={`hotbar-${item.slot}`}
>
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/inventory/InventorySlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const InventorySlot: React.ForwardRefRenderFunction<HTMLDivElement, SlotProps> =
name: item.name,
slot: item.slot,
},
image: item?.name && `url(${getItemUrl(item) || 'none'}`,
image: item?.name ? `url(${getItemUrl(item)})` : 'none',
}
: null,
canDrag,
Expand Down Expand Up @@ -131,7 +131,7 @@ const InventorySlot: React.ForwardRefRenderFunction<HTMLDivElement, SlotProps> =
? 'brightness(80%) grayscale(100%)'
: undefined,
opacity: isDragging ? 0.4 : 1.0,
backgroundImage: `url(${item?.name ? getItemUrl(item as SlotWithItem) : 'none'}`,
backgroundImage: item?.name ? `url(${getItemUrl(item as SlotWithItem)})` : 'none',
border: isOver ? '1px dashed rgba(255,255,255,0.4)' : '',
}}
>
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/utils/DragPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ export const calculatePointerPosition = (monitor: DragLayerMonitor, childRef: Re
return null;
}

if (!childRef.current || !childRef.current.getBoundingClientRect) {
if (!childRef.current) {
return subtract(offset, calculateParentOffset(monitor));
}

const bb = childRef.current.getBoundingClientRect();
const middle = { x: bb.width / 2, y: bb.height / 2 };
const el = childRef.current as HTMLElement;
const middle = { x: el.clientWidth / 2, y: el.clientHeight / 2 };
return subtract(offset, middle);
};

Expand All @@ -55,7 +55,7 @@ const DragPreview: React.FC = () => {
className="item-drag-preview"
ref={element}
style={{
transform: `translate(${currentOffset.x}px, ${currentOffset.y}px)`,
transform: `translate3d(${currentOffset.x}px, ${currentOffset.y}px, 0)`,
backgroundImage: data.image,
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/utils/ItemNotifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const ItemNotification = React.forwardRef(
<div
className="item-notification-item-box"
style={{
backgroundImage: `url(${getItemUrl(slotItem) || 'none'}`,
backgroundImage: slotItem ? `url(${getItemUrl(slotItem)})` : 'none',
...props.style,
}}
ref={ref}
Expand Down
38 changes: 20 additions & 18 deletions web/src/components/utils/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,32 @@ const Tooltip: React.FC = () => {
duration: 200,
});

const handleMouseMove = ({ clientX, clientY }: MouseEvent | React.MouseEvent<unknown, MouseEvent>) => {
refs.setPositionReference({
getBoundingClientRect() {
return {
width: 0,
height: 0,
x: clientX,
y: clientY,
left: clientX,
top: clientY,
right: clientX,
bottom: clientY,
};
},
});
};

useEffect(() => {
if (!hoverData.open) return;

const handleMouseMove = ({ clientX, clientY }: MouseEvent) => {
refs.setPositionReference({
getBoundingClientRect() {
return {
width: 0,
height: 0,
x: clientX,
y: clientY,
left: clientX,
top: clientY,
right: clientX,
bottom: clientY,
};
},
});
};

window.addEventListener('mousemove', handleMouseMove);

return () => {
window.removeEventListener('mousemove', handleMouseMove);
};
}, []);
}, [hoverData.open, refs]);

return (
<>
Expand Down