fix: Don't redirect to document after dragging pin

This commit is contained in:
Tom Moor
2022-09-17 19:23:25 -04:00
parent 15505cf951
commit f8895dacda
2 changed files with 5 additions and 3 deletions

View File

@@ -69,6 +69,7 @@ function DocumentCard(props: Props) {
$isDragging={isDragging}
{...attributes}
{...listeners}
tabIndex={-1}
>
<AnimatePresence
initial={{ opacity: 0, scale: 0.95 }}
@@ -203,6 +204,7 @@ const Reorderable = styled.div<{ $isDragging: boolean }>`
// move above other cards when dragging
z-index: ${(props) => (props.$isDragging ? 1 : "inherit")};
pointer-events: ${(props) => (props.$isDragging ? "none" : "inherit")};
&:hover ${Actions} {
opacity: 1;

View File

@@ -44,7 +44,7 @@ function PinnedDocuments({ limit, pins, canUpdate, ...rest }: Props) {
const sensors = useSensors(
useSensor(PointerSensor, {
activationConstraint: {
delay: 150,
delay: 100,
tolerance: 5,
},
}),
@@ -59,8 +59,8 @@ function PinnedDocuments({ limit, pins, canUpdate, ...rest }: Props) {
if (over && active.id !== over.id) {
setItems((items) => {
const activePos = items.indexOf(active.id);
const overPos = items.indexOf(over.id);
const activePos = items.indexOf(active.id as string);
const overPos = items.indexOf(over.id as string);
const overIndex = pins[overPos]?.index || null;
const nextIndex = pins[overPos + 1]?.index || null;