@@ -410,10 +410,13 @@ const FileCard = styled(
410
410
const dndContext = useDndContext ( ) ;
411
411
const dndInProgress = Boolean ( dndContext . active ) ;
412
412
413
+ const { trackEvent } = React . useContext ( AnalyticsContext ) ;
413
414
const { onDragEnter, onDragOver, onDragLeave, onDrop, over } =
414
415
useFileImportDropZone ( {
415
416
onDrop : ( files ) => {
416
- void uploadFiles ( file . id , files ) ;
417
+ void uploadFiles ( file . id , files ) . then ( ( ) => {
418
+ trackEvent ( "user:drag_uploads:file:into_folder" ) ;
419
+ } ) ;
417
420
/*
418
421
* No need to refresh the listing as the uploaded file has been
419
422
* placed inside a folder into which the user cannot currently see
@@ -1284,6 +1287,7 @@ function GalleryMainPanel({
1284
1287
const viewportDimensions = useViewportDimensions ( ) ;
1285
1288
const filestoresEnabled = useDeploymentProperty ( "netfilestores.enabled" ) ;
1286
1289
const { uploadFiles } = useGalleryActions ( ) ;
1290
+ const { trackEvent } = React . useContext ( AnalyticsContext ) ;
1287
1291
const { onDragEnter, onDragOver, onDragLeave, onDrop, over } =
1288
1292
useFileImportDropZone ( {
1289
1293
onDrop : doNotAwait ( async ( files ) => {
@@ -1292,6 +1296,13 @@ function GalleryMainPanel({
1292
1296
} ) ;
1293
1297
await uploadFiles ( fId , files ) ;
1294
1298
void refreshListing ( ) ;
1299
+ if ( path . length > 0 ) {
1300
+ trackEvent ( "user:drag_uploads:file:into_current_folder" ) ;
1301
+ } else {
1302
+ trackEvent ( "user:drag_uploads:file:section_root" , {
1303
+ section : selectedSection ,
1304
+ } ) ;
1305
+ }
1295
1306
} ) ,
1296
1307
} ) ;
1297
1308
const [ viewMenuAnchorEl , setViewMenuAnchorEl ] = React . useState ( null ) ;
@@ -1304,7 +1315,6 @@ function GalleryMainPanel({
1304
1315
const [ sortMenuAnchorEl , setSortMenuAnchorEl ] = React . useState ( null ) ;
1305
1316
const { moveFiles } = useGalleryActions ( ) ;
1306
1317
const selection = useGallerySelection ( ) ;
1307
- const { trackEvent } = React . useContext ( AnalyticsContext ) ;
1308
1318
1309
1319
const mouseSensor = useSensor ( MouseSensor , {
1310
1320
activationConstraint : {
0 commit comments