Extrac
This commit is contained in:
@@ -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}>
|
||||
|
||||
30
web/packages/new/photos/services/search/ui.ts
Normal file
30
web/packages/new/photos/services/search/ui.ts
Normal 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");
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user