Просмотр исходного кода

fix(dashboard): Fix multi selection in asset gallery

Michael Bromley 3 месяцев назад
Родитель
Сommit
347b273500

+ 3 - 3
packages/dashboard/src/lib/components/shared/asset/asset-bulk-actions.tsx

@@ -40,7 +40,7 @@ export function AssetBulkActions({ selection, bulkActions, refetch }: Readonly<A
 
     const { position, shouldShow } = useFloatingBulkActions({
         selectionCount: selection.length,
-        containerSelector: '[data-asset-gallery]'
+        containerSelector: '[data-asset-gallery]',
     });
 
     if (!shouldShow) {
@@ -70,12 +70,12 @@ export function AssetBulkActions({ selection, bulkActions, refetch }: Readonly<A
 
     return (
         <div
-            className="flex items-center gap-4 px-8 py-2 animate-in fade-in duration-200 fixed transform -translate-x-1/2 bg-white shadow-2xl rounded-md border z-50"
+            className="flex items-center gap-4 px-8 py-2 animate-in fade-in duration-200 fixed transform -translate-x-1/2 bg-background shadow-2xl rounded-md border z-50"
             style={{
                 height: 'auto',
                 maxHeight: '60px',
                 bottom: position.bottom,
-                left: position.left
+                left: position.left,
             }}
         >
             <span className="text-sm text-muted-foreground">

+ 2 - 3
packages/dashboard/src/lib/hooks/use-floating-bulk-actions.ts

@@ -32,9 +32,8 @@ export function useFloatingBulkActions({
         }
 
         const updatePosition = () => {
-            // Find the container by searching upwards from the current component
-            const currentElement = document.activeElement || document.body;
-            const container = currentElement.closest(containerSelector) as HTMLElement;
+            // Find the container in the document
+            const container = document.querySelector(containerSelector) as HTMLElement;
             if (!container) return;
 
             const containerRect = container.getBoundingClientRect();