File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,30 +15,14 @@ export const getSidebarItemBySlug = async (
1515) : Promise < AnySidebarItemWithContent | null > => {
1616 await requireCampaignMembership ( ctx , campaignId )
1717
18- const filter = ( q : any ) => q . eq ( q . field ( 'deletionTime' ) , null )
1918 const idx = ( q : any ) => q . eq ( 'campaignId' , campaignId ) . eq ( 'slug' , slug )
2019
20+ // specifically don't filter out deleted items, as they are still viewable in this context
2121 const [ note , folder , map , file ] = await Promise . all ( [
22- ctx . db
23- . query ( 'notes' )
24- . withIndex ( 'by_campaign_slug' , idx )
25- . filter ( filter )
26- . unique ( ) ,
27- ctx . db
28- . query ( 'folders' )
29- . withIndex ( 'by_campaign_slug' , idx )
30- . filter ( filter )
31- . unique ( ) ,
32- ctx . db
33- . query ( 'gameMaps' )
34- . withIndex ( 'by_campaign_slug' , idx )
35- . filter ( filter )
36- . unique ( ) ,
37- ctx . db
38- . query ( 'files' )
39- . withIndex ( 'by_campaign_slug' , idx )
40- . filter ( filter )
41- . unique ( ) ,
22+ ctx . db . query ( 'notes' ) . withIndex ( 'by_campaign_slug' , idx ) . unique ( ) ,
23+ ctx . db . query ( 'folders' ) . withIndex ( 'by_campaign_slug' , idx ) . unique ( ) ,
24+ ctx . db . query ( 'gameMaps' ) . withIndex ( 'by_campaign_slug' , idx ) . unique ( ) ,
25+ ctx . db . query ( 'files' ) . withIndex ( 'by_campaign_slug' , idx ) . unique ( ) ,
4226 ] )
4327
4428 if ( note ) {
Original file line number Diff line number Diff line change 1- import { useRef , useState } from 'react'
1+ import { useEffect , useRef , useState } from 'react'
22import { Trash2 } from 'lucide-react'
33import { SIDEBAR_ITEM_LOCATION } from 'convex/sidebarItems/types/baseTypes'
44import { TrashPopoverContent } from './trash-popover-content'
99 PopoverTrigger ,
1010} from '~/features/shadcn/components/popover'
1111import { useDndDropTarget } from '~/features/dnd/hooks/useDndDropTarget'
12+ import { useDndStore } from '~/features/dnd/stores/dnd-store'
1213import { useCurrentItem } from '~/features/sidebar/hooks/useCurrentItem'
1314import { useSidebarItems } from '~/features/sidebar/hooks/useSidebarItems'
1415import { TRASH_DROP_ZONE_TYPE } from '~/features/dnd/utils/dnd-registry'
@@ -18,6 +19,11 @@ export function TrashButton() {
1819 const [ open , setOpen ] = useState ( false )
1920 const buttonRef = useRef < HTMLDivElement > ( null )
2021
22+ const isDragging = useDndStore ( ( s ) => s . isDraggingElement )
23+ useEffect ( ( ) => {
24+ if ( isDragging ) setOpen ( false )
25+ } , [ isDragging ] )
26+
2127 const { parentItemsMap } = useSidebarItems ( SIDEBAR_ITEM_LOCATION . trash )
2228 const rootTrashedItems = parentItemsMap . get ( null ) ?? [ ]
2329 const trashCount = rootTrashedItems . length
You can’t perform that action at this time.
0 commit comments