-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: action filter to dnd sortable (#17422)
- Loading branch information
Showing
29 changed files
with
146 additions
and
60 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.6 KB
(130%)
frontend/__snapshots__/filters-action-filter--funnel-like.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.41 KB
(130%)
frontend/__snapshots__/filters-action-filter--property-filters-with-popover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.01 KB
(140%)
frontend/__snapshots__/filters-action-filter--single-filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+42 Bytes
(100%)
...nd/__snapshots__/scenes-app-insights--funnel-historical-trends-edit--webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+35 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--funnel-historical-trends-edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+33 Bytes
(100%)
...napshots__/scenes-app-insights--funnel-left-to-right-breakdown-edit--webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4 Bytes
(100%)
...tend/__snapshots__/scenes-app-insights--funnel-left-to-right-breakdown-edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+48 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--funnel-left-to-right-edit--webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+51 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--funnel-left-to-right-edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+38 Bytes
(100%)
...tend/__snapshots__/scenes-app-insights--funnel-time-to-convert-edit--webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+36 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--funnel-time-to-convert-edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+10 Bytes
(100%)
...napshots__/scenes-app-insights--funnel-top-to-bottom-breakdown-edit--webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+16 Bytes
(100%)
...tend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-breakdown-edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-44 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-edit--webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-39 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-34.8 KB
(68%)
...napshots__/scenes-app-recordings--recordings-play-list-no-pinned-recordings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Adapted from https://github.com/clauderic/dnd-kit/pull/805 to fix an issue where variable | ||
// height items in a sortable container were not always firing collisions correctly. | ||
// Should be possible to remove this custom collision detection algorithm once a proper fix | ||
// is merged into dnd-kit. | ||
|
||
import { CollisionDetection, DroppableContainer, UniqueIdentifier } from '@dnd-kit/core' | ||
|
||
export const verticalSortableListCollisionDetection: CollisionDetection = (args) => { | ||
if (args.collisionRect.top < (args.active.rect.current?.initial?.top ?? 0)) { | ||
return highestDroppableContainerMajorityCovered(args) | ||
} else { | ||
return lowestDroppableContainerMajorityCovered(args) | ||
} | ||
} | ||
|
||
// Look for the first (/ furthest up / highest) droppable container that is at least | ||
// 50% covered by the top edge of the dragging container. | ||
const highestDroppableContainerMajorityCovered: CollisionDetection = ({ droppableContainers, collisionRect }) => { | ||
const ascendingDroppabaleContainers = droppableContainers.sort(sortByRectTop) | ||
|
||
for (const droppableContainer of ascendingDroppabaleContainers) { | ||
const { | ||
rect: { current: droppableRect }, | ||
} = droppableContainer | ||
|
||
if (droppableRect) { | ||
const coveredPercentage = | ||
(droppableRect.top + droppableRect.height - collisionRect.top) / droppableRect.height | ||
|
||
if (coveredPercentage > 0.5) { | ||
return [collision(droppableContainer)] | ||
} | ||
} | ||
} | ||
|
||
// if we haven't found anything then we are off the top, so return the first item | ||
return [collision(ascendingDroppabaleContainers[0])] | ||
} | ||
|
||
// Look for the last (/ furthest down / lowest) droppable container that is at least | ||
// 50% covered by the bottom edge of the dragging container. | ||
const lowestDroppableContainerMajorityCovered: CollisionDetection = ({ droppableContainers, collisionRect }) => { | ||
const descendingDroppabaleContainers = droppableContainers.sort(sortByRectTop).reverse() | ||
|
||
for (const droppableContainer of descendingDroppabaleContainers) { | ||
const { | ||
rect: { current: droppableRect }, | ||
} = droppableContainer | ||
|
||
if (droppableRect) { | ||
const coveredPercentage = (collisionRect.bottom - droppableRect.top) / droppableRect.height | ||
|
||
if (coveredPercentage > 0.5) { | ||
return [collision(droppableContainer)] | ||
} | ||
} | ||
} | ||
|
||
// if we haven't found anything then we are off the bottom, so return the last item | ||
return [collision(descendingDroppabaleContainers[0])] | ||
} | ||
|
||
const sortByRectTop = (a: DroppableContainer, b: DroppableContainer): number => | ||
(a?.rect.current?.top || 0) - (b?.rect.current?.top || 0) | ||
|
||
const collision = (dropppableContainer?: DroppableContainer): { id: UniqueIdentifier; value?: DroppableContainer } => { | ||
return { | ||
id: dropppableContainer?.id ?? '', | ||
value: dropppableContainer, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
...tend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/SortableActionFilterRow.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-32.6 KB
(9.2%)
...s-snapshots/Navigation-App-Page-With-Side-Bar-Shown-Mobile-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.