All files / src/views/Search constants.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27        1x 1x       1x                 4x   1x            
import { CatalogSearchSort } from "../../api/catalog-search/constants";
import type { QueryParamKey } from "../../constants/url";
import { eventName } from "../../contexts/Analytics";
 
const LIMITS = [25, 50, 75, 100];
export const LIMIT = LIMITS[0];
 
export type SearchQueryParam = Extract<QueryParamKey, "offset" | "q">;
 
export const SORT_RENDER_MAP = {
  [CatalogSearchSort.NameAsc]: "A-Z",
  [CatalogSearchSort.NameDesc]: "Z-A",
  [CatalogSearchSort.PublishDateAsc]: "Oldest",
  [CatalogSearchSort.PublishDateDesc]: "Recently updated",
  [CatalogSearchSort.DownloadsDesc]: "Most downloads",
  [CatalogSearchSort.DownloadsAsc]: "Least downloads",
};
 
const searchEvent: typeof eventName = (...e) => eventName("Search", ...e);
 
export const SEARCH_ANALYTICS = {
  FILTERS: searchEvent("Filters"),
  RESULTS: searchEvent("Results"),
  SEARCH: searchEvent("Search"),
  SORT: searchEvent("Sort"),
};