harbor run -t scale-ai/hil-bench-swe_12-ask_humanharbor download scale-ai/hil-bench-swe_12-ask_humanProton Drive needs a search discovery spotlight to promote the encrypted search feature to users. The spotlight should appear as an overlay on the Drive search bar, encouraging users to try the encrypted search functionality.
There is no spotlight or visual indicator to help users discover the encrypted search feature in the Drive search bar.
A spotlight overlay should appear on the Drive search box, displaying promotional content about encrypted search — including an image, a title, a description, and a link to the support knowledge base article.
The spotlight should only appear when the user has enough cached items in their root drive folder to benefit from search.
Spotlight visibility should be gated by a feature flag in the FeatureCode enum for gradual rollout control.
The spotlight should close when:
A getCachedChildrenCount method must be added to useLinksListing to retrieve the exact number of cached child links for a given parent link and share.
Spotlight state should be accessible to multiple components through a shared provider to keep state consistent.
The Spotlight component in packages/components needs to support an optional className prop for custom styling.
Without the search discovery spotlight, users may not discover the encrypted search capability, reducing feature adoption and user satisfaction.
The getCachedChildrenCount method in useLinksListing must return the exact number of child links stored in the cache for the specified parent link by calling linksState.getChildren(shareId, parentLinkId) and returning the array length. It must use useCallback with [linksState.getChildren] as dependency. It must be included in the return object of useLinksListingProvider.
The useSpotlight.tsx file must create a React context (SpotlightContext), an internal hook (useSearchSpotlight) that manages all spotlight state, a SpotlightProvider component that provides the context value, and a useSpotlight consumer hook. If useSpotlight is called outside the provider, it must throw an error.
The internal useSearchSpotlight hook must: (a) get the root folder by calling getDefaultShare() asynchronously in a useEffect and storing the result with useState<DriveFolder> (import DriveFolder from ../hooks/drive/useActiveShare; map the resolved { shareId, rootLinkId } to { shareId, linkId: rootLinkId }), (b) compute the stored items count by calling getCachedChildrenCount(rootFolder.shareId, rootFolder.linkId) via useMemo depending on the root folder and getCachedChildrenCount, (c) determine eligibility based on that count, and (d) return { isOpen, onDisplayed, close }. In this file, import useLinksListing as a named import from ../store/links, and import FeatureCode, useSpotlightOnFeature, and useSpotlightShow from @proton/components, matching the same module entrypoints used across the Drive app—do not import these from deeper implementation file paths inside packages.
SearchField must directly call useSpotlightOnFeature and useSpotlightShow hooks from @proton/components to determine spotlight visibility and manage the feature flag.
The spotlight content must include:
@proton/styles/assets/img/onboarding/drive-search-spotlight.svg with alt text using c('Info').t'Encrypted search is here'c('Spotlight').t'Encrypted search is here'c('Spotlight').t'Now you can easily search Drive files while keeping your data secure.'Href link to https://protonmail.com/support/knowledge-base/search-drive with title How does encrypted search work?The Spotlight component must wrap the Searchbox in SearchField.tsx with originalPlacement="bottom-left" and CSS class search-spotlight. Add .search-spotlight { max-width: 30em; } to SearchField.scss.
Spotlight visibility in SearchField must be conditioned as: searchSpotlight.isOpen && !indexingDropdownControl.isOpen.
When the search box receives focus, the spotlight must close first, then call prepareSearchData(() => indexingDropdownControl.open()).catch(reportError) (import reportError from ../../../store/utils).
The SpotlightProvider must be nested inside SearchResultsProvider in search/index.tsx.
When a file item is clicked in Drive.tsx, if item.IsFile is true, call openPreview(shareId, item) from the useOpenModal hook and return early before navigateToLink.
The useOpenModal hook must import useSpotlight and call spotlight.searchSpotlight.close() at the start of openPreview.
All async error handling must use reportError imported from ../store/utils (which re-exports from the error handler). Use .catch(reportError) consistently — do NOT use .catch(() => {}) or swallow errors silently.
Type: New Public Hook Path: applications/drive/src/app/components/useSpotlight.tsx Exports: SpotlightProvider (React Context Provider), useSpotlight (hook returning searchSpotlight object) Description: Provides centralized spotlight state management with isOpen, onDisplayed, and close methods for the search discovery feature. Notes: The internal useSearchSpotlight hook must store the root folder using the DriveFolder type from '../hooks/drive/useActiveShare' (fields: shareId, linkId). Use getDefaultShare() which resolves to { shareId: string, rootLinkId: string } — store the result as { shareId, linkId: rootLinkId }. Pass (rootFolder.shareId, rootFolder.linkId) to getCachedChildrenCount.
Type: New Public Function Path: applications/drive/src/app/store/links/useLinksListing.tsx Name: getCachedChildrenCount Input: shareId (string), parentLinkId (string) Output: number (the cached children count) Description: Returns the count of child links stored in the cache for the specified parent link. Implementation: call linksState.getChildren(shareId, parentLinkId) and return the array length.
Type: Modified Component Path: applications/drive/src/app/components/layout/search/SearchField.tsx Changes: Wrap Searchbox with Spotlight component, integrate useSpotlight hook, modify handleFocus to close spotlight, and consume provider state/actions.
Type: New Enum Value Path: packages/components/containers/features/FeaturesContext.ts Changes: Add new entry to FeatureCode enum for the drive search spotlight feature flag.
Type: Modified Component Props Path: packages/components/components/spotlight/Spotlight.tsx Changes: Add optional className prop to SpotlightProps interface.
Type: Existing Component API Reference Path: packages/components/components/spotlight/Spotlight.tsx Props: show (boolean), content (ReactNode), onDisplayed (() => void), originalPlacement (string), className (string, optional), children (ReactNode — the element the spotlight anchors to)
Type: Existing Component API Reference Path: packages/components (Href component) Props: url (string — NOT href), title (string, optional), children (ReactNode) Note: The Href component uses 'url' as its prop name, not 'href'.
Type: Existing Utility Path: applications/drive/src/app/store/utils (re-exports from utils/errorHandler) Exports: reportError — use this for all async .catch() error handling in drive app code.
Type: Existing Hook Path: applications/drive/src/app/store/shares (re-exported) Name: useDefaultShare Returns: { getDefaultShare } where getDefaultShare() returns Promise<{ shareId: string, rootLinkId: string }>