<commit_before>import { useCallback } from 'react';
import { c } from 'ttag';

import { FileBrowserItem } from '@proton/shared/lib/interfaces/drive/fileBrowser';

import { useSearchView } from '../../../store';
import useNavigate from '../../../hooks/drive/useNavigate';
import { FileBrowser } from '../../FileBrowser';
import { mapDecryptedLinksToChildren } from '../helpers';
import SearchItemContextMenu from './SearchItemContextMenu';
import { NoSearchResultsView } from './NoSearchResultsView';

interface Props {
    shareId: string;
    searchView: ReturnType<typeof useSearchView>;
}

export const Search = ({ shareId, searchView }: Props) => {
    const { navigateToLink } = useNavigate();

    const { layout, items, sortParams, setSorting, selectionControls, isLoading } = searchView;
    const { clearSelections, selectedItems, selectItem, toggleSelectItem, toggleAllSelected, toggleRange } =
        selectionControls;

    const selectedItems2 = mapDecryptedLinksToChildren(selectedItems);
    const contents = mapDecryptedLinksToChildren(items);

    const handleClick = useCallback(
        async (item: FileBrowserItem) => {
            if (!item.IsFile) {
                return;
            }
            document.getSelection()?.removeAllRanges();
            navigateToLink(shareId, item.LinkID, item.IsFile);
        },
        [navigateToLink, shareId]<commit_msg>Allow to open folders in search results<commit_after>import { useCallback } from 'react';
import { c } from 'ttag';

import { FileBrowserItem } from '@proton/shared/lib/interfaces/drive/fileBrowser';

import { useSearchView } from '../../../store';
import useNavigate from '../../../hooks/drive/useNavigate';
import { FileBrowser } from '../../FileBrowser';
import { mapDecryptedLinksToChildren } from '../helpers';
import SearchItemContextMenu from './SearchItemContextMenu';
import { NoSearchResultsView } from './NoSearchResultsView';

interface Props {
    shareId: string;
    searchView: ReturnType<typeof useSearchView>;
}

export const Search = ({ shareId, searchView }: Props) => {
    const { navigateToLink } = useNavigate();

    const { layout, items, sortParams, setSorting, selectionControls, isLoading } = searchView;
    const { clearSelections, selectedItems, selectItem, toggleSelectItem, toggleAllSelected, toggleRange } =
        selectionControls;

    const selectedItems2 = mapDecryptedLinksToChildren(selectedItems);
    const contents = mapDecryptedLinksToChildren(items);

    const handleClick = useCallback(
        async (item: FileBrowserItem) => {
            document.getSelection()?.removeAllRanges();
            navigateToLink(shareId, item.LinkID, item.IsFile);
        },
        [navigateToLink, shareId]
{'fraction_non_alphanumeric': 0.12051282051282051, 'fraction_numerical': 0.0007326007326007326, 'mean_word_length': 3.7996485061511422, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4765307', 'n_tokens_mistral': 729, 'n_tokens_neox': 730, 'n_words': 180}