This commit is contained in:
Manav Rathi
2024-09-07 11:08:32 +05:30
parent 2f19a21b5f
commit add5b856dc
2 changed files with 32 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import { SearchOption } from "@/new/photos/services/search/types";
import { labelForSuggestionType } from "@/new/photos/services/search/ui";
import {
FreeFlowText,
SpaceBetweenFlex,
@@ -24,7 +25,7 @@ const LabelWithInfo = ({ data }: { data: SearchOption }) => {
<>
<Box className="main" px={2} py={1}>
<Typography variant="mini" mb={1}>
{t(`SEARCH_TYPE.${data.type}`)}
{labelForSuggestionType(data.type)}
</Typography>
<SpaceBetweenFlex>
<Box mr={1}>

View File

@@ -0,0 +1,30 @@
import { t } from "i18next";
import { SuggestionType } from "./types";
/**
* Return a localized label for the given suggestion {@link type}.
*/
export const labelForSuggestionType = (type: SuggestionType) => {
switch (type) {
case SuggestionType.DATE:
return t("SEARCH_TYPE.DATE");
case SuggestionType.LOCATION:
return t("SEARCH_TYPE.LOCATION");
case SuggestionType.COLLECTION:
return t("SEARCH_TYPE.COLLECTION");
case SuggestionType.FILE_NAME:
return t("SEARCH_TYPE.FILE_NAME");
case SuggestionType.PERSON:
return t("SEARCH_TYPE.PERSON");
case SuggestionType.INDEX_STATUS:
return t("SEARCH_TYPE.INDEX_STATUS");
case SuggestionType.FILE_CAPTION:
return t("SEARCH_TYPE.FILE_CAPTION");
case SuggestionType.FILE_TYPE:
return t("SEARCH_TYPE.FILE_TYPE");
case SuggestionType.CLIP:
return t("SEARCH_TYPE.CLIP");
case SuggestionType.CITY:
return t("SEARCH_TYPE.CITY");
}
};