diff --git a/web/apps/photos/src/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx index 045dce8cc8..d19aa79cc7 100644 --- a/web/apps/photos/src/components/SearchBar.tsx +++ b/web/apps/photos/src/components/SearchBar.tsx @@ -1,12 +1,7 @@ import { assertionFailed } from "@/base/assert"; import { useIsMobileWidth } from "@/base/hooks"; import { FileType } from "@/media/file-type"; -import { PeopleList } from "@/new/photos/components/PeopleList"; -import { - isMLEnabled, - isMLSupported, - mlStatusSnapshot, -} from "@/new/photos/services/ml"; +import { isMLSupported, mlStatusSnapshot } from "@/new/photos/services/ml"; import type { City, SearchDateComponents, @@ -17,7 +12,6 @@ import { ClipSearchScores, SearchOption, SearchQuery, - Suggestion, SuggestionType, } from "@/new/photos/services/search/types"; import { labelForSuggestionType } from "@/new/photos/services/search/ui"; @@ -25,7 +19,6 @@ import type { LocationTag } from "@/new/photos/services/user-entity"; import { EnteFile } from "@/new/photos/types/file"; import { FreeFlowText, - Row, SpaceBetweenFlex, } from "@ente/shared/components/Container"; import CalendarIcon from "@mui/icons-material/CalendarMonth"; @@ -60,9 +53,7 @@ import { type ControlProps, type InputActionMeta, type InputProps, - type MenuProps, type OptionProps, - type SelectInstance, type StylesConfig, } from "react-select"; import AsyncSelect from "react-select/async"; @@ -454,22 +445,21 @@ const EmptyState: React.FC = () => { return ( - {label} + + {label} + ); - - // const options = props.selectProps.options as SearchOption[]; - - // const peopleSuggestions = options.filter( - // (o) => o.type === SuggestionType.PERSON, - // ); - // const people = peopleSuggestions.map((o) => o.value as SearchPerson); - // const indexStatusSuggestion = options.filter( // (o) => o.type === SuggestionType.INDEX_STATUS, // )[0] as Suggestion; - // const indexStatus = indexStatusSuggestion?.value; + // TODO-Cluster + // const options = props.selectProps.options as SearchOption[]; + // const peopleSuggestions = options.filter( + // (o) => o.type === SuggestionType.PERSON, + // ); + // const people = peopleSuggestions.map((o) => o.value as SearchPerson); // return ( // // @@ -482,20 +472,17 @@ const EmptyState: React.FC = () => { // ) : ( // // ))} - // {isMLEnabled() && indexStatus && ( // // {indexStatusSuggestion.label} // // )} // {people && people.length > 0 && ( - // - // // "@ente/shared/components/Container" + // { - // selectRef.current?.blur(); - // setSelectedValue(peopleSuggestions[index]); // }} // /> // @@ -506,6 +493,14 @@ const EmptyState: React.FC = () => { // ); }; +// TODO-Cluster +// const Legend = styled("span")` +// font-size: 20px; +// color: #ddd; +// display: inline; +// padding: 0px 12px; +// `; + const Option: React.FC> = (props) => ( @@ -550,80 +545,6 @@ const LabelWithInfo = ({ data }: { data: SearchOption }) => { ); }; -type CustomMenuProps = MenuProps & { - selectRef: React.RefObject; - // Cannot call it setValue since the menu itself already has that. - setSelectedValue: (value: SearchOption) => void; -}; - -const CustomMenu: React.FC = ({ - selectRef, - setSelectedValue, - ...props -}) => { - // Need to cast here, otherwise the react-select types think selectProps can - // also be something that supports multiple selection groups. - const options = props.selectProps.options as SearchOption[]; - - const peopleSuggestions = options.filter( - (o) => o.type === SuggestionType.PERSON, - ); - const people = peopleSuggestions.map((o) => o.value as SearchPerson); - - const indexStatusSuggestion = options.filter( - (o) => o.type === SuggestionType.INDEX_STATUS, - )[0] as Suggestion; - - const indexStatus = indexStatusSuggestion?.value; - return ( - - - {isMLEnabled() && - indexStatus && - (people && people.length > 0 ? ( - - {t("people")} - - ) : ( - - ))} - - {isMLEnabled() && indexStatus && ( - - {indexStatusSuggestion.label} - - )} - {people && people.length > 0 && ( - - { - selectRef.current?.blur(); - setSelectedValue(peopleSuggestions[index]); - }} - /> - - )} - - {props.children} - - ); -}; - -const Legend = styled("span")` - font-size: 20px; - color: #ddd; - display: inline; - padding: 0px 12px; -`; - -const Caption = styled("span")` - font-size: 12px; - display: inline; - padding: 0px 12px; -`; - // A custom input for react-select that is always visible. This is a roundabout // hack the existing code used to display the search string when showing the // results page; likely there should be a better way.