mirror of
https://gitlab.com/wheres-the-tp/ui-mobile.git
synced 2026-01-25 04:24:56 -06:00
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
// @flow
|
|
import React, { Component } from 'react';
|
|
import { View, ScrollView } from 'react-native';
|
|
import theme from '../ui-theme';
|
|
import PlaceTile from '../components/PlaceTile';
|
|
import { compose } from 'recompose';
|
|
import { withFoodItemsGroupedByPlace, withCategories, withDistance } from '../enhancers/foodItemEnhancers';
|
|
import { withPlace } from '../enhancers/placeEnhancers';
|
|
import { type Map } from 'immutable';
|
|
import typeof FoodItemRecord from '../records/FoodItemRecord';
|
|
|
|
const withPlaceProps = compose(withCategories, withDistance, withPlace);
|
|
|
|
const PlacesList = withFoodItemsGroupedByPlace(
|
|
({ foodItemsByPlace }: { foodItemsByPlace: Map<string, Map<string, FoodItemRecord>> }) => {
|
|
return (
|
|
<View>
|
|
{foodItemsByPlace
|
|
.map((foodItems: Map<string, FoodItemRecord>, placeId: string) => {
|
|
const EnhancedPlaceTile = withPlaceProps(PlaceTile);
|
|
return <EnhancedPlaceTile key={placeId} placeId={placeId} foodItems={foodItems} />;
|
|
})
|
|
.toList()}
|
|
</View>
|
|
);
|
|
}
|
|
);
|
|
|
|
export default class Places extends Component {
|
|
static displayName = 'Places';
|
|
|
|
render() {
|
|
return (
|
|
<View style={theme.page.container}>
|
|
<ScrollView>
|
|
<PlacesList />
|
|
</ScrollView>
|
|
</View>
|
|
);
|
|
}
|
|
}
|