mirror of
https://gitlab.com/wheres-the-tp/ui-mobile.git
synced 2026-01-25 04:34:55 -06:00
wip converting to products from scraper
This commit is contained in:
parent
caa5eb2166
commit
451b63b71c
4 changed files with 10 additions and 11 deletions
|
|
@ -21,13 +21,14 @@ export const fetchFaves = withLoggedInEmail(async email => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export const putFaves = withLoggedInEmail(async (email, productIds) => {
|
export const putFaves = withLoggedInEmail(async (email, productId, photoUrl) => {
|
||||||
return fetchRequest({
|
return fetchRequest({
|
||||||
endpoint: '/fave',
|
endpoint: '/fave',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: {
|
body: {
|
||||||
email,
|
email,
|
||||||
productIds,
|
productId,
|
||||||
|
photoUrl,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ const ProductImages = ({
|
||||||
<Image
|
<Image
|
||||||
style={{ flex: 1, resizeMode: 'contain' }}
|
style={{ flex: 1, resizeMode: 'contain' }}
|
||||||
resizeMethod="scale"
|
resizeMethod="scale"
|
||||||
source={{ uri: get(visibleImages.first(), 'url', '') }}
|
source={{ uri: visibleImages.first() }}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
@ -63,12 +63,12 @@ const ProductImages = ({
|
||||||
onAnimateNextPage={changeCurrentImage}
|
onAnimateNextPage={changeCurrentImage}
|
||||||
style={stretchedStyle}
|
style={stretchedStyle}
|
||||||
currentPage={currentImage}>
|
currentPage={currentImage}>
|
||||||
{visibleImages.map(image => (
|
{visibleImages.map(imageUrl => (
|
||||||
<Image
|
<Image
|
||||||
key={get(image, 'url', '')}
|
key={imageUrl}
|
||||||
style={{ flex: 1, resizeMode: 'cover' }}
|
style={{ flex: 1, resizeMode: 'cover' }}
|
||||||
resizeMethod="resize"
|
resizeMethod="resize"
|
||||||
source={{ uri: get(image, 'url', '') }}
|
source={{ uri: imageUrl }}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Carousel>
|
</Carousel>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import { Set, Record } from 'immutable';
|
||||||
import { type RawProduct } from '../apis/ProductsApi';
|
import { type RawProduct } from '../apis/ProductsApi';
|
||||||
import { type Category } from '../constants/CategoryConstants';
|
import { type Category } from '../constants/CategoryConstants';
|
||||||
import { type Quantity } from '../constants/QuantityConstants';
|
import { type Quantity } from '../constants/QuantityConstants';
|
||||||
import ImageRecord, { buildImageRecord } from './ImageRecord';
|
|
||||||
|
|
||||||
export type Product = {
|
export type Product = {
|
||||||
id: ?string,
|
id: ?string,
|
||||||
|
|
@ -13,7 +12,7 @@ export type Product = {
|
||||||
distance: number,
|
distance: number,
|
||||||
quantity: Quantity,
|
quantity: Quantity,
|
||||||
category: Category,
|
category: Category,
|
||||||
images: Set<ImageRecord>,
|
images: Set<string>,
|
||||||
thumbImage: ?string,
|
thumbImage: ?string,
|
||||||
titleImage: ?string,
|
titleImage: ?string,
|
||||||
lastupdated: number,
|
lastupdated: number,
|
||||||
|
|
@ -45,8 +44,7 @@ export const createProduct = (productRaw: ?RawProduct) => {
|
||||||
...productRaw,
|
...productRaw,
|
||||||
placeType: productRaw.placeType,
|
placeType: productRaw.placeType,
|
||||||
thumbImage: productRaw.thumbimage,
|
thumbImage: productRaw.thumbimage,
|
||||||
// images: new Set(map(buildImageRecord, pathOr([], ['images'], productRaw))),
|
images: new Set([productRaw.thumbimage]),
|
||||||
images: new Set([buildImageRecord({ url: productRaw.thumbimage })]),
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export function emitOne(fave: ?Fave) {
|
||||||
export default observable
|
export default observable
|
||||||
.combineLatest(products$)
|
.combineLatest(products$)
|
||||||
.map(([faves, products]) => {
|
.map(([faves, products]) => {
|
||||||
return faves && faves.map(fave => get(products, get(fave, 'food_item_id')));
|
return faves && faves.map(fave => get(products, get(fave, 'product_id')));
|
||||||
})
|
})
|
||||||
.combineLatest(filter$)
|
.combineLatest(filter$)
|
||||||
.map(([faveProducts, filter]) => {
|
.map(([faveProducts, filter]) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue