mirror of
https://gitlab.com/wheres-the-tp/ui-mobile.git
synced 2026-01-25 07:24:56 -06:00
25 lines
673 B
JavaScript
25 lines
673 B
JavaScript
// @flow
|
|
import FoodItemRecord from '../records/FoodItemRecord';
|
|
import { type Category, CATEGORY_BEVERAGES, CATEGORY_DESSERTS, CATEGORY_ENTREES } from '../constants/CategoryConstants';
|
|
import { type Map } from 'immutable';
|
|
|
|
export const getCategoryText = (category: Category) => {
|
|
switch (category) {
|
|
case CATEGORY_BEVERAGES:
|
|
return 'Beverages';
|
|
case CATEGORY_DESSERTS:
|
|
return 'Desserts';
|
|
case CATEGORY_ENTREES:
|
|
return 'Entrees';
|
|
default:
|
|
return 'Other';
|
|
}
|
|
};
|
|
|
|
export const getCategories = (foodItems: Map<string, FoodItemRecord>) => {
|
|
return foodItems
|
|
.toSet()
|
|
.map(foodItem => foodItem.get('category'))
|
|
.map(getCategoryText)
|
|
.toList();
|
|
};
|