Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow dragging items from Item Feed to any bucket, similar to postmaster items #10765

Merged
merged 1 commit into from
Oct 25, 2024
Merged
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: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Next

* Allow dragging Item Feed items to any slot, removing the need to scroll to a specific item slot to drag them to a character. They will automatically go to the correct slot on the given character (in the same way Postmaster items function).

## 8.43.0 <span class="changelog-date">(2024-10-20)</span>

## 8.42.0 <span class="changelog-date">(2024-10-13)</span>
Expand Down
14 changes: 8 additions & 6 deletions src/app/inventory/DraggableInventoryItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import { DimItem } from './item-types';

interface Props {
item: DimItem;
anyBucket?: boolean;
children?: React.ReactNode;
}

let dragTimeout: number | null = null;

export default function DraggableInventoryItem({ children, item }: Props) {
export default function DraggableInventoryItem({ children, item, anyBucket = false }: Props) {
const selectionProps = $featureFlags.elgatoStreamDeck
? // eslint-disable-next-line
useStreamDeckSelection({
Expand All @@ -33,11 +34,12 @@ export default function DraggableInventoryItem({ children, item }: Props) {

const [_collect, dragRef] = useDrag<DimItem>(
() => ({
type: item.location.inPostmaster
? 'postmaster'
: item.notransfer
? `${item.owner}-${item.bucket.hash}`
: item.bucket.hash.toString(),
type:
item.location.inPostmaster || anyBucket
? 'postmaster'
: item.notransfer
? `${item.owner}-${item.bucket.hash}`
: item.bucket.hash.toString(),
item: () => {
hideItemPopup();

Expand Down
4 changes: 3 additions & 1 deletion src/app/item-feed/ItemFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ const Item = memo(function Item({ item, tag }: { item: DimItem; tag: TagValue |
{isPhonePortrait ? (
itemIcon
) : (
<DraggableInventoryItem item={item}>{itemIcon}</DraggableInventoryItem>
<DraggableInventoryItem item={item} anyBucket={true}>
{itemIcon}
</DraggableInventoryItem>
)}
<div className={styles.info}>
<div className={styles.title}>
Expand Down
Loading