mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 10:40:07 +08:00
clean comment
This commit is contained in:
parent
3274723b1e
commit
3093a9e5d0
@ -131,7 +131,6 @@ function DynamicVirtualList<T>(props: DynamicVirtualListProps<T>) {
|
||||
|
||||
const internalStickyRangeExtractor = useCallback(
|
||||
(range: Range) => {
|
||||
// VSCode-like sticky behavior: show ancestor chain of current visible items
|
||||
const activeStickies: number[] = []
|
||||
|
||||
if (getItemDepth) {
|
||||
@ -298,14 +297,8 @@ function DynamicVirtualList<T>(props: DynamicVirtualListProps<T>) {
|
||||
position: isItemActiveSticky ? 'sticky' : 'absolute',
|
||||
top: isItemActiveSticky ? stickyOffset : 0,
|
||||
left: 0,
|
||||
// Critical: Sticky items need higher z-index than non-sticky items
|
||||
// Ancestors (lower activeStickyIndex) should have HIGHER z-index
|
||||
// Non-sticky items get z-index 0 to ensure they render below sticky items
|
||||
zIndex: isItemActiveSticky ? 1000 + (100 - activeStickyIndex) : isItemSticky ? 999 : 0,
|
||||
// CRITICAL: Disable pointer events for items covered by sticky headers
|
||||
// This prevents hover/click events from bleeding through
|
||||
pointerEvents: isCoveredBySticky ? 'none' : 'auto',
|
||||
// Add background and shadow for active sticky items
|
||||
...(isItemActiveSticky && {
|
||||
backgroundColor: 'var(--color-background)'
|
||||
}),
|
||||
|
||||
@ -60,7 +60,6 @@ const NotesSidebar: FC<NotesSidebarProps> = ({
|
||||
const { activeNode } = useActiveNode(notesTree)
|
||||
const sortType = useAppSelector(selectSortType)
|
||||
|
||||
// --- State ---
|
||||
const [isShowStarred, setIsShowStarred] = useState(false)
|
||||
const [isShowSearch, setIsShowSearch] = useState(false)
|
||||
const [searchKeyword, setSearchKeyword] = useState('')
|
||||
@ -72,13 +71,9 @@ const NotesSidebar: FC<NotesSidebarProps> = ({
|
||||
const trimmedSearchKeyword = useMemo(() => searchKeyword.trim(), [searchKeyword])
|
||||
const hasSearchKeyword = trimmedSearchKeyword.length > 0
|
||||
|
||||
// --- Hooks ---
|
||||
|
||||
// Editing Hook
|
||||
const { editingNodeId, renamingNodeIds, newlyRenamedNodeIds, inPlaceEdit, handleStartEdit, handleAutoRename } =
|
||||
useNotesEditing({ onRenameNode })
|
||||
|
||||
// Drag and Drop Hook
|
||||
const {
|
||||
draggedNodeId,
|
||||
dragOverNodeId,
|
||||
@ -90,13 +85,11 @@ const NotesSidebar: FC<NotesSidebarProps> = ({
|
||||
handleDragEnd
|
||||
} = useNotesDragAndDrop({ onMoveNode })
|
||||
|
||||
// File Upload Hook
|
||||
const { handleDropFiles, handleSelectFiles, handleSelectFolder } = useNotesFileUpload({
|
||||
onUploadFiles,
|
||||
setIsDragOverSidebar
|
||||
})
|
||||
|
||||
// Menu Hook
|
||||
const { getMenuItems } = useNotesMenu({
|
||||
renamingNodeIds,
|
||||
onCreateNote,
|
||||
@ -110,7 +103,6 @@ const NotesSidebar: FC<NotesSidebarProps> = ({
|
||||
activeNode
|
||||
})
|
||||
|
||||
// Search Hook
|
||||
const searchOptions = useMemo(
|
||||
() => ({
|
||||
debounceMs: 300,
|
||||
@ -132,14 +124,10 @@ const NotesSidebar: FC<NotesSidebarProps> = ({
|
||||
stats: searchStats
|
||||
} = useFullTextSearch(searchOptions)
|
||||
|
||||
// --- Effects ---
|
||||
|
||||
// Sync notesTree to ref
|
||||
useEffect(() => {
|
||||
notesTreeRef.current = notesTree
|
||||
}, [notesTree])
|
||||
|
||||
// Trigger Search
|
||||
useEffect(() => {
|
||||
if (!isShowSearch) {
|
||||
reset()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user